diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-07-21 22:49:42 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-07-21 22:49:42 -0400 |
commit | e58fe9e2ca898f90afda50a859c4719db36669e3 (patch) | |
tree | e77c3b8a3d286101c1e2136f080c461d0a5c4e2a /igor.py | |
parent | a02bec0469a9f1cf9e77c13b2fa9043f723fbb0f (diff) | |
download | python-coveragepy-git-e58fe9e2ca898f90afda50a859c4719db36669e3.tar.gz |
Make the file checker fancy enough to not complain about bom.py
Diffstat (limited to 'igor.py')
-rw-r--r-- | igor.py | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -52,8 +52,14 @@ def do_check_eol(args): """Check files for incorrect newlines and trailing whitespace.""" ignore_dirs = ['.svn', '.hg', '.tox'] + checked = set([]) def check_file(fname, crlf=True, trail_white=True): + fname = os.path.relpath(fname) + if fname in checked: + return + checked.add(fname) + for n, line in enumerate(open(fname, "rb")): if crlf: if "\r" in line: @@ -61,6 +67,8 @@ def do_check_eol(args): return if trail_white: line = line[:-1] + if not crlf: + line = line.rstrip('\r') if line.rstrip() != line: print("%s@%d: trailing whitespace found" % (fname, n+1)) return @@ -73,12 +81,13 @@ def do_check_eol(args): if fnmatch.fnmatch(fname, p): check_file(fname, **kwargs) break - for pattern in ignore_dirs: - if pattern in dirs: - dirs.remove(pattern) + for dir_name in ignore_dirs: + if dir_name in dirs: + dirs.remove(dir_name) check_files("coverage", ["*.py", "*.c"]) check_files("coverage/htmlfiles", ["*.html", "*.css", "*.js"]) + check_file("test/farm/html/src/bom.py", crlf=False) check_files("test", ["*.py"]) check_files("test", ["*,cover"], trail_white=False) check_files("test/js", ["*.js", "*.html"]) |