diff options
-rw-r--r-- | Makefile | 7 | ||||
-rwxr-xr-x | deheader | 23 |
2 files changed, 14 insertions, 16 deletions
@@ -21,10 +21,9 @@ regress: makeregress: cd test; make --quiet makeregress -pychecker: - @ln -f deheader deheader.py - @-pychecker --quiet --only --limit 50 deheader.py - @rm -f deheader.py* +PYLINTOPTS = --rcfile=/dev/null --reports=n --include-ids=y --disable="C0103,C0111,C0301,C0302,C0323,R0903,R0912,R0913,R0914,R0915,W0141,W0611,W0621" +pylint: + @pylint --output-format=parseable $(PYLINTOPTS) deheader version: @echo $(VERS) @@ -1340,11 +1340,11 @@ def trim(line): elif trimmed[0] == '<': return trimmed.split('>')[0] + ">" else: - return `line` + return repr(line) def testcompile(source, maker, msg="", verbosity=0, showerrs=False): "Test-compile a sourcefile. Return the status and the compilation time" - (stem, suffix) = os.path.splitext(source) + (stem, _suffix) = os.path.splitext(source) derived = stem + ".o" if os.path.exists(derived): os.remove(derived) @@ -1361,8 +1361,7 @@ def testcompile(source, maker, msg="", verbosity=0, showerrs=False): else: explain = "succeeded" if verbosity >= PROGRESS_DEBUG: - print "deheader: %s%s %s." \ - % (sourcefile, msg, explain) + print "deheader: %s%s %s." % (source, msg, explain) if os.path.exists(derived): os.remove(derived) return (status, end - start) @@ -1391,7 +1390,7 @@ def c_analyze(sourcefile, maker, includes, requires, verbosity): retain += 1 if not retain: saveit.remove_headers([header]) - (st, t) = testcompile(sourcefile, maker, " without %s" % trim(header), verbosity, showerrs=False) + (st, _t) = testcompile(sourcefile, maker, " without %s" % trim(header), verbosity, showerrs=False) if st == 0: unneeded.append(header) includes.remove(header) @@ -1413,7 +1412,7 @@ def c_analyze(sourcefile, maker, includes, requires, verbosity): def deheader(sourcefile, maker, includes, requires, remove, verbose): # Sanity check against broken sourcefiles; we want this to # complain visibly if the sourcefile won't build at all. - (st, t) = testcompile(sourcefile, maker, verbosity=max(1, verbose), showerrs=True) + (st, _t) = testcompile(sourcefile, maker, verbosity=max(1, verbose), showerrs=True) if st == 0: # Now do the analysis if sourcefile.endswith(".c") or sourcefile.endswith(".cpp") or sourcefile.endswith(".cc"): @@ -1458,7 +1457,7 @@ if __name__ == "__main__": verbose = 0 remove = False ignores = [] - excludes = [] + exclusions = [] for (switch, val) in options: if switch in ('-h', '--help'): sys.stderr.write(__doc__) @@ -1475,19 +1474,19 @@ if __name__ == "__main__": print "deheader", version raise SystemExit, 0 elif switch in ('-x', '--exclude'): - excludes.append(val) + exclusions.append(val) if not ignores: ignore = None else: ignore = re.compile("|".join(ignores)) - if not excludes: - excludes = None + if not exclusions: + exclusions = None else: - excludes = re.compile("|".join(excludes)) + exclusions = re.compile("|".join(exclusions)) if not arguments: arguments = ["."] - inclusion_map = InclusionMap(arguments, ignore, excludes, verbose) + inclusion_map = InclusionMap(arguments, ignore, exclusions, verbose) summaries = [] for sourcefile in inclusion_map.depends_on: summaries.append(deheader(sourcefile, maker, |