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
1
vote
1 answer
How do I use the new coursier language with pre-commit.com?
I'm using pre-commit 2.8.2 and trying to get the new coursier language to work.
I'm able to run the coursier command successfully from CLI.
❯ cs launch io.gitlab.arturbosch.detekt:detekt-cli:1.14.2 -M io.gitlab.arturbosch.detekt.cli.Main -r…

Dustin Shimono
- 1,031
- 7
- 10
1
vote
2 answers
yaml multiline regex
I would like to write a pygrep hook with pre-commit which finds cases of, e.g.
.. warning:
(when it should be .. warning::).
If I write
- repo: local
- id: incorrect-sphinx-directives
name: Check for incorrect Sphinx directives
…

ignoring_gravity
- 6,677
- 4
- 32
- 65
1
vote
1 answer
Python Black hooks (language: system)
I am using black on pre-commit
and this is the hook
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
this is the CI config I am using for black
black --check .
and it will reformat some files in the…

Zuhairi
- 165
- 2
- 3
- 14
1
vote
2 answers
pre-commit + python + react (js)
I use pre-commit, I want to use it together with .py files, I reformat file black module, but I also have a web folder where the react files are, I have 2 questions at once, what is relevant for reformatting the code for js and how can I unite so…

big-vl
- 134
- 1
- 7
1
vote
2 answers
pre-commit for local hook gives error: "unrecognized arguments: .pre-commit-config.yaml"
I have the following repo in pre-commit file .pre-commit-config.yaml
- repo: local
hooks:
- id: check_pip
name: Check pip file
description: This hook checks if requirements-dev.txt is up to date.
language: system
…

Erfan
- 40,971
- 8
- 66
- 78
1
vote
0 answers
pre-commit fails to run in docker container
I tried installing pre-commit==1.20.0 in our dockerised development environment, simply to allow us manually run pre-commit run --all-files. However, it is failing with an error that I can't decipher. I speculate the extra index that is part of our…

thomasarvanitidis
- 31
- 5
1
vote
1 answer
python pre-commit and pylint
I'm setting up a project with Python 3.8.5 (in Visual Studio Code), pre-commit and pylint.
In the project pylint is reporting on PyQt5 module imports since they are C based.
To not make Pylint report on this, the .pylintrc file can be configured…

timv
- 11
- 1
- 2
1
vote
1 answer
How do I fix CalledProcessError problem with precommit and hook prospector?
details:
-Python 3.7.5
-Precommit 2.6.0
-prospector 1.1.7
-VScode editor
I have a problem with the hook prospector.I have installed pre-commit using pip, and when I use its CLI without hook prospector in the config .yaml, everything goes fine:
(env)…

Manuel Semeco
- 53
- 2
- 6
1
vote
1 answer
Installing the eslint pre-commit hook errors out
I'm trying to install the eslint pre-commit hook (https://github.com/pre-commit/mirrors-eslint)
This is the entry in my pre-commit file:
- repo: https://github.com/pre-commit/mirrors-eslint
rev: 'v7.4.0'
hooks:
- id: eslint
However,…

Human Cyborg Relations
- 1,202
- 5
- 27
- 52
1
vote
1 answer
npm run deploy ignore hooks
I was getting below error while committing the changes.
Simply adding .pre-commit-config.yaml file or deleting .git\hooks folder was not resolving my problem. So I added --no-verify option while committing and it solved my problem.
Now, I am trying…

aagjalpankaj
- 1,160
- 1
- 15
- 25
1
vote
0 answers
Providing location to Cargo.toml for fmt pre-commit hook
I have repository that has both Python and Rust code inside.
In the root of the repository I have .pre-commit-config.yaml with:
- repo: https://github.com/doublify/pre-commit-rust
rev: master
hooks:
- id: fmt
…

dzieciou
- 4,049
- 8
- 41
- 85
1
vote
1 answer
pre-commit: run flake8 with python 3.6.8
I installed Pyton 3.6.8 on my system.
python3 --version //-> Python 3.6.8
python3.6 --version //-> Python 3.6.8
My pre-commit-config.yaml is:
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
- repo:…

user5580578
- 1,134
- 1
- 12
- 28
1
vote
3 answers
pipenv run pre-commit --all failed with: An unexpected error has occurred: AttributeError: type object 'Hook' has no attribute 'create
in my pre-commit-config.yaml file i'm trying to run black, the python code formatter
repos:
- repo: https://github.com/python/black
rev: stable
hooks:
- id: black
language_version: python3.6
but whenever I tried running black…

Chia Yi
- 562
- 2
- 7
- 21
1
vote
1 answer
Use black with python 3.7 as pre-commit hook
I'm trying to use black on pre-commit, by using this settings:
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
language_version: python3.7
Unfortuntely I get this error: (it doesn't happen if I try to…

user1403546
- 1,680
- 4
- 22
- 43
1
vote
1 answer
Python pre-commit unittest skipped
I would like to use pre-commit to handle git hooks for my git project. However, when I use it, the git commit command keeps to skip the unittest execution:
(smartexchange) trnbook:SmartExchange ale$ git commit -m "add pre-commit yaml…

Alessandro Trinca Tornidor
- 914
- 1
- 19
- 31