URL: https://github.com/freeipa/freeipa/pull/825
Author: MartinBasti
 Title: #825: Pylint 1.7 fixes
Action: opened

PR body:
"""
Please note that not everything is fixed yet.

For the rest of issues I'd wait for a new release of pylint with fixed 
regressions.

https://pagure.io/freeipa/issue/6874
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/825/head:pr825
git checkout pr825
From 6044611905509ccfdc2ebb8fb6a8ed75655db1d6 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Fri, 26 May 2017 21:21:34 +0200
Subject: [PATCH 1/3] Pylint: fix ipa_forbidden_import checker

Pylint 1.7 changed internals, so we have update our custom checker

https://pagure.io/freeipa/issue/6874
---
 pylint_plugins.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pylint_plugins.py b/pylint_plugins.py
index 472328cc42..b17e7db81a 100644
--- a/pylint_plugins.py
+++ b/pylint_plugins.py
@@ -311,7 +311,7 @@ def open(self):
         self._forbidden_imports_stack = []
 
     def _get_forbidden_import_rule(self, node):
-        path = node.source_file
+        path = node.path
         if path:
             path = os.path.abspath(path)
             while path.startswith(self._dir):

From 1c98bdf509d17d0570e211122243f53d67eaf8de Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Fri, 26 May 2017 21:41:40 +0200
Subject: [PATCH 2/3] pylint: ignore new checks added in 1.7

New checks will be temporarily disabled until fixed.

https://pagure.io/freeipa/issue/6874
---
 pylintrc | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/pylintrc b/pylintrc
index f92adeea8b..e9ac639bdb 100644
--- a/pylintrc
+++ b/pylintrc
@@ -84,7 +84,15 @@ disable=
     singleton-comparison,
     misplaced-comparison-constant,
     not-a-mapping,
-    singleton-comparison
+    singleton-comparison,
+    len-as-condition,  # new in pylint 1.7
+    no-else-return,  # new in pylint 1.7
+    literal-comparison,  # new in pylint 1.7
+    single-string-used-for-slots,  # new in pylint 1.7
+    useless-super-delegation,  # new in pylint 1.7
+    redefined-argument-from-local,  # new in pylint 1.7
+    consider-merging-isinstance,  # new in pylint 1.7
+    consider-iterating-dictionary,  # wontfix for better python2/3 code
 
 
 [REPORTS]

From 1006e50fb2d072aea5318f87ed974fcf0478df15 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Fri, 26 May 2017 22:49:57 +0200
Subject: [PATCH 3/3] pylint: disable false positive warnings

Disable various false positive warnings reported by pylint 1.7

https://pagure.io/freeipa/issue/6874
---
 ipalib/parameters.py               | 3 +++
 ipatests/test_ipapython/test_dn.py | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/ipalib/parameters.py b/ipalib/parameters.py
index 107cc9010d..f8f1825cb4 100644
--- a/ipalib/parameters.py
+++ b/ipalib/parameters.py
@@ -1226,7 +1226,10 @@ def _enforce_numberclass(self, value):
     def _enforce_precision(self, value):
         assert type(value) is decimal.Decimal
         if self.precision is not None:
+            # pylint: disable=invalid-unary-operand-type
+            # https://github.com/PyCQA/pylint/issues/1472
             quantize_exp = decimal.Decimal(10) ** -self.precision
+            # pylint: enable=invalid-unary-operand-type
             try:
                 value = value.quantize(quantize_exp)
             except decimal.DecimalException as e:
diff --git a/ipatests/test_ipapython/test_dn.py b/ipatests/test_ipapython/test_dn.py
index 0f004c5817..a11d416e20 100644
--- a/ipatests/test_ipapython/test_dn.py
+++ b/ipatests/test_ipapython/test_dn.py
@@ -528,7 +528,9 @@ def test_indexing(self):
     def test_assignments(self):
         rdn = RDN((self.attr1, self.value1))
         with self.assertRaises(TypeError):
+            # pylint: disable=unsupported-assignment-operation
             rdn[0] = self.ava2
+            # pylint: enable=unsupported-assignment-operation
 
     def test_iter(self):
         rdn1 = RDN(self.rdn1)
@@ -954,9 +956,13 @@ def test_indexing(self):
     def test_assignments(self):
         dn = DN('t=0,t=1,t=2,t=3,t=4,t=5,t=6,t=7,t=8,t=9')
         with self.assertRaises(TypeError):
+            # pylint: disable=unsupported-assignment-operation
             dn[0] = RDN('t=a')
+            # pylint: enable=unsupported-assignment-operation
         with self.assertRaises(TypeError):
+            # pylint: disable=unsupported-assignment-operation
             dn[0:1] = [RDN('t=a'), RDN('t=b')]
+            # pylint: enable=unsupported-assignment-operation
 
     def test_iter(self):
         dn1 = DN(self.dn1)
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to