def hit
bolt@1.27.0.0 · src/rules/suspicious/concat.bend:169
import bolt@1.27.0.0/src/rules/suspicious/concat.bend as Concat
import Base
import bolt@1.27.0.0/src/finding.bend as F
import bolt@1.27.0.0/src/syntax/lex.bend as Lex
169
170def hit(
171 mm: Maybe<&2, Lex.Tok>,
172 +slot: String,
173 +path: String,
174 +acc: List<&2, F.Finding>
175) -> List<&2, F.Finding>:
176 match mm:
177 case None{}:
178 acc
179 case Some{Lex.Tok{k, +t, l, c}}:
180 Bool.pick(List<&2, F.Finding>, String.eq(t, slot),
181 F.Finding{path, l, c, U32.from_nat(String.length(t)), "concat",
182 t ++ " is appended to on every step, which copies it each time and makes the loop quadratic; prepend and reverse once at the end, or build with <>."} <> acc,
183 acc)