r/ChatGPTCoding • • 2h ago

Resources And Tips Custom linters are powerful

Ask your agent to review your bug database and/or commit history and construct custom linters that statically detect common classes of bugs you've fixed in the past. Include some way of suppressing false positives then drive number of lint errors down to zero, adding regression tests along the way to prove the issues are real. Then refine your linters to be more precise and drive suppressions down as well, leaving only the most complex semantic suppressions. Run this in CI on both new changes and upstream rebases. Rely on robust linters built on sophisticated AST analysis rather than just fragile regexes, and as they start to share common underlying analyses, build them into a centralized pipeline that reuses intermediate analyses and intermediate representations to save runtime and LOC, much like a compiler. This is the path toward incremental formal mathematical verification of your codebase. (You can also condense down agent instructions that become statically enforced!)

I just did this on my codebase for the first time this holiday weekend and found literally hundreds of real issues in a legacy codebase. It's shocking.

3 Upvotes

3 comments sorted by

2

u/Far_Reindeer8428 2h ago

we turned three review comments into lint rules and the agent stopped repeating them. the linter is the only reviewer that never gets tired

1

u/t_timber 53m ago

this is the way to do it, i've spent way too much time arguing with the ai about the same style preference over and over. having a hard rule in place saves so much sanity.

2

u/shetritr 1h ago

good one. a cheap check that each rule is real: run it against the parent of the commit that fixed that bug. if it doesn't fire on the old code, it's a rule the agent wrote to look busy. probably part of why yours found hundreds that held up