Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (28 sloc) 1.05 KB
#!/usr/bin/env python
# Author: Keegan Carruthers-Smith
import commands
import re
import sys
def make_re(*msgs):
return re.compile('(%s)' % '|'.join(msgs))
pyflakes_ignore = make_re('unable to detect undefined names')
pyflakes_warning = make_re(
'imported but unused',
'is assigned to but never used',
'redefinition of unused',
pep8_ignore = ['E501']
pep8_warning = make_re('.')
def pyflakespep8(cmd, ignore_re, warning_re):
output = commands.getoutput(cmd)
for line in output.splitlines():
if ignore_re and
elif ': ' in line and
line = '%s: WARNING %s' % tuple(line.split(': ', 1))
print line
pyflakespep8('pyflakes %s' % sys.argv[1], pyflakes_ignore, pyflakes_warning)
print '## pyflakes above, pep8 below ##'
pep8_ignore = ' '.join('--ignore=%s' % i for i in pep8_ignore)
pyflakespep8('pep8 %s --repeat %s' % (pep8_ignore, sys.argv[1]), None, pep8_warning)