Check new code only
robbat2 opened this issue · 0 comments
robbat2 commented
This is going to take a bit of doing, but was wondering about the conceptual parts of it first.
When adding pre-commit to an existing codebase, there can be a lot of errors, and you still want to prevent introduction of new errors, plus whittle down the existing errors over time.
To that end, a mode that excludes errors due to pre-existing code, and only flags errors in new commits.
I can see a few ways that this could be mostly accomplished, but not reliably:
- parse/filter checker output for lines that were added (EASY)
- run checkers twice on old & new code, adjusting line numbers from old to new, and exclude errors that occured in both (MEDIUM)
- teaching checkers to only care about a range of lines (HARD)