Questions tagged [pre-commit.com]

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.

309 questions
1
vote
0 answers

Githook pre-commit error exit code 1 in GitKraken

I'm trying to use the pre-commit package and the git hooks. If I run pre-commit, or if I commit, from the command line all runs well. But when I try to commit from GitKraken, the following error is raised: Here instead the output of a commit from…
Simone Biffi
  • 79
  • 2
  • 6
1
vote
0 answers

How to run shell script before pre commit hook

In python project I have pre-commit-config.yaml with black and mypy checkers. The goal is to before checking for errors, first run black . and mypy ./ to fix possible errors and then run hooks. - repo: local hooks: - id: code-formatter …
1
vote
0 answers

Autopep8 and pre-commit not honoring --global-config

I'm trying to use pre-commit with autopep8 running the command pre-commit run --all-files. My tree and files are as follows: . ├── project │   ├── ... ├── docs │   ├── ... │   └── conf.py ├── .flake8 ├── .pre-commit-config.yaml ├── setup.cfg ├──…
ZaxR
  • 4,896
  • 4
  • 23
  • 42
1
vote
1 answer

Run pylint for both python 2.7 and 3.7, in pre-commit hook on Docker image

I am trying to use CircleCI to run a pre-commit hook that runs pylint for both Python 2.7 and 3.7. .circleci/config.yml runs pre-commit for both Python 2 and Python 3: jobs: lint-py2: docker: - image: python:2.7.14 steps: …
KevinG
  • 882
  • 3
  • 16
  • 33
1
vote
1 answer

Automatic code checking for python works incorrect

I try to check my code using special configuration .pre-commit-config.yaml repos: - repo: https://github.com/ambv/black rev: 'stable' hooks: - id: black args: [--py36, --line-length=120, src/webhook_app] python-version:…
0
votes
0 answers

Pre-commit mypy dep resolution not equivalent to running mypy natively

Crossposting this to SO since the issue was closed on the repo by the maintainer on Github https://github.com/pre-commit/pre-commit/issues/2951 without resolution and I'm unable to find out what the origin of the issue is/how to fix it. It's…
0
votes
1 answer

pip3 install commit installed - i've tried both python3 -m pre-commit --version and $ pre-commit --version and it says module not found

I am using Pycharm and have cloned a repo from Github. When trying to set up my pre-commit hooks, i installed pre-commit in the terminal, however when trying to obtain the version it says module not found but successful in the install. Does anyone…
0
votes
0 answers

Executables in https://github.com/pre-commit/pre-commit-hooks not found

When I run run pre-commit it successfully runs black, isort, flake8, and pyupgrade, but it is unable to run the hooks installed from https://github.com/pre-commit/pre-commit-hooks. However, I can see it downloaded the hooks and stored them in the…
Steve
  • 1,250
  • 11
  • 25
0
votes
0 answers

Python mypy-mirror in precommit, how to find a list of additional dependencies

I have .pre-commit set with the following config: repos: - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.3.0 hooks: - id: mypy additional_dependencies: [types-requests,types-python-dateutil,types-PyYAML] I wonder…
Drachenfels
  • 3,037
  • 2
  • 32
  • 47
0
votes
2 answers

Missing env variable (specified in profiles.yaml) running sqlfluff on pre-commit with dbt

I am using dbt and we set up pre-commit to lint our models before opening a PR. After the update of dbt (1.4.5 to 1.5.0) and sqlfluff (2.0.2 to 2.1.0), we are no longer able to run pre-commit because we specify environment variables in our…
Nicolaz
  • 149
  • 1
  • 8
0
votes
1 answer

Fetch .clang-format file in pre-commit framework at install

We have a repository in which we want to introduce pre-commit framework and override the previous git pre-hooks. We want to run pre-commit on different languages and we will be using clang-format to format C++ code. Now I had one question, since we…
Rahul Raj
  • 41
  • 7
0
votes
0 answers

Installing environment for https://github.com/igorshubovych/markdownlint-cli fails with AttributeError: 'bytes' object has no attribute 'tell' #328

I am using - repo: https://github.com/igorshubovych/markdownlint-cli rev: v0.32.2 hooks: - id: markdownlint Sometimes, pre-commit fails with the following error. [INFO] Installing environment for…
0
votes
1 answer

pre-commit: Missing required key: name will local hook

I'm trying to set up a custom repo: local hook with pre-commit and running into an error message that I don't understand My steps: From C:\Python\monorepo\project1\project1_app\ (in PyCharm terminal): pre-commit install Create the following…
alexei7
  • 182
  • 1
  • 3
  • 11
0
votes
1 answer

Pytest runs twice in pre-commit

Seems like pre-commit runs pytest tests twice. How to reproduce: Install pytest, pytest-cov, pre-commit Add .pre-commit-config.yaml: repos: - repo: local hooks: - id: unit_test name: Run unit pytest language: python …
0
votes
1 answer

Not the same result with local pre-commit and github pre-commit.ci

I don't see the same results between running pre-commit locally and pre-commit.ci in github. However, if I read the documentation of pre-commit.ci correctly, the configuration files used are the same. Locally: % git commit -m "pre-commit run…
servoz
  • 606
  • 9
  • 22