Skip to content

Commit 4f6a766

Browse files
authored
Merge pull request #1395 from qha/permit-repeating-rpmlintrc
Permit repeating --rpmlintrc
2 parents 0349170 + 9c2f6db commit 4f6a766

3 files changed

Lines changed: 3 additions & 12 deletions

File tree

rpmlint/cli.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def process_lint_args(argv):
7575
parser.add_argument('-V', '--version', action='version', version=__version__, help='show package version and exit')
7676
parser.add_argument('-c', '--config', type=_validate_conf_location, help='load up additional configuration data from specified path (file or directory with *.toml files)')
7777
parser.add_argument('-e', '--explain', nargs='+', default='', help='provide detailed explanation for one specific message id')
78-
parser.add_argument('-r', '--rpmlintrc', '--file', type=_is_file_path, help='load up specified rpmlintrc file')
78+
parser.add_argument('-r', '--rpmlintrc', '--file', action='append', type=_is_file_path, help='load up specified rpmlintrc file (may be repeated)')
7979
parser.add_argument('-v', '--verbose', '--info', action='store_true', help='provide detailed explanations where available')
8080
parser.add_argument('-p', '--print-config', action='store_true', help='print the settings that are in effect when using the rpmlint')
8181
parser.add_argument('-i', '--installed', nargs='+', default='', help='installed packages to be validated by rpmlint')
@@ -96,11 +96,7 @@ def process_lint_args(argv):
9696

9797
options = parser.parse_args(args=argv)
9898

99-
# make sure rpmlintrc exists
100-
if options.rpmlintrc and not options.rpmlintrc.exists():
101-
print_warning(f"User specified rpmlintrc '{options.rpmlintrc}' does not exist")
102-
sys.exit(2)
103-
# validate all the rpmlfile options to be either file or folder
99+
# validate all the rpmfile options to be either file or folder
104100
f_path = set()
105101
invalid_path = False
106102
for item in options.rpmfile:

rpmlint/lint.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ def __init__(self, options):
3737
else:
3838
self.profile = None
3939

40-
if options['rpmlintrc']:
41-
options['rpmlintrc'] = [options['rpmlintrc']]
4240
self._load_rpmlintrc()
4341
if options['verbose']:
4442
self.config.info = options['verbose']
@@ -179,9 +177,6 @@ def _load_rpmlintrc(self):
179177
Load rpmlintrc from argument or load up from folder
180178
"""
181179
if self.options['rpmlintrc']:
182-
# Right now, we allow loading of just a single file, but the 'opensuse'
183-
# branch contains auto-loading mechanism that can eventually load
184-
# multiple files.
185180
for rcfile in self.options['rpmlintrc']:
186181
self.config.load_rpmlintrc(rcfile)
187182
else:

test/test_lint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def test_run_rpmlintrc_multiple(capsys, packages):
445445
def test_run_rpmlintrc_single_file(capsys, packages):
446446
additional_options = {
447447
'rpmfile': [packages],
448-
'rpmlintrc': TEST_RPMLINTRC
448+
'rpmlintrc': [TEST_RPMLINTRC]
449449
}
450450
options = {**options_preset, **additional_options}
451451
linter = Lint(options)

0 commit comments

Comments
 (0)