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

RFE: [tmt lint] add a warning class to handle "warn: Empty environment file" #2872

Open
bgoncalv opened this issue Apr 18, 2024 · 2 comments

Comments

@bgoncalv
Copy link

In our repo we have a lot of tests that when running tmt lint shows warn: Empty environment file

It would be nice if we could force tmt lint to report failure in this cases, afaik it is not handled as a warning class.

My suggestion would be running a command like below would force the lint to report failure.

tmt lint --outcome-only fail --enforce-check Cxxx .
@psss
Copy link
Collaborator

psss commented Apr 18, 2024

For this specific case, when environment-file is pointing to an empty file, I would say we should even give a failure by default. Could be a good first issue, here's an example plan check:

tmt/tmt/base.py

Lines 2027 to 2039 in 22731b9

def lint_unknown_keys(self) -> LinterReturn:
""" P001: all keys are known """
invalid_keys = self._lint_keys(
list(self.step_names(enabled_only=False)) + self._extra_l2_keys)
if invalid_keys:
for key in invalid_keys:
yield LinterOutcome.FAIL, f'unknown key "{key}" is used'
return
yield LinterOutcome.PASS, 'correct keys are used'

@happz
Copy link
Collaborator

happz commented Apr 18, 2024

FTR, can be done for environment-file keys in a plan only, it wouldn't catch the runtime (run --environment @empty.yaml). But should be a nice and easy check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants