Array brackets follow the name of a variable or the parameters of a method instead of the type
What it finds
int counts[] and String names()[] are allowed for the comfort of C programmers, but put part of the type after the name, where a reader of the type does not look. int[] counts keeps the whole type together.
Reported is a variable, field or parameter with brackets after its name, and a method with brackets after its parameters.
From the rule's source, c_style_array.rs.
class Arrays2 { int counts[];tx0 reports: belong to the type int[] fine; void run(String args[]) {tx0 reports: belong to the type int local[] = new int[3];tx0 reports: belong to the type }} 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:c-style-array" = "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:c-style-array] reason="..."tx0 explain tx0/java:c-style-array shows the same in the terminal. Found a false positive? Report it.