summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-01-22 19:23:40 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-01-22 19:23:40 -0500
commit9d9a8fedf69cacf22c4c25bb90b13f882a904299 (patch)
tree5e9ae78a288d46bd4e74cf299d54bdb54749c2c9
parent7e585eba72689122aaa081f5974746c761096be3 (diff)
downloaddeheader-9d9a8fedf69cacf22c4c25bb90b13f882a904299.tar.gz
deheader-9d9a8fedf69cacf22c4c25bb90b13f882a904299.tar.bz2
deheader-9d9a8fedf69cacf22c4c25bb90b13f882a904299.tar.xz
deheader-9d9a8fedf69cacf22c4c25bb90b13f882a904299.zip
pylint cleanup.
-rw-r--r--Makefile7
-rwxr-xr-xdeheader23
2 files changed, 14 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index dbe0926..e2b6aea 100644
--- a/Makefile
+++ b/Makefile
@@ -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)
diff --git a/deheader b/deheader
index a0342b2..f467d00 100755
--- a/deheader
+++ b/deheader
@@ -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,