-
Notifications
You must be signed in to change notification settings - Fork 8.1k
fix: remove hardcoded Unix venv activation from pre-commit hooks #6884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shubandaniil-beep
wants to merge
1
commit into
crewAIInc:main
Choose a base branch
from
shubandaniil-beep:fix/precommit-windows-venv-activate
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4
−4
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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:
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 -cdependency.These
language: systemhooks still call Unix-specificbashbeforeuv runstarts, so Windows users without Git Bash fail outside the tool execution. Use directuv run ...entries forruff,ruff-format, andmypy.For
pip-audit, remove thebash -cwrapper too; use the current--skip-editable ... --ignore-vuln GHSA-f4j7-r4q5-qw2c' --entry without changing the long--ignore-vulnlist, since it haspass_filenames: false.🤖 Prompt for AI Agents