Clean up _get_args in run_checks.py

This commit is contained in:
Florian Bruhin 2014-12-21 18:59:10 +01:00
parent 2d1c12f69b
commit 791ff36c69

View File

@ -170,27 +170,28 @@ def check_vcs_conflict(target):
return None return None
def _get_args(checker): def _get_optional_args(checker):
"""Construct the arguments for a given checker.
Return:
A list of commandline arguments.
"""
def _get_optional_args(checker):
"""Get a list of arguments based on a comma-separated args config.""" """Get a list of arguments based on a comma-separated args config."""
try: try:
return config.get(checker, 'args').split(',') return config.get(checker, 'args').split(',')
except configparser.NoOptionError: except configparser.NoOptionError:
return [] return []
def _get_flag(arg, checker, option):
def _get_flag(arg, checker, option):
"""Get a list of arguments based on a config option.""" """Get a list of arguments based on a config option."""
try: try:
return ['--{}={}'.format(arg, config.get(checker, option))] return ['--{}={}'.format(arg, config.get(checker, option))]
except configparser.NoOptionError: except configparser.NoOptionError:
return [] return []
def _get_args(checker):
"""Construct the arguments for a given checker.
Return:
A list of commandline arguments.
"""
args = [] args = []
if checker == 'pylint': if checker == 'pylint':
args += _get_flag('disable', 'pylint', 'disable') args += _get_flag('disable', 'pylint', 'disable')