Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ repos:
hooks:
- id: ruff
name: ruff
entry: bash -c 'source .venv/bin/activate && uv run ruff check --config pyproject.toml "$@"' --
entry: bash -c 'uv run ruff check --config pyproject.toml "$@"' --
language: system
pass_filenames: true
types: [python]
- id: ruff-format
name: ruff-format
entry: bash -c 'source .venv/bin/activate && uv run ruff format --config pyproject.toml "$@"' --
entry: bash -c 'uv run ruff format --config pyproject.toml "$@"' --
language: system
pass_filenames: true
types: [python]
- id: mypy
name: mypy
entry: bash -c 'source .venv/bin/activate && uv run mypy --config-file pyproject.toml "$@"' --
entry: bash -c 'uv run mypy --config-file pyproject.toml "$@"' --
Comment on lines +6 to +18

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files | sed -n '1,120p'

echo
echo "== pre-commit config =="
cat -n .pre-commit-config.yaml

echo
echo "== search for uv/pre-commit/windows bash =="
rg -n "language: system|entry: bash|bash|uv run|RUFF|MYPY|pre-commit|windows|GIT" .pre-commit-config.yaml pyproject.toml 2>/dev/null || true

Repository: crewAIInc/crewAI

Length of output: 8284


🌐 Web query:

pre-commit language: system entry bash executable Windows pass_filenames true appended files entry command

💡 Result:

When using language: system in pre-commit, filenames are automatically appended to the command specified in the entry field as a list of space-separated arguments [1][2][3]. Pre-commit does not provide a native configuration option to change this default behavior [2][4]. On Windows, if you are calling a bash script or a command that cannot handle multiple filenames passed as arguments, you can work around this by using a wrapper command in the entry field to process the filenames individually [1][2]. Common workarounds: 1. Use bash -c with a loop: If you have Git Bash available on Windows, you can use a bash command that iterates over the arguments [1][2]: entry: bash -c 'for file in "$@"; do mycommand "$file"; done' -- (Note: The -- at the end is important to ensure proper argument handling [2].) 2. Use xargs: Alternatively, you can use xargs to execute the command for each file individually [2]: entry: bash -c 'printf "%s\0" "$@" | xargs -0 -n1 mycommand' -- Important considerations: - Windows Compatibility: Using language: system with bash-specific commands requires that the user has a bash environment (like Git Bash) installed and accessible in their system PATH [5]. - Inefficiency: Pre-commit intentionally does not support one-file-at-a-time execution by default because it is less performant than batching files [2]. Using loops or xargs as shown above effectively bypasses this batching, which may increase execution time for large numbers of files [2]. - Command Limits: Be aware that operating systems have limits on the maximum length of command-line arguments, which is why pre-commit manages file batching automatically [6]. While you cannot guarantee a single-process execution for all files, you can use require_serial: true to force the hook to run in a single process, preventing parallel execution and often resulting in larger batches per call [6].

Citations:


Remove the remaining bash -c dependency.

These language: system hooks still call Unix-specific bash before uv run starts, so Windows users without Git Bash fail outside the tool execution. Use direct uv run ... entries for ruff, ruff-format, and mypy.

For pip-audit, remove the bash -c wrapper too; use the current --skip-editable ... --ignore-vuln GHSA-f4j7-r4q5-qw2c' -- entry without changing the long --ignore-vuln list, since it has pass_filenames: false.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.pre-commit-config.yaml around lines 6 - 18, Remove the Unix-specific bash
-c wrappers from the ruff, ruff-format, and mypy hooks, replacing each entry
with its direct uv run command while preserving existing arguments and hook
settings. Update the pip-audit entry similarly, retaining the existing
--skip-editable and complete --ignore-vuln list and its pass_filenames behavior.

language: system
pass_filenames: true
types: [python]
Expand All @@ -30,7 +30,7 @@ repos:
name: pip-audit
# Keep this ignore list in sync with .github/workflows/vulnerability-scan.yml.
entry: >-
bash -c 'source .venv/bin/activate && uv run pip-audit --skip-editable
bash -c 'uv run pip-audit --skip-editable
--ignore-vuln PYSEC-2024-277
--ignore-vuln PYSEC-2026-89
--ignore-vuln PYSEC-2026-97
Expand Down