-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Issue #14137: Introduce Error Prone Support #14136
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
Conversation
c75f336 to
3186038
Compare
|
Example of error level rule https://error-prone.picnic.tech/bugpatterns/FluxFlatMapUsage/ Please share where Please use in commit message prefix As already noticed we use hacky groovy script to put on leash reporting of errorprone. As you very knowledgeable in this tool, do you know better way to get report from tool? We just need print to contributor not all messages but messages that requires to fix. Is there ability to exclude pattern/rule from execution at all? Or change severity to IGNORE/OFF. Our suppression model: https://github.com/checkstyle/checkstyle/blob/master/config/error-prone-suppressions/compile-phase-suppressions.xml |
romani
left a comment
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.
Ok to merge.
Next PRs will be more interesting.
|
@Vyom-Yadav , please read this as you were involved in error prone activation in our project |
|
https://github.com/checkstyle/checkstyle/actions/runs/7187166866/job/19574155042?pr=14136 |
|
Thanks for all the questions, let me know if something is unclear or I'm missing something.
After the W.r.t. how we can best configure the checks, I'd like to propose to use a similar approach to what we have here, which allows us to specifically disable and increase the severity of checks.
Currently there is nothing yet that gives us the reports easily. There is a GitHub issue related to this: google/error-prone#3766, that's all...
We can use the command-line flags to enable and disable checks, see the docs here.
I tried searching fo a discussion related to this in the old Error Prone activation PR but I couldn't find any. We can iteratively enable all of the rules, I don't see blockers (yet?). If you know what was blocking you from doing this, let me know, I'm curious!
Thanks for sharing. Is there a specific reason for not using Oh: I think I found the reason in the old Error Prone PR: #12063 (comment), am I correct?
Good point, I noticed a few of our checks are creating quite some output. What we can do is already disable some of the rules like |
3186038 to
acca2e2
Compare
|
Rebased. FYI: The build is failing because the linked issue is not approved. |
acca2e2 to
45b7790
Compare
Yes. We can define properties in pom xml, we already have bunch.
Works for us too.
Yes, this is good for us, as we have rule that if we enforce some rule we do it as build failure, no leaks are allowed.
No blockers, but we would need your help to make it, we are sinking in PRs, maintainers are overloaded.
We keep culture of "no pollution in main code for tools". So we keep main code clean and all hacks and unfortunate cases outside, let let readers do not be bothered by extra details. If we put all to code it will have a lot of annotations :). But sometimes we need to suppression on specific line, not whole method.
Yes, please. I updated issue with opinion on what should apply and what we should disable. |
|
@Vyom-Yadav , fyi |
Nice sounds good, will do that as part of the follow up PRs :).
Sounds good, I'll try to keep it doable and not overload with PRs. After this one is merged I'll open the first one(s).
Interesting, cool approach! Thanks for explaining.
Yes perfect. Will start creating them after we merge this PR. Oh and if it goes too fast or too slow after we merge this one, just let me know and we will work it out :). |
45b7790 to
e244cf3
Compare
|
Rebased and resolved conflict. |
nrmancuso
left a comment
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.
@rickie thanks a lot for taking this up!
|
Sorry, Late to the party, but this is really cool, thanks a lot, @rickie for taking charge here.
Just curious, do you, in your org, consider the warnings as well? Are there any good checks that give out warnings but are good to have as errors? That way we can further improve the quality. |
|
We usually apply/enforce all rules, if we do not see some rule doing any good, of it is against our style or .., we just disable it at all. |
No problem, I really like doing this @Vyom-Yadav.
Yes we do! I think we have quite the same approach & goals as Checkstyle. Namely, try to enable as much static analysis as possible. For our Error Prone usage, it means that we use the following command-line flags: If you want to see an example, here is our configuration from Error Prone Support: https://github.com/PicnicSupermarket/error-prone-support/blob/master/pom.xml#L1701-L1757. This is roughly similar to what we have in our internal setup at Picnic. I'd say after we went through the checks of Error Prone Support as defined in #14137, we can take a look at the checks from Error Prone that are listed under "WARNING" and "INFO" https://errorprone.info/bugpatterns. WDYT? |
|
Yes, please, let's try to activate all. It helps a lot to maintenance of project by small team. |
|
Good suggestion. As we have default |
This PR is based on a suggestion by @romani in: #14129. The idea is to add Error Prone Support to Checkstyle in this PR and after that discuss which checks we want to enable.
I added Error Prone Support as part of the already existing Maven profile that runs Error Prone. The reason for this is that Error Prone Support is an extension and "just adds some checks". Configuration wise, this is the simplest. The only difference the user could notice is that the documentation URL from the Error Prone Support checks are slightly different. See an example below.
Error from an Error Prone check from Google:
Error from an Error Prone check from Error Prone Support:
Checkstyle is configured to only consider checks that have
SeverityLevel.ERROR, see here. In Error Prone Support there are 3 checks with error severity. So adding the tool itself requires changes only in thepom.xml.Now we can simply increase the severity of Error Prone Support checks as follows:
In the follow up issue (#14137) we can discuss which checks we want to enable. I'm definitely open to creating PRs for that!