diff --git a/oelint_adv/rule_base/rule_file_underscores.py b/oelint_adv/rule_base/rule_file_underscores.py index 7343c1f..56658a4 100644 --- a/oelint_adv/rule_base/rule_file_underscores.py +++ b/oelint_adv/rule_base/rule_file_underscores.py @@ -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 diff --git a/tests/test_class_oelint_file_underscores.py b/tests/test_class_oelint_file_underscores.py index b567ad1..2c7d9a2 100644 --- a/tests/test_class_oelint_file_underscores.py +++ b/tests/test_class_oelint_file_underscores.py @@ -10,7 +10,7 @@ class TestClassOelintFileUnderscores(TestBaseClass): @pytest.mark.parametrize('input_', [ { - 'oelint_adv-test.bb': + 'oelint_adv_test-1.2.3.bb': 'VAR = "1"', }, { @@ -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',