diff options
Diffstat (limited to 'checkeol.py')
| -rw-r--r-- | checkeol.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/checkeol.py b/checkeol.py new file mode 100644 index 00000000..65843eec --- /dev/null +++ b/checkeol.py @@ -0,0 +1,24 @@ +# Check files for incorrect newlines + +import fnmatch, os + +def check_file(fname): + for n, line in enumerate(open(fname, "rb")): + if "\r" in line: + print "%s@%d: CR found" % (fname, n) + return + +def check_files(root, patterns): + for root, dirs, files in os.walk(root): + for f in files: + fname = os.path.join(root, f) + for p in patterns: + if fnmatch.fnmatch(fname, p): + check_file(fname) + break + if '.svn' in dirs: + dirs.remove('.svn') + +check_files("coverage", ["*.py"]) +check_files("test", ["*.py"]) +check_file("setup.py") |
