Skip to main content

Module finding

Module finding 

Source
Expand description

One problem, in one place, in one file.

Outcome answers what a CHECK concluded, in five variants and no payload. That is the right shape for git — a hook has to resolve to proceed-or-block — but it is the reason a report could only ever name the file:

✗ Unwanted terms found
  The following files contains 'debugger' in them:
  - app.js

The line was known. ban_terms’s comment-blanking preserves length and line count precisely so offsets stay valid, and secrets::scan has always returned line numbers — but with nowhere to put them, the position was computed and dropped at the boundary. This type is that place.

Positions are a REPORTING concern and never a decision input. A check decides pass or fail exactly as it did before; a finding says where. Where a position cannot be pinned down — a whole-file judgement like large-files, or a match the locator cannot resolve to one offset — Finding::line is None and the report degrades to naming the file, which is what it did for everything until now.

Structs§

Finding
A single problem, addressable.

Functions§

line_col
A byte offset into 1-based (line, column).
to_json
Findings as JSON, for anything that would rather not parse a line.