Skip to content

Commit

Permalink
oelint.file.underscores: accept dashes in version numbers
Browse files Browse the repository at this point in the history
The initial code is complaining about dashes in the version part of the
filename for no really good reason.

Signed-off-by: Alexandre Bard <[email protected]>
  • Loading branch information
Alexandre Bard authored and priv-kweihmann committed Dec 3, 2024
1 parent 0cd2183 commit a5266e1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 2 additions & 3 deletions oelint_adv/rule_base/rule_file_underscores.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ def check(self, _file: str, stash: Stash) -> List[Tuple[str, int, str]]:
if _ext in ['.bb']: # pragma: no cover
if stash.IsPackageGroup(_file) or stash.IsImage(_file):
return []
_sep = [x for x in _basename if x in ['_', '-']]
_us = [x for x in _sep if x == '_']
_us = [x for x in _basename if x == '_']
if len(_us) > 1:
res += self.finding(_file, 1,
override_msg='Filename should not contain more than one \'_\'')
elif not _us or _sep[-1] != '_':
elif not _us:
res += self.finding(
_file, 1, override_msg='Filename should contain at least one \'_\' in the end')
return res
10 changes: 9 additions & 1 deletion tests/test_class_oelint_file_underscores.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TestClassOelintFileUnderscores(TestBaseClass):
@pytest.mark.parametrize('input_',
[
{
'oelint_adv-test.bb':
'oelint_adv_test-1.2.3.bb':
'VAR = "1"',
},
{
Expand All @@ -30,6 +30,14 @@ def test_bad(self, input_, id_, occurrence):
@pytest.mark.parametrize('occurrence', [0])
@pytest.mark.parametrize('input_',
[
{
'oelint_adv-test.bb':
'VAR = "1"',
},
{
'oelint-adv_test-1.2.3.bb':
'VAR = "1"',
},
{
'oelint_adv_test.bb':
'inherit core-image',
Expand Down

0 comments on commit a5266e1

Please sign in to comment.