in src/advisor/reports/issues/issue_type_config.py [0:0]
def __init__(self, config_string=None):
"""Parse the --issue-types command line argument to get the issue type
filter configuration.
Args:
config_str (str): The filter configuration string.
This is a comma-separated list of issue types to report. Alternatively
the configuration string may be used to add or remove issues from the
default filter. In this case issue types prefixed with '-' are removed
by the filter. Issue types prefixed with '+' are included by the filter.
"""
if config_string and not config_string.startswith('+') and not config_string.startswith('-'):
# User wants to replace the default list.
self._include_by_default = False
elif config_string:
config_string = IssueTypeConfig.DEFAULT_FILTER + ',' + config_string
self._include_by_default = True
else:
config_string = IssueTypeConfig.DEFAULT_FILTER
self._include_by_default = True
self.config_string = config_string
issue_types = config_string.split(',')
self.klasses = []
for issue_type in issue_types:
if not issue_type:
continue
if issue_type.startswith('-'):
want_this_issue_type = False
issue_type = issue_type[1:]
elif issue_type.startswith('+'):
want_this_issue_type = True
issue_type = issue_type[1:]
else:
want_this_issue_type = True
try:
klass = ISSUE_TYPES[issue_type]
self.klasses.append((klass, want_this_issue_type))
except KeyError:
print('Issue type filter: unknown issue type: %s' % issue_type, file=sys.stderr)