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

misspell: ignore task flag statements #480

Merged
merged 1 commit into from
Jan 7, 2024
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
4 changes: 4 additions & 0 deletions oelint_adv/rule_base/rule_var_misspell.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from difflib import SequenceMatcher

from oelint_adv.cls_rule import Rule
from oelint_parser.cls_item import Function
from oelint_parser.cls_item import Variable
from oelint_parser.constants import CONSTANTS
from oelint_parser.helper_files import get_valid_package_names
Expand All @@ -26,12 +27,15 @@ def check(self, _file, stash):
_all = stash.GetItemsFor(filename=_file)
_extras = [f'SRCREV_{x}' for x in get_valid_named_resources(stash, _file)]
_pkgs = get_valid_package_names(stash, _file, strippn=True)
_taskname = CONSTANTS.FunctionsKnown + [x.FuncName for x in _all if isinstance(x, Function)]
for i in items:
_cleanvarname = i.VarName
if _cleanvarname in CONSTANTS.VariablesKnown:
continue
if _cleanvarname in _extras:
continue
if i.Flag and _cleanvarname in _taskname:
continue
for pkg in _pkgs:
if not pkg:
continue # pragma: no cover
Expand Down
6 changes: 6 additions & 0 deletions tests/test_class_oelint_vars_misspell.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ def test_bad(self, input_, id_, occurrence):
SRCREV_Csocket = "e8d9e0bb248c521c2c7fa01e1c6a116d929c41b4"
''',
},
{
'oelint_adv_test.bb':
'''
do_install[prefuncs] += "foo"
''',
},
],
)
def test_good(self, input_, id_, occurrence):
Expand Down