Catches the mistakes coding agents repeat before they merge: a pull-request gate with no model call and no API key.
A rule is a fixed pattern on the lines a change adds. It runs with no model, no dependency and no setup, so the same line gives the same finding on every machine. This page shows where a rule lives and what a pull request for one needs. CONTRIBUTING.md has the acceptance rubric and the test template; open a “New rule” issue before you write code.
One added line at a time, with the file’s path. It does not see the lines around it, the rest of the file or other files. This is on purpose: a line-level rule is fast, explains itself in one sentence, and never flags a line that was already there. A mistake that needs the whole file or a type checker to see belongs in a linter or a type checker.
All of them live under brevio/pipeline/code_rules/.
| Part | Where | What you write |
|---|---|---|
| The ID and its one line | PR_RULES_122 in __init__.py |
"R9.2": "No silenced type errors: no @ts-ignore; every @ts-expect-error states its reason". The text before the colon is the title. |
| The check | _check_line_patterns in __init__.py |
a compiled regular expression, tested only on files of the right kind (by extension), that appends path:line: [RX.Y] message |
| Why, and two examples | DETAILS in details.py |
why the mistake matters, in one or two short sentences; a bad example the check flags; a good one it does not; the language of the examples; any exemption the check makes, in plain words |
| Which scanner runs it | SCANS in details.py |
"RX.Y": ("code", "src/example.ts"): the scanner of brevio-core scan and a path the examples are checked at |
| Its status | RULE_STATUS in __init__.py |
"RX.Y": "preview" for a new rule: it reports but never fails a scan, for one minor release |
| A fix, if there is exactly one | FIXERS in fixers.py |
only when one rewrite is always right, such as @ts-ignore to @ts-expect-error; most rules have none |
deprecated (RULES-STABILITY.md).SCANS entry and the preview status.Regenerate the rule pages:
python -m brevio.pipeline.code_rules.docs --out docs/rules
The page title, the short answer, the related rules and the search data all come from what you wrote; never edit a page by hand.
Run the tests:
python -m unittest discover -s tests/pipeline/core_export -t .
The rule-page test checks that the bad example is flagged and the good one is not, and that every page matches the definitions.
@ts-ignore\b is a rule; “a line with ignore in it” is noise.exempt text, so the page tells a reader
what is not flagged.brevio-core.toml.