Add new option --checks.

This commit is contained in:
Martin Liska 2022-02-21 15:35:52 +01:00
parent bae92d4204
commit 87a3c5a98b
3 changed files with 10 additions and 2 deletions

View File

@ -84,6 +84,8 @@ def process_lint_args(argv):
parser.add_argument('-T', '--profile', action='store_true', help='print cProfile report')
parser.add_argument('--ignore-unused-rpmlintrc', action='store_true',
help='Do not report "unused-rpmlintrc-filter" errors')
parser.add_argument('--checks',
help='Debugging option that enables only selected checks (separated by comma)')
lint_modes_parser = parser.add_mutually_exclusive_group()
lint_modes_parser.add_argument('-s', '--strict', action='store_true', help='treat all messages as errors')
lint_modes_parser.add_argument('-P', '--permissive', action='store_true', help='treat individual errors as non-fatal')

View File

@ -309,10 +309,15 @@ class Lint(object):
SingletonTM
"""
selected_checks = self.options['checks']
if selected_checks:
selected_checks = selected_checks.split(',')
for check in self.config.configuration['Checks']:
if check in self.checks:
continue
self.checks[check] = self.load_check(check)
if not selected_checks or check in selected_checks:
self.checks[check] = self.load_check(check)
def load_check(self, name):
"""Load a (check) module by its name, unless it is already loaded."""

View File

@ -23,7 +23,8 @@ options_preset = {
'installed': '',
'time_report': False,
'profile': False,
'ignore_unused_rpmlintrc': False
'ignore_unused_rpmlintrc': False,
'checks': None
}
basic_tests = [