-
-
Notifications
You must be signed in to change notification settings - Fork 495
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: custom explanations with --suppress
#4343
Conversation
--unsafe Allow to do unsafe fixes, should be used with `--write` or `--fix` | ||
--fix Alias for `--write`, writes safe fixes | ||
--apply Alias for `--write`, writes safe fixes (deprecated, use `--write`) | ||
--apply-unsafe Alias for `--write --unsafe`, writes safe and unsafe fixes | ||
(deprecated, use `--write --unsafe`) | ||
--suppress Bulk fix diagnostics with suppression comments if the language |
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 felt like it helped to add "Bulk" here to portray that you'd want to use this for migration purposes. Can take it off if desired.
--suppress
--suppress
I've verified that this works by writing a few more tests and running it against a few repositories I have. I'm admittedly not 100% certain the way that I've written it is the best way to go about it. Ema let me know to go through |
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.
Overall it looks good. We should avoid .clone
, and rely on references where is possible.
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
I was using Now that I'm doing the lifetime-ing, the error you see on the build is something I honestly have no idea how to contend with. It might take me awhile to sort this out. Also noteworthy that there's a bunch of changes due to putting lifetimes in a bunch of places, so possibly worth another more general look over things. |
Ok, then let's keep Push the change and then I'll have a look if you still have lifetime issues |
4b09b75
to
0656cde
Compare
@anthonyshew I optimised some code here |
Thanks! I had just caught onto that while I was looking for a few more places to put string slices. You beat me to it. 🤝 It seems like we're in a good spot now on After it makes it through the options, it's a |
Summary
#4008 introduces a
--suppress
flag, but it would add ignore comments using the default explanation (<explanation>
). Since--suppress
bulk ignores existing diagnostics, you'd have to go back through your changes to give a more worthwhile explanation (or accept<explanation>
being in your codebase). Instead, this PR sets a more informative default message of "Ignored using--suppress
".Additionally, you can now add a custom explanation with
--reason
. This flag can only be used when you use--suppress
.Test Plan
Updated tests to use this default message. I've also manually tested the binary against a few of my repositories.