An array is turned into a string, which shows its type and address, not its elements
What it finds
"ids: $ids" or ids.toString() for an array gives something like [I@1b6d3586. contentToString() or joinToString() give the elements. Reported for variables known to be arrays from their declared type or their initializer.
From the rule's source, array_to_string.rs.
fun show(ids: IntArray, names: List<String>) { val local = arrayOf("a", "b") println("ids: $ids")tx0 reports: ids is an array println(local.toString())tx0 reports: local is an array println("names: $names") println(ids.contentToString())} 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/kotlin:array-to-string" = "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/kotlin:array-to-string] reason="..."tx0 explain tx0/kotlin:array-to-string shows the same in the terminal. Found a false positive? Report it.