Refactor run_checks.py

This commit is contained in:
Florian Bruhin 2014-02-07 19:39:55 +01:00
parent dadfc952d1
commit 76fc591fd2

View File

@ -128,25 +128,27 @@ def _check_line(fn):
return False return False
return True return True
args = [] def _get_args(checker):
if options['disable']['pylint']: args = []
if checker == 'pylint':
try:
args += ['--disable=' + ','.join(options['disable']['pylint'])] args += ['--disable=' + ','.join(options['disable']['pylint'])]
if options['exclude']:
args += ['--ignore=' + ','.join(options['exclude'])] args += ['--ignore=' + ','.join(options['exclude'])]
if options['other']['pylint']:
args += options['other']['pylint'] args += options['other']['pylint']
run('pylint', args) except KeyError:
pass
# FIXME what the hell is the flake8 exit status? elif checker == 'flake8':
args = [] try:
if options['disable']['flake8']:
args += ['--ignore=' + ','.join(options['disable']['flake8'])] args += ['--ignore=' + ','.join(options['disable']['flake8'])]
if options['exclude']:
args += ['--exclude=' + ','.join(options['exclude'])] args += ['--exclude=' + ','.join(options['exclude'])]
if options['other']['flake8']:
args += options['other']['flake8'] args += options['other']['flake8']
run('flake8', args) except KeyError:
pass
return args
for checker in ['pylint', 'flake8']:
# FIXME what the hell is the flake8 exit status?
run(checker, _get_args(checker))
check_line() check_line()
print('Exit status values:') print('Exit status values:')