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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Introduce a way to suppress violations #119
feat: Introduce a way to suppress violations #119
Changes from 27 commits
a99c456
f9b3976
c9a718c
4d73750
9e035f1
ed01be1
d5411af
98779dc
b343ddb
ad5343d
485f684
70a7c56
4462ce6
1a1cbba
71ee661
2d4dc84
dc2d940
b8a1cf7
0c3d9a4
4fea00e
42d8b95
bff622d
48e9d0a
46cf6ae
a94a50d
861f1a4
566e3b9
78d37ab
b33e324
c005f3b
f134daa
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, will there be an error message, and what would it look like? Technically, will it be a lint message passed to the formatter along with other lint messages for the file, or a separate output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that
--prune-suppressions
will have no effect when--suppress-all
or--suppress-rule
is passed. Should it be also disallowed when one of the other options is passed?rfcs/designs/2024-baseline-support/README.md
Lines 224 to 230 in f134daa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this method needs to accept an argument with the updated count of suppressed errors per rule and per file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. Maybe I'm misunderstanding something, so bear with me. It would be helpful if you could add a draft implementation to show how this function will work.
To clarify, this is an example I would like to understand. Suppose you have a file test.js where the
no-undef
rule would normally report three errors:Playground link
What will the function return when the suppression file specifies a
count
of 2? This is what the arguments will look like:You can see that the input
results
contains details about each error, while the suppressions are just numbers. What will the call toapplySuppressions(results, suppressions)
return in this case?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case it will return an updated copy of results and an empty object for unmatched (because all suppressions are matched).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, this means removing the first
count
messages with a particularrule-id
from each result, wherecount
is the suppression count. So, in the above examplea
andb
would be suppressed but notc
, because in the input result,a
andb
are sorted first in order of location.I think this behavior would be very surprising to users. This means that some rule violations would be reported only for (the bottom) part of a file.
I think it would be better to report all messages unfiltered if the suppression count is less than the number of messages, because in that situation we can't make a meaningful selection. So for each file and
rule-id
we should always report either all messages, or none of them.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the alternative we've introduced at Canva is that we designate specific rules as "in migration" and we only consider reports from those rules if they exist in changed files (according to
git
comparison against the main branch).With this system developers must address lint errors if they touch a file but otherwise they can be ignored.
This does require integration with the relevant source control system - though we've found it works quite well.