Feature/update baseline file on save#3880
Conversation
This comment has been minimized.
This comment has been minimized.
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
|
@yangdanny97 has imported this pull request. If you are a Meta employee, you can view this in D109265008. |
|
There's some duplicate functionality with #3801, I'll try to sort out any conflicts and give this a more detailed review during the week |
If we show this in the CLI then that kind of defeats the purpose of the baseline file being suppressions IMO, since you'd get potentially thousands of hints in the console. |
|
no action needed from you, i'll patch and merge this with some changes |
Summary
Add automatic baseline updating on save for Pyrefly projects with a configured baseline file. When all current diagnostics are already accounted for in the baseline, Pyrefly now rewrites the baseline to remove entries that were fixed, instead of leaving stale diagnostics behind. This keeps the baseline file aligned with the current state of the project and avoids carrying resolved errors forward.
Also make baseline-matched diagnostics show up as
hintin the console, regardless of the configured minimum severity, so existing known issues stay visible but less noisy. If--update-baselineis used with a lower minimum severity, warnings and info-level diagnostics are also treated as baseline-visible hints.Add unit coverage for baseline key matching and deduplication to ensure baseline entries are counted correctly across files, error kinds, and duplicate diagnostics.
Fixes #3609
Test Plan
pyrefly check . --baseline /path/to/baseline.json --update-baselineon a sample project and verified the baseline file was written.pyrefly check . --baseline /path/to/baseline.jsonand verified baseline-matched diagnostics were no longer reported as new errors.hintrather than loud errors in the console.BaselineProcessor::matched_key_countinpyrefly/lib/error/baseline.rs.