The name of a constant does not match the configured pattern
What it finds
Constants named in upper case stand out from variables. The names of constants, the static final fields of a primitive type or String and the fields of interfaces, are checked against the parameter pattern, by default [A-Z][A-Z0-9]*(_[A-Z0-9]+)*.
serialVersionUID and serialPersistentFields are named by the serialization API and left alone.
From the rule's source, constant_naming.rs.
import java.util.List; class Limits { static final int MAX_SIZE = 10; static final String defaultName = "x";tx0 reports: the constant name defaultName does not match private static final long serialVersionUID = 1L; static final List<String> names = List.of(); final int size = 3;} interface Codes { int okCode = 200;tx0 reports: the constant name okCode does not match int NOT_FOUND = 404;} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/java:constant-naming" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/java:constant-naming] reason="..."tx0 explain tx0/java:constant-naming shows the same in the terminal. Found a false positive? Report it.