Skip to content

Commit

Permalink
misspell: bail out earlier for known vars
Browse files Browse the repository at this point in the history
so we could catch valid vars like expanded statements
of SRCREV_${PN} from the extra resources list.
The error surfaced only if a named resource has the very
same name as one of the valid package names.

Closes #468

Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
  • Loading branch information
priv-kweihmann committed Jan 7, 2024
1 parent b32d1c9 commit d753640
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions oelint_adv/rule_base/rule_var_misspell.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ def check(self, _file, stash):
_pkgs = get_valid_package_names(stash, _file, strippn=True)
for i in items:
_cleanvarname = i.VarName
if _cleanvarname in CONSTANTS.VariablesKnown:
continue
if _cleanvarname in _extras:
continue
for pkg in _pkgs:
if not pkg:
continue # pragma: no cover
if _cleanvarname.endswith(pkg):
_cleanvarname = ''.join(
_cleanvarname.rsplit(pkg, 1)) # pragma: no cover
if _cleanvarname in CONSTANTS.VariablesKnown:
continue
if _cleanvarname in _extras:
continue
_used = False
for a in _all:
if a == i:
Expand Down
11 changes: 11 additions & 0 deletions tests/test_class_oelint_vars_misspell.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ def test_bad(self, input_, id_, occurrence):
''',
},
{
'abc.bb':
'''
DEPENDS:qemux86 = "something"
SRC_URI = "git://github.com/znc/znc.git;name=abc;branch=master;protocol=https \\
git://github.com/jimloco/Csocket.git;destsuffix=git/third_party/Csocket;name=Csocket;branch=master;protocol=https"
SRCREV_abc = "bf253640d33d03331310778e001fb6f5aba2989e"
SRCREV_Csocket = "e8d9e0bb248c521c2c7fa01e1c6a116d929c41b4"
''',
},
],
)
def test_good(self, input_, id_, occurrence):
Expand Down

0 comments on commit d753640

Please sign in to comment.