Skip to content

Commit

Permalink
core: fix inline suppression
Browse files Browse the repository at this point in the history
- allow '-' in id
- rewrite filtering to allow multiple items to be mapped
  better to the workflow

Closes #677

Signed-off-by: Konrad Weihmann <[email protected]>
  • Loading branch information
priv-kweihmann committed Jan 3, 2025
1 parent a6950a7 commit 451ac2d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion oelint_adv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def group_run(group: List[Tuple],
for item in stash.GetItemsFor(classifier=Comment.CLASSIFIER):
for line in item.get_items():
m = re.match(
r'^#\s+nooelint:\s+(?P<ids>[A-Za-z0-9\.,_ ]*)', line)
r'^#\s+nooelint:\s+(?P<ids>[A-Za-z0-9\.,_-]*)', line)
if m:
if item.Origin not in inline_supp_map: # pragma: no cover
inline_supp_map[item.Origin] = {}
Expand Down
19 changes: 18 additions & 1 deletion tests/test_inlinesuppressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_inlinesuppressions_single_notmatching_old(self, input_):
# nooelint: oelint.var.suggestedvar.BUGTRACKER,oelint.var.mandatoryvar.SUMMARY,oelint.var.bbclassextend
INSANE_SKIP_${PN} = "foo"
''',
}
},
],
)
def test_inlinesuppressions_line_1(self, input_):
Expand All @@ -91,6 +91,23 @@ def test_inlinesuppressions_line_1(self, input_):
self.check_for_id(self._create_args(input_),
'oelint.var.bbclassextend', 0)

@pytest.mark.parametrize('input_',
[
{
'oelint adv-test.bb':
'''
# nooelint: oelint.var.badimagefeature.allow-empty-password,oelint.var.badimagefeature.allow-root-login,oelint.var.badimagefeature.empty-root-password
IMAGE_FEATURES:append = " \
allow-empty-password allow-root-login empty-root-password \
"
''',
},
],
)
def test_inlinesuppressions_line_2(self, input_):
self.check_for_id(self._create_args(input_),
'oelint.var.badimagefeature', 0)

@pytest.mark.parametrize('input_',
[
{
Expand Down

0 comments on commit 451ac2d

Please sign in to comment.