google / google/error-prone

fail if there any problems are detected, but report all problems found

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

Description

I would like Error Prone to fail if it encounters _any_ problems, but report _all_ problems found. However it seems only the following are possible

**(A)** When problems are reported as warnings
1. Problems do not cause the build to fail
2. Problems in all files are reported by the build

**(B)** When problems are reported as errors
1. Any file found with problems causes the build to fail
2. Only the problems in this file are reported. A consequence of failing the build when the first problematic file
is encountered is that it's impossible to report problems in any other file.

The behaviour I want is A2 and B1, but this does not seem to be supported. When the flag `-Werror` is present, Error Prone behaves in mode (B), otherwise it behaves as per (A).

I want all errors/warnings to fail the build in order to force people to fix them. However, if there are a large number of problems in the project (e.g. because Error Prone has just been introduced), it's tedious to discover them on a file-by-file basis.

I'm using Error Prone v2.30.0 with Gradle.

### Relevant Issues
- https://github.com/google/error-prone/issues/436
- https://github.com/google/error-prone/issues/424

### Example Application
I've create a sample application that reproduces the problem. Instructions are provided in [this comment](https://github.com/google/error-prone/issues/4546#issuecomment-2302317426)

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.