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
4
votes
1 answer

Flakehell with .toml configuration and pre-commit hook

I'm trying to run flakehell as pre-commit hook. my .pre-commit-config.yaml: repos: - repo: local hooks: - id: flakehell name: flakehell entry: flakehell lint project/ language: python …
tomm
  • 271
  • 2
  • 14
4
votes
3 answers

pre-commit works fine, but git commit fails

so in my project, there are serveral pre-commit hooks to make sure our codes meet team standard, but whenever i try to commit changes, there is always an error saying executable was not found. usually, i first assumed there must be some problem with…
yunu
  • 81
  • 4
4
votes
0 answers

Git pre-commit hooks per directory

How do I format a .pre-commit-config.yaml so it's different depending on my directory? My project has different directories. One directory is a UI directory with a package.json and Django files. Another one is a Python package, which does not have a…
simonzack
  • 19,729
  • 13
  • 73
  • 118
4
votes
2 answers

Python pre-commit unittest faild

I wish pre-commit to run the tests before committing my code. The command python -m unittest discover is working in the command line. D:\project_dir>python -m unittest…
shay te
  • 1,028
  • 3
  • 12
  • 23
4
votes
1 answer

How to use this Git pre-commit hook

Yelp detect secrets is a system that prevents secrets from entering your code base. I would like to install the pre-commit hook it provides. I've never used Git hooks before, but all the example files I see in .git/hooks/ are in bash, while the…
kramer65
  • 50,427
  • 120
  • 308
  • 488
4
votes
1 answer

pre-commit run The path python3.6 (from --python=python3.6) does not exist

I am trying to follow the contributing docs for JupyterHub and am getting an error when I run pre-commit run The error is related to my python version. It's expecting 3.6 for some reason even though everything was installed with Python 3.7.3. Here…
Nick Brady
  • 6,084
  • 1
  • 46
  • 71
3
votes
1 answer

How to run pre-commit on current active file in Pycharm?

I'm looking for a way to run my pre-commit hooks on the currently active file in Pycharm without committing the file. I do not want to artificially add changes to the file and then commit it. The intent is to clean my code while writing it, without…
emilaz
  • 1,722
  • 1
  • 15
  • 31
3
votes
2 answers

Pre-commit complains that "Stashed changes conflicted with hook auto-fixes" despite manually formatting files?

I am using pre-commit (version 2.20.0) for my C++ project with this hook: repos: - repo: https://github.com/pre-commit/mirrors-clang-format rev: v14.0.6 hooks: - id: clang-format I just staged a few lines each from a few different…
Tyler Shellberg
  • 1,086
  • 11
  • 28
3
votes
1 answer

Using environment variable in pre-commit hook arguments

I am struggling to use an environment variable into the arguments section of pre-commit hooks config following is an example spinet to show what I am trying to do - repo: https://github.com/returntocorp/semgrep rev: "v0.1.2" hooks: - id:…
Krishan Gopal
  • 4,073
  • 1
  • 16
  • 19
3
votes
1 answer

pre-commit hook does not echo on terminal

I am trying to run a script with pre-commit hook. Here is my script: build_script.sh #! /bin/bash echo "Stage 1: Preparing CMake configuration" .pre-commit-config.yaml fail_fast: false - repo: local hooks: - id: Generate build …
SNR_BT
  • 133
  • 5
3
votes
1 answer

Can I ignore flake8 errors by passing a git commit flag?

I have aflake8:check todo pre-commit hook, which I want to ignore for now. I can ignore everything if I git commit --no-verify but I do want all other hooks to run I also can edit my .pre-commit-hooks.yaml to remove the relevant hook, but I do want…
CIsForCookies
  • 12,097
  • 11
  • 59
  • 124
3
votes
1 answer

pre-commit InvalidConfigError

When I want to commit my changes in the .pre-commit-config.yaml, I get the following error: An error has occurred: InvalidConfigError: ==> File .pre-commit-config.yaml =====> while parsing a block mapping in "", line 33, column…
felice
  • 1,185
  • 1
  • 13
  • 27
3
votes
1 answer

Bitbucket pipeline - error installing pre-commit ts-lint

I have a step in my pipeline that runs our configured pre-commit on Bitbucket: ... - step: name: Passing linters image: python:3.7-slim-stretch script: - pip3 install "pre-commit==2.17.0" - apt-get update && apt-get…
3
votes
1 answer

pre-commit vs tox | what's the difference | scope of use

Tox: https://tox.wiki/en/latest/ pre-commit: https://pre-commit.com/ I would like to understand the borders for both choices. I know that pre-commit creates a py environment - same as tox. To me, their architecture looks a bit the same. Some people…
3
votes
0 answers

Pre-commit results in vim

In Vim 8.1, I can run :!pre-commit run --files % to lint and auto-format the current file. Is there some way I can turn that (or any way of calling pre-commit) into in-editor highlighting, like https://github.com/dense-analysis/ale does? In the past…
cov
  • 146
  • 7