Skip to content

Commit

Permalink
Fix collection of know keys for test, plan and story T001 linter
Browse files Browse the repository at this point in the history
The original code did not handle fields with dashes
(`restart-max-count`) and internal fields (`serial-number`).
  • Loading branch information
happz committed Jul 10, 2024
1 parent d332771 commit dcd6142
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tmt/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
WorkdirArgumentType,
cached_property,
container_field,
container_fields,
dict_to_yaml,
field,
git_clone,
Expand Down Expand Up @@ -897,7 +898,19 @@ def _export(

def _lint_keys(self, additional_keys: list[str]) -> list[str]:
""" Return list of invalid keys used, empty when all good """
known_keys = additional_keys + self._keys()

known_keys: list[str] = []

for field_ in container_fields(self):
_, key, _, _, metadata = container_field(self, field_.name)

if metadata.internal:
continue

known_keys.append(key)

known_keys.extend(additional_keys)

return [key for key in self.node.get() if key not in known_keys]

def lint_validate(self) -> LinterReturn:
Expand Down

0 comments on commit dcd6142

Please sign in to comment.