google / google/error-prone

Suppressing warnings in generated code while promoting some warnings to errors

Open
#647 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

We would like to selectively promote some (but not all) warnings to errors because we would like developers to explicitly suppress them (with a justifying comment) in order for their merge requests to pass CI. This can easily be done with existing command-line flags.

The problem we are running into is with generated code. While we can suppress warnings in generated code with `-XepDisableWarningsInGeneratedCode`, we cannot suppress errors. When what was formerly a warning is promoted to an error, it may start to be found in generated code, breaking the build.

While I understand the argument in #329 that anything serious enough to be an error should not be suppressed in generated code, it seems like there needs to be some distinction between patterns which are "natively errors" and those which the user promotes to errors. That is, there needs to be some way to hold code we control to a "higher standard" than code we do not.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.