A range of literals is empty because its start is past its end
What it finds
for (i in 10..0) runs zero times: .. counts up, and an empty range is not an error. Counting down needs downTo. Likewise 0 downTo 10 and 10 until 0 are empty. Reported for ranges whose ends are integer literals.
From the rule's source, empty_range.rs.
fun count() { for (i in 10..0) println(i)tx0 reports: 10 .. 0 is empty for (i in 0 downTo 10) println(i)tx0 reports: 0 downTo 10 is empty for (i in 10 downTo 0) println(i) for (i in 0..10) println(i) for (i in 5 until 1) println(i)tx0 reports: 5 until 1 is empty} Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/kotlin:empty-range" = "off"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/kotlin:empty-range] reason="..."tx0 explain tx0/kotlin:empty-range shows the same in the terminal. Found a false positive? Report it.