Fistron docs

fistron.io

Your team’s code review rules

Coding assistants write code that works but does not follow your team’s rules: a helper written again, a test that asserts nothing, a change too big to review. Fistron reviews every pull or merge request against the rules your team writes down, and gives the same rules to the coding assistant before it writes.

Each rule is checked the cheapest reliable way:

  1. By a tool: a linter, a complexity or duplication check, a pattern your team writes (ast-grep or semgrep).
  2. By Fistron’s own evidence: the changed lines’ tests, a test without an assertion, an unexplained part of the change, an invented dependency, a change over the size limit.
  3. By a model, only for what tools cannot check: design, naming, needless complexity, comments. A model’s finding must name the rule it breaks, or it is left out, and it never asks for changes unless your team says so.

See it

Fistron’s audit of a repository by the team’s rules: the places that break them, by rule and file.

The audit of a synthetic repository (the demo’s document). The same in the dark theme and on a phone. Taken from Fistron’s GUI at its release, never drawn.

You do Fistron does You get
Write your team’s rules, or start from a pack. Fistron audits the repository by them and reviews each change by them: tools, evidence and a model, each finding with its rule. The places that break your rules, a trend, credit to a change that removes them, and rules learned from your reviewers.

Recorded for real at Fistron’s release (the recording, for any asciinema player):

# The team's rule file: Google's practices and a rule of the team's own
shop $ cat .fistron/review-rules.toml
# The team's code review rules: Google's practices, and one rule of the team's own.
version = 1
extends = "google-eng-practices@1"

[[rules]]
id = "team.money.decimal"
title = "Money is a Decimal"
text = "Prices and totals are decimal.Decimal, never float."
source = "team"
level = "warning"
check = { method = "model" }

# The rules in force
shop $ fistron review rules check | head -20
.fistron/review-rules.toml: 17 rules, extending google-eng-practices@1
  design.fits  warning  model:model  never blocks  The change is well designed and belongs here
  functionality.intended  warning  model:model  never blocks  The code does what its author meant, for its users
  complexity.needless  warning  model:model  never blocks  No more complex than it needs to be
  complexity.functions  note  tool:complexity  may block  Functions stay small enough to follow
  tests.present  warning  evidence:diff_coverage  may block  The changed code is tested
  tests.assertions  warning  evidence:assert_free_tests  may block  A test asserts something
  tests.fail-when-broken  note  evidence:weak_tests  may block  The tests fail when the code is broken
  naming.clear  note  model:model  never blocks  Names say what things are or do
  comments.why  note  model:model  never blocks  Comments explain why
  style.guide  note  tool:linter  may block  The code follows the language's style guide
  consistency.existing-code  warning  tool:duplication  may block  Consistent with the code around it
  consistency.model  note  model:model  never blocks  No new way of doing what the project already does
  documentation.updated  note  model:model  never blocks  Its documentation changes with it
  context.explained  warning  evidence:intent  may block  Every part of the change is explained
  context.dependencies  error  evidence:dependencies  may block  Only approved dependencies that exist
  small-changes.size  note  evidence:change_size  may block  The change is small
  team.money.decimal  warning  model:model  never blocks  Money is a Decimal
Based on "What to look for in a code review" and "Small CLs" of the Google Engineering Practices Documentation (https://google.github.io/eng-practices/), by Google, licensed under CC BY 3.0 (https://creativecommons.org/licenses/by/3.0/). The rules' texts are summaries, changed from the original.

# The whole repository audited by them
shop $ fistron review rules audit --name acme/shop --output ../audit
1 place breaks 1 of 4 rules in 4 files
  tests.assertions  1  A test asserts something
  complexity.functions  0  Functions stay small enough to follow
  style.guide  0  The code follows the language's style guide
  consistency.existing-code  0  Consistent with the code around it
  note: 8 rules a model checks are not audited (design.fits, functionality.intended, complexity.needless, naming.clear, comments.why, consistency.model, documentation.updated, team.money.decimal)
  note: the evidence of a change has no meaning for a tree: tests.present, tests.fail-when-broken, context.explained, context.dependencies, small-changes.size
  note: no tool's report was given: the rules tools check count nothing
  written to ../audit/review-rules-audit.json

# Each place as a proposed issue
$ head -20 audit/review-rules-issues.md
# Proposed issues: the code review rules' audit of 4a7a7aaba2723f39ebee106f896ba0493aa12af6

## tests.assertions: A test asserts something (1)

**Labels:** tech debt

- [ ] `tests/test_pay.py:4`: This test asserts nothing: def test_total():

Before you start

Start from the default rules

Without a rule file, Fistron uses its default rules: 16 rules that follow Google’s Engineering Practices, “What to look for in a code review”.

  1. Check them in your working copy:

    fistron review rules check

    It lists each rule with its id, level, how it is checked and whether it may block.

  2. Set them in Fistron: open Repository settings, choose the organisation (all your repositories) or one repository, and change the rules in its code review form, or open the setting review-rules (Set your repositories’ settings). Fistron reads them there, never from the change, so a change cannot relax the rules it is reviewed by. Until you set them in Fistron, it still reads .fistron/review-rules.toml on your target branch (for example main); Import from the repository takes that file over.

    version = 1
    extends = "google-eng-practices@1"
    
    [[rules]]
    id = "tests.assertions"     # a test that asserts nothing
    level = "error"
    
    [[rules]]
    id = "complexity.needless"
    enabled = false             # your team does not want this one

    A rule with a default rule’s id changes only the keys you give.

  3. Fistron checks a setting before it keeps it and says what is wrong. A file of your own: fistron review rules check --file <file> says what is wrong, or prints the rules in force.

Add a rule of your own

For example, “unit tests use the asserts of our testutils package”, in a Go project:

  1. Write the pattern as an ast-grep rule in .fistron/ast-grep/rules/testutils-asserts.yml, with .fistron/ast-grep/sgconfig.yml beside it. Fistron’s repository has the whole example in examples/review-rules/go-testutils.

  2. Add the rule:

    [[rules]]
    id = "team.go.testutils-asserts"
    title = "Unit tests use the asserts of testutils"
    text = "Use an assert of testutils instead of comparing by hand and calling t.Errorf."
    languages = ["go"]
    paths = ["**/*_test.go"]
    level = "warning"
    ai_level = "error"          # stricter on a change written by AI
    check = { method = "tool", tool = "ast-grep", rule = ["testutils-asserts"] }
    examples = ["testutils.AssertEquals(t, \"the installed version\", want, got)"]

A rule only a person can judge, such as “a payment’s amount is never sent to telemetry”, is checked by the model: check = { method = "model" }.

The tools

Fistron runs ruff, ast-grep (with your team’s rules) and lizard itself: they only read the files. Give it the reports of your other tools from your CI as SARIF (golangci-lint, PMD, Checkstyle, SpotBugs, semgrep): the review reads them from the request’s CI where the project names their artifacts (Review pull and merge requests).

What you see

Your coding assistant

With Fistron in your coding assistant (Use Fistron from your coding assistant), ask “Which of the team’s review rules apply to shop/receipt.py?” before it writes: the tool review_rules gives the rules for those files, with examples. “Review my branch with Fistron” then checks the same rules on your branch.

Audit your code

When you take code over from a supplier, before an acquisition or an audit, after a wave of AI-written code, or as the baseline before your rules: see how many places of your code break each rule (Business and Enterprise).

  1. Open the project and click Audit your code (also the next step of the solution Control your code and MR/PR review by your team’s rules). The project’s last settings are filled in.
  2. What (step 1 of 3). Tick the repositories; choose The whole repository, Only these paths, Only what changed since a date or a commit or Only the AI-written code (offered where your change policy’s commit trailers or bot authors mark it; Fistron never guesses who wrote the code, and says why when it is not offered).
  3. How deep (step 2 of 3). Tools, Tools and Fistron’s evidence (the default) or Tools, evidence and a model (needs a model of the role reviewer for the project).
  4. By what, and what you get (step 3 of 3). Leave categories of rules out of this audit if you want; your rules stay as they are. Without rules of your own, Google’s Engineering Practices are used and then offered as your team’s, to confirm in Fistron.
  5. Click See the estimate: the files, the lines and how long; with a model, what it costs at most. With a model, enter The budget you confirm: it is never passed, the riskiest files go first and the record lists what was not judged.
  6. Click Audit now. You may leave the page; the result opens as the project’s document.

On the result:

Nothing of an audit is posted on a request.

On the command line

To see how many places of your code break each rule today, as a baseline:

fistron review rules audit --checkout . --run-tools --output audit

Without a control plane, upload audit/review-rules-audit.json to the project (admin-repositories.md): it reads as its document, with the places by rule. Next time, add --earlier <the last audit> to see the trend. review-rules-issues.md lists the places as issues for your tracker.

To audit only part of it, or less deep, choose:

# what it will read and how long, first
fistron review rules audit --checkout . --path src --since 2026-09-01 --estimate
# only src, only what changed since September, tools only, without comments' rules
fistron review rules audit --checkout . --path src --since 2026-09-01 \
  --depth tools --category-off comments --run-tools --output audit

--ai-written audits only the lines AI-written commits last changed, as your change policy’s commit trailers or bot authors mark them (.fistron/change-policy.toml, see use-review.md). --depth model adds the rules only a model judges, through your reviewer model, within --budget: run it with --estimate first. fistron review rules attest signs its attestation and fistron review rules verify checks it offline.

Learn rules from your reviews

When your reviewers keep writing the same comment, it is a rule nobody wrote down. Run review-rules-learn on the project’s agent (or fistron review rules learn --name <repository>): Fistron reads your reviewers’ comments on the recent requests and proposes the rules they keep asking for, and a lower level for a rule whose findings you keep leaving out. Open the record under the project’s Documents: the same proposals wait under Proposed changes of Repository settings (in the local UI also on Proposals), where a manager confirms or rejects them. Fistron never changes your rules by itself.

Troubleshooting

What you see What to do
fistron review rules check says “a new rule needs its title, text, check” The id is not a default rule’s: give the three, or fix the id.
“N observations of the AI review named no rule” The model raised issues outside your rules; they are left out by design.
“the team’s N rules a model checks that apply to the change were not checked” No model checked them: set a model for the role reviewer, with its prices, and review the request again.
The verdict is Not fully reviewed A rule a model checks was not checked on a changed file: the review says which, and why (no model, the cap of 0.50 per review, a file too long).
A rule checked by a tool finds nothing Give its tool’s SARIF to the review, or check that the tool is one Fistron runs.

The default rules are based on the Google Engineering Practices Documentation (https://google.github.io/eng-practices/), by Google, licensed under CC BY 3.0; their texts are summaries, changed from the original.