Mercurial > hg-stable
diff contrib/check-code.py @ 15502:7917a104a285
check-code: add --nolineno option for hiding line numbers
This makes the output more stable when it is used as a whitelist.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 11 Nov 2011 01:25:47 +0100 |
parents | 1470f8b00694 |
children | 53ef627cda30 |
line wrap: on
line diff
--- a/contrib/check-code.py Wed Nov 16 18:04:19 2011 -0600 +++ b/contrib/check-code.py Fri Nov 11 01:25:47 2011 +0100 @@ -302,7 +302,7 @@ return lines def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False, - blame=False, debug=False): + blame=False, debug=False, lineno=True): """checks style and portability of a given file :f: filepath @@ -385,7 +385,7 @@ bl, bu, br = blamecache[n] if bl == l: bd = '%s@%s' % (bu, br) - errors.append((f, n + 1, l, msg, bd)) + errors.append((f, lineno and n + 1, l, msg, bd)) result = False errors.sort() @@ -408,8 +408,11 @@ help="use annotate to generate blame info") parser.add_option("", "--debug", action="store_true", help="show debug information") + parser.add_option("", "--nolineno", action="store_false", + dest='lineno', help="don't show line numbers") - parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False) + parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False, + lineno=True) (options, args) = parser.parse_args() if len(args) == 0: @@ -420,6 +423,7 @@ for f in check: ret = 0 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings, - blame=options.blame, debug=options.debug): + blame=options.blame, debug=options.debug, + lineno=options.lineno): ret = 1 sys.exit(ret)