summaryrefslogtreecommitdiffstats
path: root/make-lint
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-08-19 12:18:54 +0200
committerPetr Viktorin <pviktori@redhat.com>2013-09-06 15:43:25 +0200
commita9225be0fa7bb834cd78609603300d81dcc4d3c9 (patch)
treef5e1aa43b605b032f13ac334bfd2cb5935222f0e /make-lint
parent85b974d1bc4f2921ea3efc1d0b769d9b8f26a5de (diff)
downloadfreeipa.git-a9225be0fa7bb834cd78609603300d81dcc4d3c9.tar.gz
freeipa.git-a9225be0fa7bb834cd78609603300d81dcc4d3c9.tar.xz
freeipa.git-a9225be0fa7bb834cd78609603300d81dcc4d3c9.zip
Make make-lint compatible with Pylint 1.0
Pylint 1.0 was released[0] and it brings some incompatibilities, as well as a bug[1] that's triggered by FreeIPA code. This patch updates make-lint to be compatible with Pylint 1.0, while keeping support for version 0.26. [0] http://www.logilab.org/blogentry/163292 [1] https://bitbucket.org/logilab/pylint/issue/47 Ticket: https://fedorahosted.org/freeipa/ticket/3865
Diffstat (limited to 'make-lint')
-rwxr-xr-xmake-lint21
1 files changed, 17 insertions, 4 deletions
diff --git a/make-lint b/make-lint
index fd7bea21..d9c66a84 100755
--- a/make-lint
+++ b/make-lint
@@ -28,9 +28,17 @@ from fnmatch import fnmatch, fnmatchcase
try:
from pylint import checkers
from pylint.lint import PyLinter
- from pylint.reporters.text import ParseableTextReporter
from pylint.checkers.typecheck import TypeChecker
- from logilab.astng import Class, Instance, InferenceError
+ try:
+ # Pylint 1.0
+ from astroid import Class, Instance, InferenceError
+ from pylint.reporters.text import TextReporter
+ have_pylint_1_0 = True
+ except ImportError:
+ # Older Pylint
+ from logilab.astng import Class, Instance, InferenceError
+ from pylint.reporters.text import ParseableTextReporter
+ have_pylint_1_0 = False
except ImportError:
print >> sys.stderr, "To use {0}, please install pylint.".format(sys.argv[0])
sys.exit(32)
@@ -222,8 +230,13 @@ def main():
if options.errors_only:
linter.disable_noerror_messages()
linter.enable('F')
- linter.set_reporter(ParseableTextReporter())
- linter.set_option('include-ids', True)
+ if have_pylint_1_0:
+ linter.set_reporter(TextReporter())
+ linter.set_option('msg-template',
+ '{path}:{line}: [{msg_id}({symbol}), {obj}] {msg})')
+ else:
+ linter.set_reporter(ParseableTextReporter())
+ linter.set_option('include-ids', True)
linter.set_option('reports', False)
linter.set_option('persistent', False)