Skip to content

fix: make pre-commit hooks cross-platform (Windows) - #6983

Open
RajeshShrirao wants to merge 1 commit into
crewAIInc:mainfrom
RajeshShrirao:fix/pre-commit-windows-crossplatform
Open

fix: make pre-commit hooks cross-platform (Windows)#6983
RajeshShrirao wants to merge 1 commit into
crewAIInc:mainfrom
RajeshShrirao:fix/pre-commit-windows-crossplatform

Conversation

@RajeshShrirao

Copy link
Copy Markdown

Summary

Fixes #6863 — pre-commit hooks (ruff, ruff-format, mypy, pip-audit) failed on Windows before executing because they wrapped every command in:

bash -c 'source .venv/bin/activate && uv run ...' --

.venv/bin/activate is Unix-only; Windows virtual environments use .venv\\Scripts\\activate.

Change

Dropped the bash -c 'source .venv/bin/activate && ...' wrapper entirely and invoke uv run directly, which already activates the project virtual environment on every platform:

  • uv run ruff check --config pyproject.toml
  • uv run ruff format --config pyproject.toml
  • uv run mypy --config-file pyproject.toml
  • uv run pip-audit --skip-editable ...

Why this is safe

  • uv run resolves and activates the project env itself — the explicit source was redundant on POSIX too.
  • Behavior on Linux/macOS is unchanged (same tools, same configs).
  • Hooks now work under cmd/PowerShell on Windows without Git Bash.

Verification

  • YAML parses cleanly; entries render as expected.
  • ruff check / ruff format --check run with the new entry shape.
  • CI on the PR will exercise the hooks on all platforms.

Replace bash -c 'source .venv/bin/activate && ...' wrappers with plain
uv run invocations. The Unix-only activation script (.venv/bin/activate)
does not exist on Windows (.venv\Scripts\activate is used instead), so
ruff, ruff-format, mypy, and pip-audit never executed on Windows.

uv run already activates the project virtual environment, making the
explicit source step redundant on all platforms.

Fixes crewAIInc#6863
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 671b4a8a-b233-4850-a5cb-3f4d36862c37

📥 Commits

Reviewing files that changed from the base of the PR and between 5d7ae87 and d06755e.

📒 Files selected for processing (1)
  • .pre-commit-config.yaml

📝 Walkthrough

Walkthrough

Changes

Pre-commit hook execution

Layer / File(s) Summary
Direct uv hook commands
.pre-commit-config.yaml
Ruff, Ruff Format, Mypy, and pip-audit hooks now call uv run directly without activating .venv or using bash -c.

Suggested reviewers: greysonlalonde, thecybertech

Mergeability Score: ⚪ Minimal · up to d0675

This localized configuration change makes the pre-commit hooks cross-platform without introducing an actionable merge-blocking risk; it is merge-ready after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: making pre-commit hooks cross-platform for Windows.
Description check ✅ Passed The description directly explains the Windows failure, the configuration change, and the expected cross-platform behavior.
Linked Issues check ✅ Passed The changes remove the Unix-only activation wrapper and invoke all affected tools through uv run, satisfying issue #6863.
Out of Scope Changes check ✅ Passed The pull request changes only the pre-commit hook commands required to address the linked Windows compatibility issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

[BUG] pre-commit hooks fail on Windows due to hardcoded Unix virtual environment path

1 participant