An integer literal starts with 0, which makes it octal
What it finds
int code = 010; is eight, not ten: a leading zero makes an integer literal octal. Lining numbers up with zeros, or copying a code such as a ZIP or a permission, changes the value without any warning.
Reported are integer literals of two or more digits that start with 0. Where octal is meant, as for file permissions such as 0644, a suppression with a reason says so.
From the rule's source, octal_literal.rs.
class Codes { int a = 010;tx0 reports: 010 is octal, so its value is 8 int b = 10; int c = 0; int d = 0x10; double e = 0.5; long f = 0L;} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/java:octal-literal" = "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:octal-literal] reason="..."tx0 explain tx0/java:octal-literal shows the same in the terminal. Found a false positive? Report it.