Triage
A scan reported findings. Work them one at a time.
Read the finding. Tier exact means the normalized trees hash identically;
tier similar means the printed similarity cleared scan.threshold. A cluster
is a set of whole functions that match each other; a containment finding is
directed - a run inside one function is already implemented by another. The
path:start-end span is 1-indexed and inclusive of both ends.
Apply the remedy ladder. Take the first rule that applies; do not skip ahead.
- Containment finding: delete the reported run from the container and call the named function instead. There is nothing to design.
exactcluster: extract one helper and make every member call it.similarcluster whosebiston scan --suggest .template has onlyidentifierorliteralholes: extract it, passing those holes as parameters.similarwithsubtreeholes, or with no template at all: stop. Report the file, the span and the similarity to a human. This is a judgement call, not agent work.- Duplication that is intentional - performance, isolation, generated code,
test clarity - and only then: suppress it with
# biston: ignore -- <reason>on its own line above thedef, or# biston: ignore-file -- <reason>in the file’s first 5 lines. The reason is required.
Around every edit. Run the test suite before you touch anything. Refactor.
Run the test suite again. Then re-scan the files you changed with
biston scan --focus-args <changed files>: the finding must be gone and no new
finding may appear. If either fails, revert the edit.
Do not:
- Do not raise
scan.threshold,scan.exact_min_lines,scan.similar_min_linesorscan.exact_min_stmtsto make a finding disappear. Those are repo-wide policy, decided by humans, and changing one hides every other finding it covers. Seebiston guide tune. - Do not add
# biston: ignorewithout a reason. - Do not suppress a finding to pass a gate.
next: run biston scan --focus-args <changed files>