Skip to content

Instantly share code, notes, and snippets.

@jtauber
Created August 27, 2009 12:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jtauber/176257 to your computer and use it in GitHub Desktop.
Save jtauber/176257 to your computer and use it in GitHub Desktop.
#!/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