mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Lint: Skip checking of functions stolen by python-nose.
python-nose modifies namespaces in a way that confuses pylint. To skip these PyCheckers' visit_callfunc method must be extended. Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
13
make-lint
13
make-lint
@@ -29,7 +29,8 @@ try:
|
||||
from pylint import checkers
|
||||
from pylint.lint import PyLinter
|
||||
from pylint.checkers.typecheck import TypeChecker
|
||||
from astroid import Class, Instance, Module, InferenceError
|
||||
from pylint.checkers.utils import safe_infer
|
||||
from astroid import Class, Instance, Module, InferenceError, Function
|
||||
from pylint.reporters.text import TextReporter
|
||||
except ImportError:
|
||||
print >> sys.stderr, "To use {0}, please install pylint.".format(sys.argv[0])
|
||||
@@ -58,7 +59,7 @@ class IPATypeChecker(TypeChecker):
|
||||
'fragment', 'username', 'password', 'hostname', 'port'],
|
||||
'urlparse.ParseResult': ['params'],
|
||||
'pytest': ['fixture', 'raises', 'skip', 'yield_fixture', 'mark', 'fail'],
|
||||
'nose.tools': ['assert_equal', 'assert_raises'],
|
||||
'unittest.case': ['assertEqual', 'assertRaises'],
|
||||
'datetime.tzinfo': ['houroffset', 'minoffset', 'utcoffset', 'dst'],
|
||||
|
||||
# IPA classes
|
||||
@@ -130,6 +131,14 @@ class IPATypeChecker(TypeChecker):
|
||||
|
||||
super(IPATypeChecker, self).visit_getattr(node)
|
||||
|
||||
def visit_callfunc(self, node):
|
||||
called = safe_infer(node.func)
|
||||
if isinstance(called, Function):
|
||||
if called.name in self.ignore.get(called.root().name, []):
|
||||
return
|
||||
|
||||
super(IPATypeChecker, self).visit_callfunc(node)
|
||||
|
||||
class IPALinter(PyLinter):
|
||||
ignore = (TypeChecker,)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user