DEV Community

TildAlice
TildAlice

Posted on • Originally published at tildalice.io

Pre-commit Ruff Locks: Pin to CI or Accept 2-Week Drift

Lock Ruff and Watch CI Break Three Weeks Later

Pinning Ruff to an exact version in your pre-commit config sounds responsible. It stops your local hooks from breaking when Ruff releases a new rule. But here's what actually happens: three weeks later, your CI runs a fresher Ruff version, flags violations your local setup missed, and now you're fixing "new" lint errors in code that passed pre-commit yesterday.

I've seen this exact pattern in a dozen repos using Ruff + pre-commit. The version drift window keeps growing—Ruff ships releases every 2-3 weeks, and the gap between your locked local hook and the latest CI check becomes a 6-8 week lag by the time someone notices. That's enough time for 3-4 new rules to land, meaning "passing" commits suddenly fail in CI.

The alternative—letting Ruff auto-update in pre-commit—means developers get surprise lint failures on git commit after a hook refresh. Both options feel broken, but one breaks locally (fixable before push), the other breaks in CI (blocks merges). Let's figure out which pain is worth taking.

A person works on a laptop beside a set of labeled CDs on a desk.

Photo by cottonbro studio on Pexels

Continue reading the full article on TildAlice

Top comments (0)