Add plugin data instance creation during linting
Pull Request Checklist
- [ ] implement the feature
- [ ] write the documentation
- [ ] extend the test coverage
- [ ] update the specification
- [ ] adjust plugin docstring
- [ ] modify the json schema
- [ ] mention the version
- [ ] include a release note
Please indicate when a PR is based on another one.
sure, and done:)
So @skycastlelily what do you think about making this its own lint rule like
class Plan:
def lint_unique_names(self) -> LinterReturn:
"""
P0XX: phases must have valid data
"""
passed = True
for step in self.steps:
for phase in step.phases:
try:
# Need to call the property once because it is lazy evaluated otherwise
_ = phase.data
except Exception:
passed = False
yield LinterOutcome.FAIL, "..."
if passed:
yield LinterOutcome.PASS, 'phases have unique names'
So @skycastlelily what do you think about making this its own lint rule like
class Plan: def lint_unique_names(self) -> LinterReturn: """ P0XX: phases must have valid data """ passed = True for step in self.steps: for phase in step.phases: try: # Need to call the property once because it is lazy evaluated otherwise _ = phase.data except Exception: passed = False yield LinterOutcome.FAIL, "..." if passed: yield LinterOutcome.PASS, 'phases have unique names'
I think it's pretty, actually that is the solution I was thinking to take before I sent this mr, however it does not work, because normalize* functions will not be called by tmt lint.I read your previous comments thoroughly, and spend many time to find a solution in that way, but failed :sweat_smile: ,feel free to take this mr or open a new mr to implement your thoughts, you have my bless :)
I think it's pretty, actually that is the solution I was thinking to take before I sent this mr, however it does not work, because normalize* functions will not be called by tmt lint.
That is odd, the snippet does the same .data as your PR here, so it should go through the same logic. I guess I can look more carefully in what is going on there
Closing, as #4409 addressed it in a more pretty and clean way:)