Permalink
Browse files

Merge pull request #9 from Pike/feature/json-whitespace

Don't report trailing whitespace for json, #8
  • Loading branch information...
2 parents 44797a5 + 4feb70f commit 401424527788c3812c043928aeb2ae303e356a31 @jbalogh committed Apr 11, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 check.py
View
@@ -38,13 +38,15 @@ def captured_output():
checkers = []
-def checker(include='*', exclude=''):
+def checker(include='*', excludes=[]):
"""Decorator to register `func` in `checkers` and normalize output."""
def decorator(func):
@functools.wraps(func)
def helper(files):
files = fnmatch.filter(files, include)
- files = [f for f in files if not fnmatch.fnmatch(f, exclude)]
+ for expattern in excludes:
+ files = [f for f in files
+ if not fnmatch.fnmatch(f, expattern)]
if not files:
return ""
return func(files).strip()
@@ -90,7 +92,7 @@ def pep8(files):
return call(['pep8', '--repeat'] + files)
-@checker(exclude='*.py')
+@checker(excludes=['*.py', '*.json'])
def trailing_whitespace(files):
output = []
r = re.compile('\s+$')

0 comments on commit 4014245

Please sign in to comment.