List read one item per loop step
for _ in 0..k: xs.push(read()): let xs: [0..k]T = read() reads them all
let (n, m): (1..=200000, 1..=200000) = read()
var edges: List<(Int, Int)> = []
for _ in 0..m:
let (u, v): (1..=n, 1..=n) = read()
edges.push((u, v))
print(edges.len)let (n, m): (1..=200000, 1..=200000) = read()
let edges: [0..m](1..=n, 1..=n) = read()
print(edges.len)Why
A loop that reads one item and pushes it, m times, is the input format written out by hand. let edges: [0..m](1..=n, 1..=n) = read() reads all m items at once: the type says how many there are and what bounds each one has, so the bounds are checked as the input is read and the list's length is known. Declare it var if the list changes later. A loop that pushes something other than what it read, such as (u - 1, v - 1), is not reported, because the read value and the stored value differ. There is no automatic fix, because the item type has to be read from the problem statement.
The practice it serves
A hand-written pattern the language or the standard library already says in one step.
Not flagged
A near miss: close to the pattern, but not it.
let (n, m): (1..=200000, 1..=200000) = read()
var edges: List<(Int, Int)> = []
for _ in 0..m:
let (u, v): (1..=n, 1..=n) = read()
edges.push((u - 1, v - 1))
print(edges.len)Turn it off
For one block, wrap it in with lint(read_loop: allow):. For a project, add read_loop = "allow" under [lints] in cp.toml.
Generated from spec/lints/read_loop, the same record the linter is built from.