canonical / canonical/craft-application
Linter service clears lint results too greedily
- Dominant language
- Python
- Stars
- 14
- Forks
- 29
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 12
Description
### Bug Description
When implementing a full lint lifecycle, both pre and post linters are run on an artifact. This requires `LinterService.run()` to be called twice, since each stage must be invoked individually (`LinterService.run(Stage.PRE, ctx); LinterService.run(Stage.POST, ctx)`).
This means:
- Lint results are broken up in a manner that appears arbitrary to users; pre/post really are implementation details.
- `LinterService.summary()` forgets the results of the first run, which could result in false positives for `0` return codes.
### To Reproduce
Implement two custom linters, one pre- and one post-, and then try to run both of them as you might during a pack command's final steps.
### part yaml
```shell
N/A
```
### Relevant log output
```shell
N/A
```
Contributor guide
Research direction
Start with LinterService.run() and summary(), then trace how Stage.PRE and Stage.POST are invoked during the pack command. Reproduce the issue with one custom linter for each stage; done means results from both runs remain available to summary() and do not produce false positives for zero return codes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100