Feature/update baseline file on save#3880
Open
NarxPal wants to merge 5 commits into
Open
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. ✅ |
Contributor
|
@yangdanny97 has imported this pull request. If you are a Meta employee, you can view this in D109265008. |
Contributor
|
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.