diff options
author | Mads Kiilerich <mads@kiilerich.com> | 2009-01-28 00:58:01 +0100 |
---|---|---|
committer | Mads Kiilerich <mads@kiilerich.com> | 2009-01-28 00:58:01 +0100 |
commit | 25f7172c2bbe2a22ffa104c6bcf9ea0fd751e6ba (patch) | |
tree | 7ae251639aa5eb289fac8bb4d4878cc680d09d4b /lint.py | |
parent | 00e028211f20cfc3c171f7848fbf88443e0e614c (diff) | |
download | pylint-git-25f7172c2bbe2a22ffa104c6bcf9ea0fd751e6ba.tar.gz |
Let pylint exit code indicate result of checks
If _any_ messages are shown the exitcode will be set to 2.
(Exitcode 1 already indicates that no files were specified.)
This implements what is requested on https://www.logilab.net/elo/ticket/4691 .
The approach taken in this patch is however that any message is an error. If a
message shouldn't count as an error it should be disabled.
There is a risk that some tool tools which call pylint could interprete the
exit code as if _pylint_ failed, and not that pylint completed its job and
concluded that the checked _files_ failed.
Some smoketests fails with this change - how do I change them to accept exitcode 2?
Diffstat (limited to 'lint.py')
-rw-r--r-- | lint.py | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -254,6 +254,7 @@ This is used by the global evaluation report (R0004).'}), self.base_file = None self.current_name = None self.current_file = None + self.msg_counter = None self.stats = None # init options self.options = options + PyLinter.options @@ -579,6 +580,7 @@ This is used by the global evaluation report (R0004).'}), def open(self): """initialize counters""" + self.msg_counter = 0 self.stats = { 'by_module' : {}, 'by_msg' : {}, 'statement' : 0 @@ -853,6 +855,8 @@ processing. else: linter.check(args) sys.path.pop(0) + if self.linter.msg_counter: + sys.exit(2) def cb_rpython_mode(self, name, value): from pylint.checkers.rpython import RPythonChecker |