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

oelint.file.underscores: accept dashes in version numbers #669

Merged
merged 1 commit into from
Dec 3, 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
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
Loading