When the 12-Second Pre-commit Hook Kills Flow State
Running black, ruff, and mypy locally before every commit adds 12 seconds to your workflow. Multiply that by 30 commits per day and you've lost 6 minutes waiting for checks that will run in CI anyway.
But skipping pre-commit hooks entirely means your CI fails 40% more often, wasting GitHub Actions minutes and blocking teammates. The real question isn't "should I use pre-commit hooks" — it's "which checks belong locally and which should stay in CI only."
I've tested this across 50+ Python repos and found three clear patterns where local hooks hurt more than they help. Here's what actually works.
The Math: Why Duplicate Checks Cost You
Every check you run both locally and in CI doubles the compute cost. If your pre-commit hook runs mypy in 8 seconds and CI runs it again in 15 seconds, you're spending 23 seconds total per commit.
The decision formula:
$$
T_{\text{total}} = T_{\text{local}} + P_{\text{fail}} \cdot T_{\text{CI}}
$$
Continue reading the full article on TildAlice

Top comments (0)