Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main: fix list assembly of suppress #442

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions oelint_adv/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
class TypeSafeAppendAction(argparse.Action):

def __call__(self, parser, namespace, values, option_string=None):
if not isinstance(values, str):
return # pragma: no cover
items = getattr(namespace, self.dest) or []
if isinstance(items, str):
items = RegexRpl.split(r'\s+|\t+|\n+', items) # pragma: no cover
items.append(values) # pragma: no cover
setattr(namespace, self.dest, items) # pragma: no cover
items.extend(RegexRpl.split(r'\s+|\t+|\n+', values.strip('"').strip("'")))
setattr(namespace, self.dest, items)


def deserialize_boolean_options(options: Dict) -> Dict[str, Union[str, bool]]:
Expand Down
19 changes: 19 additions & 0 deletions tests/test_user_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,3 +836,22 @@ def test_sorted_by_file_and_line(self, capsys, input_):
issues = [x[0] for x in run(_args)]

assert sorted(issues, key=lambda x: x[0]) == issues

@pytest.mark.parametrize('input_',
[
{
'oelint_adv-test_2.bb':
'''
VAR = "1"
INSANE_SKIP_${PN} = "foo"
''',
}
],
)
def test_suppress(self, capsys, input_):
_args = self._create_args(input_, ['--suppress="a b c"', '--suppress="d"'])

assert "a" in _args.suppress
assert "b" in _args.suppress
assert "c" in _args.suppress
assert "d" in _args.suppress