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 all 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.
In
elm-review
, if counts go down, then this file is automatically updated when running the process. The reason I chose to do so is because I don't want to annoy the users when they do the right thing.Say I fix an issue, I run
eslint
(which on a large project could take a significant amount of time), then I get to hear that I did a good thing by solving problems, but that I need to do the process again. I believe this can be frustrating and I wanted to avoid that.So we update the file automatically. The downside is that the file might not get checked in properly. To help with that, we recommend that people in CI (or in their test suite) run
elm-review suppress --check-after-tests
(after runningelm-review
) which is quick because it only invokesgit status --short -- review/suppressed/
and reports an error if suppression files should have been committed. (Surprisingly, so far no-one has asked for supporting other VCSs).Also, we try to display a friendly message when you fixed an issue: "There are still 316 suppressed errors to address, and you just fixed 1!" (I could have added emojis but I also didn't want to go over the top).
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.
SuppressedLintMessage
should have an additional propertysuppressions
. We should specify what value it will have in this case. I think it can be: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.
@mdjermanovic can you please clarify what would be the purpose of this new property?
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 describes the reason why the lint message is suppressed. It's a mandatory property in
SuppressedLintMessage
type (objects inLintResult#suppressedMessages
). Without it, integrations and formatters that useLintResult#suppressedMessages
could break.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 @mdjermanovic . I was under the impression that you were referring to a new property for some reason. That is clear now.
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.
By verbose mode we probably mean when the
--debug
flag is passed on the command line.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.
Question: do we really want to exit without printing the lint results here?
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.