##// END OF EJS Templates
check-code: add --nolineno option for hiding line numbers...
Mads Kiilerich -
r15502:7917a104 default
parent child Browse files
Show More
@@ -302,7 +302,7 b' def getblame(f):'
302 return lines
302 return lines
303
303
304 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
304 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
305 blame=False, debug=False):
305 blame=False, debug=False, lineno=True):
306 """checks style and portability of a given file
306 """checks style and portability of a given file
307
307
308 :f: filepath
308 :f: filepath
@@ -385,7 +385,7 b' def checkfile(f, logfunc=_defaultlogger.'
385 bl, bu, br = blamecache[n]
385 bl, bu, br = blamecache[n]
386 if bl == l:
386 if bl == l:
387 bd = '%s@%s' % (bu, br)
387 bd = '%s@%s' % (bu, br)
388 errors.append((f, n + 1, l, msg, bd))
388 errors.append((f, lineno and n + 1, l, msg, bd))
389 result = False
389 result = False
390
390
391 errors.sort()
391 errors.sort()
@@ -408,8 +408,11 b' if __name__ == "__main__":'
408 help="use annotate to generate blame info")
408 help="use annotate to generate blame info")
409 parser.add_option("", "--debug", action="store_true",
409 parser.add_option("", "--debug", action="store_true",
410 help="show debug information")
410 help="show debug information")
411 parser.add_option("", "--nolineno", action="store_false",
412 dest='lineno', help="don't show line numbers")
411
413
412 parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False)
414 parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False,
415 lineno=True)
413 (options, args) = parser.parse_args()
416 (options, args) = parser.parse_args()
414
417
415 if len(args) == 0:
418 if len(args) == 0:
@@ -420,6 +423,7 b' if __name__ == "__main__":'
420 for f in check:
423 for f in check:
421 ret = 0
424 ret = 0
422 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
425 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
423 blame=options.blame, debug=options.debug):
426 blame=options.blame, debug=options.debug,
427 lineno=options.lineno):
424 ret = 1
428 ret = 1
425 sys.exit(ret)
429 sys.exit(ret)
@@ -132,3 +132,11 b''
132 object comparison with literal
132 object comparison with literal
133 [1]
133 [1]
134
134
135 $ cat > warning.py <<EOF
136 > except:
137 > EOF
138 $ "$check_code" warning.py --warning --nolineno
139 warning.py:0:
140 > except:
141 warning: naked except clause
142 [1]
General Comments 0
You need to be logged in to leave comments. Login now