Skip to content

Commit

Permalink
squash: tmt t lint should also try to cover adjust rules
Browse files Browse the repository at this point in the history
Signed-off-by: Vector Li <[email protected]>
  • Loading branch information
Vector Li committed Feb 27, 2024
1 parent 688d32c commit c5020ec
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tmt/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,8 +893,17 @@ 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()
return [key for key in self.node.get() if key not in known_keys]
node_keys = list(self.node.get().keys())
prop_adjust = self.node.get('adjust')
if prop_adjust is not None:
if isinstance(prop_adjust, dict):
node_keys.extend(prop_adjust.keys())
elif isinstance(prop_adjust, (list, tuple)):
node_keys.extend([key for element in prop_adjust for key in element.keys()])
else:
raise tmt.utils.GeneralError(
f"Invalid adjust '{prop_adjust}'.")
return [key for key in node_keys if key not in known_keys]

def lint_validate(self) -> LinterReturn:
""" C000: fmf node should pass the schema validation """
Expand Down

0 comments on commit c5020ec

Please sign in to comment.