For questions regarding the pre-commit framework, not to be confused with git pre-commit hooks generally. Use this tag only when your question involves the framework. The tool pre-commit is a framework for managing and maintaining multi-language pre-commit hooks.
Questions tagged [pre-commit.com]
309 questions
3
votes
1 answer
pre-commit isort no module named 'setuptools'
I am trying to run pre-commit hooks, but they fail when they come across the isort hook which throws the error below:
File "/home/el/.cache/pre-commit/repoffrjhcx0/py_env-python3/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 92,…

coredumped0x
- 768
- 1
- 12
- 28
3
votes
2 answers
Unable to run pre-commit in anaconda environment
I have an Anaconda environment in my current project. I have been trying to configure my pre-commit hooks, however I keep running unto this error:
So, the first time round when I got this error, I did some research and saw that ruamel.yaml needs to…

UGuntupalli
- 769
- 1
- 9
- 22
3
votes
1 answer
Run pre-commit hook on all pushed files
The basic version of my setup is to have pre-commit run a code linter. However I find it too long / inconvenient when it checks/rejects individual commits, instead I'd like to run it once I try to push my code to the remote / CI. I found that I can…

Yodogawa Mikio
- 413
- 3
- 9
3
votes
1 answer
Black ignores skip-string-normalization flag
In my pre-commit configuration I have black version 19.10b0 and in pyproject.toml I have line:
skip-string-normalization = true
So my strings don't get double quotes normalized.
But then I run pre-commit autoupdate, black version upgrades to 20.8b1…

sgt pepper
- 504
- 7
- 15
3
votes
0 answers
Using Python pre-commit with a local server
I am using a python package called pre-commit to standardize the git workflow for my team.
I am having some issues setting up a pre-commit hooks with this package https://github.com/pre-commit/mirrors-mypy due to company proxy with github.
I decided…

mike_gundy123
- 469
- 5
- 18
3
votes
1 answer
How can I use brew and install precommit for Python 3.6.8
I want to use brew to install pre-commit for python 3.6.8. I am using macOS Catalina (Version 10.15.7)
I am using brew install pre-commit to do the installation.
I am having issues because my pre-commit uses Python 3.9 and I want to avoid this…

Siddharth Satpathy
- 2,737
- 4
- 29
- 52
3
votes
2 answers
pre-commit prints 'golint: command not found'
Envs
$ go version
go version go1.15.2 linux/amd64
What I want
I want to make a microservice implemented by Go.
What happened
When I run git commit, pre-commit run golint command, and now it prints 'golint: command not found'.
asuha on…

Asuha
- 231
- 1
- 5
- 16
3
votes
1 answer
pygrep pre-commit hook to check string is present
If I want to write a pre-commit hook to check that, e.g., the string "I love pre-commit" isn't anywhere in my source code, I could do
- repo: local
hooks:
- id: love_statement
name: Check that I love pre-commit isn't in source code
…

ignoring_gravity
- 6,677
- 4
- 32
- 65
3
votes
1 answer
pre-commit on windows for terraform
trying to get pre-commit up and running on windows, trying a simple terraform fmt command, but dont many examples of how to run exe piecing it together i have the below:
my .pre-commit-config.yaml
repos:
- repo:…

Staggerlee011
- 847
- 2
- 13
- 23
3
votes
1 answer
Git Pre-commit hooks
I need to set up a series of Gitlab hooks within a Docker image that will be triggered on pre-commit. I have a Docker file and a pre-commit-config.yaml which builds successfully with the exception of one hook which I cannot seem to get working.…

MmmmDonuts
- 33
- 1
- 3
3
votes
1 answer
Run pre-commit.com hook once (not for every file) if a matched file is detected
I have a hook that generates documentation files from source files, built with the pre-commit.com framework. The function that is invoked in that hook does not have a file argument, so it simply creates documentation for all source files in the…

Lorenz Walthert
- 4,414
- 1
- 18
- 24
3
votes
0 answers
Automate pre-commit run with pipenv install
I'm setting up a python project for my team using pipenv, I've installed the pre-commit library in the Pipfile and when a new developer clone my repo and runs pipenv install then the pre-commit doesn't work. It's necessary to run pre-commit install…

Hernan Acosta
- 377
- 5
- 19
3
votes
1 answer
Git pre-commit hook configuration
I'm following the office guidance to create and add a hook to the pre-commit check process. There are 3 files I need to create
.pre-commit-config.yaml
.pre-commit-hooks.yaml
theCheckFile.sh
The config file configs the hooks file which…

SLN
- 4,772
- 2
- 38
- 79
2
votes
1 answer
How to ignore `rev` in pre-commit config?
Here is a .pre-commit-config.yaml from pre-commit.
It will git clone the specified rev of git repo.
How can I ignore the rev and always git clone the newest?
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
…

luhao
- 70
- 7
2
votes
2 answers
Select all the files with a spefic extension Github actions workflow
Hi I am trying to run a pre-commit hook on all the files with .sql extension. I was wondering how can I do that. All those files with .sql are in the models/ directory, but I have sub-directories within that directory too (to group those sql files)…

Dude
- 366
- 5
- 19