google / error-prone

Catch common Java mistakes as compile-time errors
https://errorprone.info
Apache License 2.0
6.82k stars 741 forks source link

Enable/disable patterns by category #488

Open Stephan202 opened 7 years ago

Stephan202 commented 7 years ago

With Error Prone 2.0.15 and -XepAllDisabledChecksAsWarnings, the Android-specific StaticOrDefaultInterfaceMethod bug pattern is enabled. For a non-Android code base one can of course easily disable the pattern again with -Xep:StaticOrDefaultInterfaceMethod:OFF. But it did make me wonder: is there a flag to enable or disable all bug patterns in a given category?

I checked the documentation and the source code, but it seems there currently isn't. I think this would be a good feature to have. As the aforementioned bug pattern shows, Android-specific recommendations may be at odds with Java 8 SE best practises.

JakeWharton commented 7 years ago

That check is useful on Android for minSdk 25, so you can't just blindly enable/disable based on platform.

On Sat, Dec 3, 2016, 6:09 AM Stephan Schroevers notifications@github.com wrote:

With Error Prone 2.0.15 and -XepAllDisabledChecksAsWarnings, the Android-specific StaticOrDefaultInterfaceMethod bug pattern is enabled. For a non-Android code base one can of course easily disable the pattern again with -Xep:StaticOrDefaultInterfaceMethod:OFF. But it did make me wonder: is there a flag to enable or disable all bug patterns in a given category?

I checked the documentation http://errorprone.info/docs/flags and the source code, but it seems there currently isn't. I think this would be a good feature to have. As the aforementioned bug pattern shows, Android-specific recommendations may be at odds with Java 8 SE best practises.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/error-prone/issues/488, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEfyFlsxkRcjAFKLhyLJoI8fmuBbhks5rEU3egaJpZM4LDRAm .

Stephan202 commented 7 years ago

Ah, I'm not suggesting to make this an automated procedure. Android was an example, but {dis,en}abling all Dagger or Guice checks could be just as relevant.

Stephan202 commented 5 years ago

Just noticed that #1227 will remove category support (see b5adf02cae0edd283921227d42ade3427124d5d9). I guess this issue should now be rephrased as Enable/disable patterns by tag :).