fix(pre-commit): remove Docker requirement for ruff hooks - #20012
Conversation
The ruff pre-commit hooks used `language: docker_image` which required Docker to be running for every commit and push. This blocks developers when Docker is not available or has storage issues. Switch to a wrapper script (run_ruff.sh) that prefers a local ruff install and falls back to the Docker image only when ruff is not on PATH. Both the generator and the generated .pre-commit-config.yaml are updated.
PR SummaryOverview The new wrapper runs local Reviewed by Cursor Bugbot for commit 85dce51. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit baa4e93. Configure here.
Prevents root-owned files and .ruff_cache when the Docker fallback rewrites files on Linux.
| shift | ||
|
|
||
| if command -v ruff &>/dev/null; then | ||
| exec ruff "$subcmd" "$@" |
There was a problem hiding this comment.
We should check the version of ruff also

Summary
language: docker_image, requiring Docker for every commit/push. When Docker is unavailable or has storage issues (e.g. ENOSPC/corrupted containerd), commits and pushes are completely blocked.run_ruff.sh) that uses a localruffinstall when available and falls back to the Docker image only when ruff is not on PATH.generate_pre_commit.py) and regenerated.pre-commit-config.yaml.Test plan
pre-commit run ruff-check --files metadata-ingestion/src/datahub/cli/cli_utils.pypasses with local ruffpre-commit run ruff-format --files metadata-ingestion/src/datahub/cli/cli_utils.py --hook-stage pre-pushpasses with local ruffPATH=/usr/bin bash .github/scripts/pre-commit/run_ruff.sh check metadata-ingestion/src/datahub/cli/cli_utils.py)Summary by cubic
Removes the Docker requirement for the ruff pre-commit hooks so commits and pushes no longer fail when Docker is unavailable or misbehaving (e.g. ENOSPC or corrupted containerd state).
run_ruff.sh, which runs a localruffwhen it's on PATH and falls back to the pinned Docker image (ghcr.io/astral-sh/ruff:0.15.22) only when it isn't.ruffversion differs from the pinned 0.15.22..ruff_cacheon Linux.ruff-checkandruff-formatfromlanguage: docker_imagetolanguage: systemand updates the generator and regenerated.pre-commit-config.yaml.ruffor Docker when neither is found.Written for commit 85dce51. Summary will update on new commits.