pre-commit-hook-yamlfmt
pre-commit-hook-yamlfmt copied to clipboard
Executable ... not found when running pre-commit
Issue
When I run pre-commit run --all-files
I get the following:
Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Check Yaml...............................................................Passed
Check for added large files..............................................Passed
yamllint.................................................................Passed
Format YAML files........................................................Failed
- hook id: yamlfmt
- exit code: 1
Executable `C:UsersUser.cachepre-commitrepoolie1bxepy_env-python3.9Scriptspython.EXE` not found
It looks like somwhere somehow the /
characters are being stripped because I was able to find this:
C:\Users\User\.cache\pre-commit\repoolie1bxe\py_env-python3.9\Scripts\python.exe
I even tried renaming .../python.exe
to .../python.EXE
but that didn't seem to matter.
Config
My .pre-commit-config.yaml
file:
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.21.0
hooks:
- id: yamllint
args: [--format, parsable, --strict, --config-file, config.yamllint]
- repo: 'https://github.com/jumanjihouse/pre-commit-hook-yamlfmt'
rev: 0.1.0
hooks:
- id: yamlfmt
Environment
I am using Windows 10 Pro
I have activated a virtual environment, but both the virtual environment and the global one have pre-commit
installed.
My python version is 3.9.5
I'm experiencing the same issue. My system info:
OS: Microsoft Windows Server 2016 Standard Python: 3.7.2
The issue seems to be with how the yamlfmt script is deployed. It may be best to move the main logic to a module and export an entry point for pre-commit. That seems to be how the main pre-commit-hooks repo does it.
Issue
When I run
pre-commit run --all-files
I get the following:Trim Trailing Whitespace.................................................Passed Fix End of Files.........................................................Passed Check Yaml...............................................................Passed Check for added large files..............................................Passed yamllint.................................................................Passed Format YAML files........................................................Failed - hook id: yamlfmt - exit code: 1 Executable `C:UsersUser.cachepre-commitrepoolie1bxepy_env-python3.9Scriptspython.EXE` not found
It looks like somwhere somehow the
/
characters are being stripped because I was able to find this:C:\Users\User\.cache\pre-commit\repoolie1bxe\py_env-python3.9\Scripts\python.exe
I even tried renaming
.../python.exe
to.../python.EXE
but that didn't seem to matter.Config
My
.pre-commit-config.yaml
file:# See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: - repo: 'https://github.com/pre-commit/pre-commit-hooks' rev: v3.2.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files - repo: https://github.com/adrienverge/yamllint.git rev: v1.21.0 hooks: - id: yamllint args: [--format, parsable, --strict, --config-file, config.yamllint] - repo: 'https://github.com/jumanjihouse/pre-commit-hook-yamlfmt' rev: 0.1.0 hooks: - id: yamlfmt
Environment
I am using Windows 10 Pro I have activated a virtual environment, but both the virtual environment and the global one have
pre-commit
installed. My python version is 3.9.5
I am facing the same issue. And I have same config as yours
It might be useful for someone to know.
I found a fix in this PR and connected it correctly in this way:
.pre-commit-config.yaml
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 71af8556bfcf12745fdfdb3ed57b6698b444f58c
hooks:
- id: yamlfmt
args: [--mapping, '2', --sequence, '4', --offset, '2']
Classic backslashes in path on Windows not being escaped :) Got this too.
Hey, I encountered the same issue and wanted to ask, if there is a fix for the removal of the backslashes?
Still no fix?
Same error in Windows 10
I ended up using pre-commit in WSL