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

mypy: pre-commit results differ from

I am trying to introduce pre-commit into quite a large existing project and replace the existing direct call to mypy with pre-commit, however, the results differ. It would be unreasonable to try and describe everything I've tried in detail or expect…
Ibolit
  • 9,218
  • 7
  • 52
  • 96
1
vote
1 answer

pre-commit mypy with additional_dependencies from custom Pypi index

In my .pre-commit-config.yaml, I have the following config for mypy: - repo: https://github.com/pre-commit/mirrors-mypy rev: v0.971 hooks: - id: mypy args: [--strict] additional_dependencies: [ …
WZH
  • 354
  • 2
  • 12
1
vote
1 answer

pylint precommit - only fail on specific categories (errors/fatals) while still print warnings

My objective: I want pylint (in combination with pre-commit hooks) not to fail with warnings of the category C,R,W, but on E,F (Errors and fatals) and still output the warnings. I found a corresponding flag "--fail-on" on pylints-webpage but it…
horsti
  • 113
  • 1
  • 7
1
vote
1 answer

How many environments are set when running pre-commit install?

While running pre-commit install, I wondered if each non-local hook has its own environment or if there is just one environment for all of them. $ pre-commit run --all-files [INFO] Initializing environment for…
lmiguelvargasf
  • 63,191
  • 45
  • 217
  • 228
1
vote
1 answer

run pre-commit.com script for golang in github actions

I'm trying to run pre-commit.com script with some hooks related to golang in github actions. Seems like the testing environment lack of some tools to execute go-imports and golangci-lint. I've added steps for setting up required tools in the…
lgl1
  • 31
  • 4
1
vote
1 answer

pytest tests with pre-commit hook only on push, not commit

I've a pre-commit, and I want to add a pre-push hook within. So, I want to launch only python tests (pytest) when I push my changes, and not all the hooks (flake8, black, etc). Here my pre-commit config : default_stages: [commit, push] repos: - …
fabrice
  • 1,399
  • 1
  • 15
  • 27
1
vote
1 answer

Conda and pre-commit, error: Library stubs not installed for "requests" (or incompatible with Python 3.10)

Error message While using a conda environment and pre-commit I receive the error: error: Library stubs not installed for "requests" (or incompatible with Python 3.10) The full error message is: rc/export_data/plantuml_get_package.py:69: error:…
a.t.
  • 2,002
  • 3
  • 26
  • 66
1
vote
0 answers

Pre-commit using black was working fine however, running into a new error I do not understand- the existing material online did not resolve

Here is my pre-commit config file: repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.3.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo:…
JnooriRS
  • 103
  • 11
1
vote
2 answers

pre-commit: Mypy local hook reports the same error multiple times

Problem Mypy as a local hook reports the same error multiple times. related issues Difference between running Mypy directly VS with pre-commit run --all-files .pre-commit-config.yaml - repo: local hooks: - id: mypy name: mypy …
Nairum
  • 1,217
  • 1
  • 15
  • 36
1
vote
2 answers

Executable Scriptspython.EXE not found for pre-commit (lose slashes)

We created a pre-commit hook for our project. But when we ran that pre-commit on Windows, we got an error: Check copyright notices...................................................................Failed - hook id: check-copyright - exit code:…
magicarm22
  • 135
  • 10
1
vote
1 answer

Pylint used as pre-commit hook not accepting --fail-under flag

I have a pre-commit set up on a python repo. I have a .pre-commit-config.yaml file where I specify my pylint settings/arguments. Previously my pylint hook worked. Pylint config in .pre-commit-config.yaml: - repo: local hooks: - id:…
Harvey
  • 668
  • 2
  • 7
  • 15
1
vote
1 answer

How do I convert this post-checkout hook to be usable with pre-commit?

I have a post-checkout hook that I'm trying to convert to be usable with pre-commit. #!/bin/bash # 0 means 'git checkout somefile' (don't do anything) # 1 means 'git checkout branchname' echo "> $*" (($3)) || exit 0 declare -a…
harleypig
  • 1,264
  • 8
  • 25
1
vote
1 answer

Can I configure universal pre-commit hooks for my machine?

I am interested in adopting the pre-commit framework. I would like to create hooks for common errors that I tend make. For example, I want to: stop myself committing to a branch named "main" or "master" even in projects that have not (yet) adopted…
lofidevops
  • 15,528
  • 14
  • 79
  • 119
1
vote
1 answer

The regx in pygrep always returns True

I'm using the pygrep in pre-commit and here is my settings: - repo: local hooks: - id: jira-ticket name: check for jira ticket entry: '(ERP-[0-9]+ #(feat|fix|docs|style|refactor|perf|test|chore) .+)' args:…
1
vote
4 answers

"Pre-commit" command is not found by bash but is installed on macOS

Problem Description I'm having trouble making commits, when I try to make a commit with the command, for example: $ git commit -m "add readme" pre-commit not found. Install pre-commit with the command pip3 install --user pre-commit or follow the…
Pierre Vieira
  • 2,252
  • 4
  • 21
  • 41