Skip to content

Trim pre-commit to Julia-appropriate hooks#75

Merged
SamuelBrand1 merged 1 commit into
mainfrom
slow-precommit
Jun 2, 2026
Merged

Trim pre-commit to Julia-appropriate hooks#75
SamuelBrand1 merged 1 commit into
mainfrom
slow-precommit

Conversation

@SamuelBrand1

Copy link
Copy Markdown
Collaborator

Why

Pre-commit CI on this repo is very slow. The cause isn't any recent change — it's hook environment setup. pre-commit run --all-files builds every hook's environment before running, regardless of whether matching files exist. This is a Julia package with no .py, .R, or .java files, yet the config installed hooks for all three:

  • R lintr (lorenzwalthert/precommit) — bootstraps an renv library and compiles lintr + its dependency tree. Several minutes on a cold cache, and there's nothing to lint. This is the dominant cost.
  • pretty-format-java — needs a Java formatter; no Java files.
  • ruff ×3 (Python) — builds a venv; no Python files.

Cold rebuilds happen easily because the cache key (pre-commit-4|${pythonLocation}|hashFiles(config)) has no restore-keys fallback.

What

  • Remove the ruff, lintr, and pretty-format-java hooks. Keep the generic file-cleanliness hooks + detect-secrets.
  • Julia formatting is unchanged — still enforced by the separate runic CI job (fredrikekre/runic-action).
  • Drop the now-unused r-lib/actions/setup-r step from the workflow and the dead ~/.cache/R/renv cache path from the composite action.

Result

Locally, pre-commit run --all-files now completes in ~6s cold (only two small hook environments to build), with all checks passing.

🤖 Generated with Claude Code

This repo is a Julia package with no Python, R, or Java source files, yet
pre-commit configured hooks for all three. On a cold GitHub Actions cache,
`pre-commit run --all-files` had to build every hook environment up front;
the R `lintr` hook (lorenzwalthert/precommit) bootstrapped an renv library
and compiled lintr + its dependency tree, which dominated CI runtime for no
benefit (there is nothing for it to lint).

Remove the ruff (Python), lintr (R) and pretty-format-java (Java) hooks,
keeping the generic file-cleanliness hooks and detect-secrets. Julia
formatting is already handled by the separate `runic` CI job. Also drop the
now-unused R setup step from the pre-commit workflow and the dead renv cache
path from the composite action.

Locally, `pre-commit run --all-files` now completes in ~6s cold (was minutes).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.68%. Comparing base (8e8a56a) to head (b0f49f6).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #75   +/-   ##
=======================================
  Coverage   95.68%   95.68%           
=======================================
  Files           5        5           
  Lines         139      139           
=======================================
  Hits          133      133           
  Misses          6        6           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SamuelBrand1 SamuelBrand1 merged commit 8ba2f2d into main Jun 2, 2026
10 checks passed
@SamuelBrand1 SamuelBrand1 deleted the slow-precommit branch June 2, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants