Skip to content

Commit

Permalink
rules: Fix override false positive
Browse files Browse the repository at this point in the history
Fix #557

Signed-off-by: Vyacheslav Yurkov <[email protected]>
  • Loading branch information
UVV-gh authored and priv-kweihmann committed Apr 2, 2024
1 parent 5925f45 commit 0aedbde
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion oelint_adv/rule_base/rule_vars_variable_override.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def check(self, _file: str, stash: Stash) -> List[Tuple[str, int, str]]:
res = []
_all: List[Variable] = list(x for x in stash.GetItemsFor(filename=_file, classifier=Variable.CLASSIFIER)) # noqa: C400
for v in {x.VarName for x in _all}:
items = [x for x in _all if x.VarName == v]
items = [x for x in _all if x.VarName == v and x.IsImmediateModify()]
items = sorted(items, key=lambda x: x.Line, reverse=False)
for sub in [x.SubItem for x in items]:
# Get all entries but not the only that do immediate expansion,
Expand Down
8 changes: 8 additions & 0 deletions tests/test_class_oelint_var_override.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ def test_bad(self, input_, id_, occurrence):
FILESEXTRAPATH_append := ":b"
''',
},
{
'oelint_adv_test.bb':
'''
PACKAGECONFIG = "a b c"
PACKAGECONFIG:remove = "a"
PACKAGECONFIG:remove = "b"
''',
},
],
)
def test_good(self, input_, id_, occurrence):
Expand Down

0 comments on commit 0aedbde

Please sign in to comment.