diff --git a/oelint_adv/core.py b/oelint_adv/core.py index 053be56..3daaf3a 100644 --- a/oelint_adv/core.py +++ b/oelint_adv/core.py @@ -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[A-Za-z0-9\.,_ ]*)', line) + r'^#\s+nooelint:\s+(?P[A-Za-z0-9\.,_\s-]*)', line) if m: if item.Origin not in inline_supp_map: # pragma: no cover inline_supp_map[item.Origin] = {} diff --git a/tests/test_inlinesuppressions.py b/tests/test_inlinesuppressions.py index 1979b89..563e1c8 100644 --- a/tests/test_inlinesuppressions.py +++ b/tests/test_inlinesuppressions.py @@ -56,7 +56,7 @@ def test_inlinesuppressions_single(self, input_): def test_inlinesuppressions_single_notmatching(self, input_): self.check_for_id(self._create_args(input_), 'oelint.vars.insaneskip', 1) - + @pytest.mark.parametrize('input_', [ { @@ -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_): @@ -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_', [ { @@ -128,3 +145,20 @@ def test_inlinesuppressions_multiple_scope(self, input_): 'oelint.vars.doublemodify', 1) self.check_for_id(self._create_args(input_), 'oelint.vars.overrideappend', 1) + + @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_remove_empty(self, input_): + self.check_for_id(self._create_args(input_), + 'oelint.var.badimagefeature', 0)