From 76fc591fd2f342882bca45da0e32c16ffcc599c3 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 7 Feb 2014 19:39:55 +0100 Subject: [PATCH] Refactor run_checks.py --- run_checks.py | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/run_checks.py b/run_checks.py index 455f2f080..3c02d527e 100644 --- a/run_checks.py +++ b/run_checks.py @@ -128,25 +128,27 @@ def _check_line(fn): return False return True -args = [] -if options['disable']['pylint']: - args += ['--disable=' + ','.join(options['disable']['pylint'])] -if options['exclude']: - args += ['--ignore=' + ','.join(options['exclude'])] -if options['other']['pylint']: - args += options['other']['pylint'] -run('pylint', args) - -# FIXME what the hell is the flake8 exit status? -args = [] -if options['disable']['flake8']: - args += ['--ignore=' + ','.join(options['disable']['flake8'])] -if options['exclude']: - args += ['--exclude=' + ','.join(options['exclude'])] -if options['other']['flake8']: - args += options['other']['flake8'] -run('flake8', args) +def _get_args(checker): + args = [] + if checker == 'pylint': + try: + args += ['--disable=' + ','.join(options['disable']['pylint'])] + args += ['--ignore=' + ','.join(options['exclude'])] + args += options['other']['pylint'] + except KeyError: + pass + elif checker == 'flake8': + try: + args += ['--ignore=' + ','.join(options['disable']['flake8'])] + args += ['--exclude=' + ','.join(options['exclude'])] + args += options['other']['flake8'] + 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() print('Exit status values:')