Hacker News Viewer

Ratchets in Software Development

by nvader on 1/29/2026, 6:31:48 PM

https://qntm.org/ratchet

Comments

by: cocoflunchy

Also see <a href="https:&#x2F;&#x2F;www.notion.com&#x2F;fr&#x2F;blog&#x2F;how-we-evolved-our-code-notions-ratcheting-system-using-custom-eslint-rules" rel="nofollow">https:&#x2F;&#x2F;www.notion.com&#x2F;fr&#x2F;blog&#x2F;how-we-evolved-our-code-notio...</a>

2/2/2026, 11:30:24 AM


by: dependency_2x

Ratchet is a good name&#x2F;pattern. It is also grandfathering.<p>It is similar to how code coverage can be done. Old coverage may be low e.g. 40%, but may require 80% coverage on new lines, and over time coverage goes up.<p>I wonder if there has ever been a sneaky situation where someone wanted to use forbiddenFunction() really bad, so they remove the call elsewhere and tidy that up, so they could start using it.

2/2/2026, 10:41:18 AM


by: arnorhs

Interesting, props for coming up with a good name.<p>But it&#x27;s weird to me to call this a &quot;ratchet&quot;, and not just a custom lint rule. Since it sounds exactly like a lint rule.<p>The hard-coded count also sounds a bit like something that I would find annoying to maintain in the long run and it might be hard to get a feeling for whether or not the needle is moving in the right direction. - esp. when the count goes down and up in a few different places so the number stays the same.. you end up in a situtation where you&#x27;re not entirely sure if the count goes up or down.<p>A different approach to that is to have your ratchet&#x2F;lint-script that detects these &quot;bad functions&quot; write the file location and&#x2F;or count to a &quot;ratchets&quot; file and keep that file in version control.<p>In CI if the rachet has changes, you can&#x27;t merge because the tree is dirty, and you&#x27;d have to run it yourself and commit it locally, and the codeowner of the rachet file would have to approve.<p>at least that would be a slightly nicer approach that maintaining some hard-coded opaque count.

2/2/2026, 10:32:08 AM


by: burticlies

I’ve never understood why linters don’t have this baked in. You want to deprecate a pattern, but marking it as an error and failing the build won’t work. So you mark it warning and fill everyone’s editors with yellow lines. And then we just get used to the noisy warnings.<p>Ratchet is such a good word for it.

2/2/2026, 10:29:40 AM


by: dgoldstein0

I built something like this that we use both for migrations and disallowing new instances of bad patterns for my mid sized tech company and maintain it. Ours is basically a configuration layer, a metrics script which primarily uses ripgrep to search for matches of configured regexes, a linter that uses the same configuration and shows any configured lint messages on the matches, a CI job that asserts that the matches found are only in the allowlisted files for each metric, and a website that displays the latest data, shows graphs of the metrics over time, and integrates with our ownership system to show reports for each team &amp; the breakdown across teams. The website also has the ability to send emails and slack messages to teams involved in each migration, and when the configuration for a migration includes a prompt, can start a job for an agent to attempt to fix the problem and create a pr.

2/2/2026, 9:35:46 AM


by: thraxil

Shameless self-promotion, but my own post on Ratchets from a few years back: <a href="https:&#x2F;&#x2F;thraxil.org&#x2F;users&#x2F;anders&#x2F;posts&#x2F;2022&#x2F;11&#x2F;26&#x2F;Ratchet&#x2F;" rel="nofollow">https:&#x2F;&#x2F;thraxil.org&#x2F;users&#x2F;anders&#x2F;posts&#x2F;2022&#x2F;11&#x2F;26&#x2F;Ratchet&#x2F;</a> Similar basic idea, slightly different take.

2/2/2026, 10:33:24 AM


by: jiehong

I think this could be handled by an open rewrite rule [0], with the side effect that it could also fix it for you.<p>[0]: <a href="https:&#x2F;&#x2F;docs.openrewrite.org&#x2F;recipes" rel="nofollow">https:&#x2F;&#x2F;docs.openrewrite.org&#x2F;recipes</a>

2/2/2026, 10:47:21 AM


by: HPsquared

It&#x27;s like looking for &quot;linter regressions&quot; rather than test regressions.

2/2/2026, 10:46:44 AM


by: gorgoiler

Love it! …but of course I’d worry about a diff that added one offense while removing another, leaving the net sum the same. Perhaps the author handles this? You want to alert on the former and praise on the latter, not have them cancel out through a simple sum. Admittedly it’s a rare sounding edge case.<p>The more trad technique for this would be to mark the offending line with <i># noqa</i> or <i># ignore: foo</i>. Another way is to have a <i>.fooignore</i> file but those are usually for paths or path globs to ignore.<p>I like the author’s idea[1] of having the “ignore” mechanism next to the linter codebase itself, rather than mixed in with the production codebase. Adding the files and line numbers for known-offenders to that code could be a useful alternative to a simple sum?<p>Perhaps more robustly, some kind of XPath like AST syntax to indicate which parts of the codebase have the known problem? It feels just as fragile and could quickly get over complicated.<p>At the end of the day an online comment has always done it for me. With Python, Meta’s libcst is an excellent and fast way to get an AST that includes comments. It’s the most robust tool I’ve found but you can just use built-in ast.py and ad-hoc <i>file:line</i> parsing too.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Instagram&#x2F;LibCST" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Instagram&#x2F;LibCST</a><p>[1] Sorry to be a fanboi but <i>Antimemetics</i> is amazing!<p><a href="https:&#x2F;&#x2F;qntm.org&#x2F;fiction" rel="nofollow">https:&#x2F;&#x2F;qntm.org&#x2F;fiction</a>

2/2/2026, 10:48:16 AM


by: charliecs

[dead]

2/2/2026, 10:48:10 AM