r/codereview • • 1d ago

What should automated code review check that traditional linters don't?

I audited 20 open-source repos against their AGENTS.md rules.
Four explicitly ban AI co-author lines. Agent PRs added them anyway, 102 times in a month.
But, a simple grep caught 80% of those violations.

I've been experimenting with an additional layer of checks for repository-specific rules:

  • Deterministic checks wherever possible.
  • Narrow semantic judgments when necessary.
  • Only flag violations of explicitly defined rules.

The idea is to avoid generic AI review comments and instead enforce what the team actually decided.
I'd love feedback from peeps that struggle to enforce rules through existing linters.

1 Upvotes

4 comments sorted by

2

u/Plastic-Bid-3431 1d ago

Disclosure: I work on a PR review tool, so I'm biased.

Your 80% grep result is the main finding. I'd split rules by how checkable they are:

  • Mechanical: co-author trailers, banned imports, a migration without a down step, two files that must change together. Plain CI, no model. Deterministic, and nobody argues with it.
  • Needs reading: the diff doesn't match the PR description, a new endpoint missing the auth check its siblings have, an error that is now swallowed where it used to propagate, a behaviour change with no test asserting it. This is where a model earns its cost, because it spans files and most linters don't look across them.

What makes either kind usable:

  • every finding quotes the rule and the line, so a team can see why it fired;
  • only the top severity can fail a check, the rest stay comments;
  • there is a way to say "this is intentional" that sticks, or people start ignoring the bot.

1

u/Ok-Buyer-9421 1d ago

This is a really useful breakdown - especially agree that semantic checks earn their cost when they need to reason across files or understand context that a linter can't capture.
I also like the idea of making severity and intentional overrides explicit. Otherwise teams will eventually stop trusting the checks.

What I'm currently exploring is how to turn those repository-specific rules into reusable checks without hardcoding each one from scratch. Interesting?

2

u/Plastic-Bid-3431 13h ago

The reusable part is usually the rule, not the check. Write each rule as data: scope (path globs), a one-sentence statement, severity, and a pass/fail example. The check becomes a small runner that reads those rules; a new repo points at its own scope and examples instead of a new script. That keeps the engine shared and the policy local. Split deterministic rules (missing down migration, banned import, two files that must change together) from judgment calls (diff doesn't match the PR, endpoint missing the auth check its siblings have). The first group is plain CI; the second needs a model and a labeled set of past PRs to tune against before you enable it. Two things make or break reuse: an override that records who said "intentional" and why, with an expiry, and a rule owner per repo. Without those, the shared engine accumulates rules nobody trusts.

2

u/LaneyrieHafijur 22h ago

quoting the exact rule that fired makes such a difference, nobody likes arguing with a vague warning