Created
August 27, 2009 12:42
-
-
Save jtauber/176257 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import os.path | |
for root, dirs, files in os.walk("."): | |
for filename in files: | |
path = os.path.join(root, filename) | |
if any(filename.endswith(ending) for ending in [".py", ".html", ".txt", ".css"]): | |
tabs = False | |
cr = False | |
trail = False | |
for line_num, line in enumerate(open(path)): | |
if "\t" in line: | |
tabs = line_num + 1 | |
if "\r" in line: | |
cr = line_num + 1 | |
if line.strip() and line.rstrip() != line.rstrip("\n\r"): | |
trail = line_num + 1 | |
if tabs and cr and trail: # shortcut out if we all three | |
break | |
if tabs: | |
print "TABS in", path, "(last %s)" % tabs | |
if cr: | |
print "CR in", path, "(last %s)" % cr | |
if trail: | |
print "TRAIL in", path, "(last %s)" % trail |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment