diff options
author | Georg Brandl <georg@python.org> | 2014-10-04 22:01:53 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-10-04 22:01:53 +0200 |
commit | 1e75a5a177265273f90720a49608fc0d370a82f4 (patch) | |
tree | 38a4a4078c0b48044c3fe2b8f8189acc5950acab /scripts | |
parent | 400be92006f97f7d18dfccd358d728a0d719839d (diff) | |
download | pygments-1e75a5a177265273f90720a49608fc0d370a82f4.tar.gz |
check_sources: allow 110 line length, skip examplefiles directory
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/check_sources.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/check_sources.py b/scripts/check_sources.py index 94c2c15d..008d893a 100755 --- a/scripts/check_sources.py +++ b/scripts/check_sources.py @@ -23,8 +23,10 @@ from os.path import join, splitext, abspath checkers = {} + def checker(*suffixes, **kwds): only_pkg = kwds.pop('only_pkg', False) + def deco(func): for suffix in suffixes: checkers.setdefault(suffix, []).append(func) @@ -58,7 +60,7 @@ def check_syntax(fn, lines): def check_style_and_encoding(fn, lines): encoding = 'ascii' for lno, line in enumerate(lines): - if len(line) > 90: + if len(line) > 110: yield lno+1, "line too long" m = not_ix_re.search(line) if m: @@ -176,16 +178,19 @@ def main(argv): for root, dirs, files in os.walk(path): if '.hg' in dirs: dirs.remove('.hg') + if 'examplefiles' in dirs: + dirs.remove('examplefiles') if '-i' in opts and abspath(root) in opts['-i']: del dirs[:] continue # XXX: awkward: for the Makefile call: don't check non-package # files for file headers - in_pocoo_pkg = root.startswith('./pygments') + in_pygments_pkg = root.startswith('./pygments') for fn in files: fn = join(root, fn) - if fn[:2] == './': fn = fn[2:] + if fn[:2] == './': + fn = fn[2:] if '-i' in opts and abspath(fn) in opts['-i']: continue @@ -207,7 +212,7 @@ def main(argv): continue for checker in checkerlist: - if not in_pocoo_pkg and checker.only_pkg: + if not in_pygments_pkg and checker.only_pkg: continue for lno, msg in checker(fn, lines): print(u"%s:%d: %s" % (fn, lno, msg), file=out) |