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
0
votes
0 answers
Bash running cli command over and over when exit code is 1
I am working on a pre-commit hook bash script that makes use of a cli tool (snyk). Here is an example:
#!/usr/bin/env bash
echo "running snyk code test"
snyk code test
If I invoke the above using "pre-commit run --all-files" the tool runs as…
0
votes
1 answer
An unexpected error has occurred: sqlite3.OperationalError: no such table: repos
Currently doing workaround in an access restricted Wndows10 VM, manipulating a git repo with pip pre-commit package under git bash and python virtualenv environment. However, got the following sqlite3 error. While at the same time, I tried in…

nwpie
- 665
- 11
- 24
0
votes
1 answer
How to specify a similiarities options checker of pylint in pre-commit args?
I've been trying to configure my pre-commit config file to ignore similiarities on imports and docstrings as described in: https://pylint.pycqa.org/en/latest/technical_reference/features.html?highlight=similar#similarities-checker-options
But I…

wmoreira
- 1
- 1
0
votes
1 answer
Incompatibility click and black versions with Poetry ( ImportError: cannot import name '_unicodefun' from 'click' )
The incompatibility between click 8.1.1 and black <=22.1.0 has been reported and apparently fixed here
But apparently still a problem with poetry, as reported (and also apparently fixed) here
Config:
Poetry (1.1.13)
MacOS 10.15.7
my…

Charlotte
- 89
- 1
- 11
0
votes
1 answer
enforce file casing via pre-commit hook
I would like to enforce lower-case – and possibly snake_case – file names throughout a git repo, ideally via a pre-commit hook. Alas, Google comes up empty for this particular use case; check-case-conflict isn't quite what I'm looking for. Does any…

RoyalTS
- 9,545
- 12
- 60
- 101
0
votes
1 answer
Pre-commit override arguments in yaml file
I'm using pre-commit to validate my terraform projects. My default configs for most of project as below:
cat < .pre-commit-config.yaml
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.64.0
hooks:
- id:…

Dương Quang Thọ
- 213
- 4
- 15
0
votes
1 answer
pre-commit hooks terminate if previous stage fails
I'm using the pre-commit hooks configuration https://pre-commit.com/ to enable pre-commit hooks
repos:
- repo: local
hooks:
- id: pytest-check
name: pytest-check
entry: pytest
language: system
…

wasp256
- 5,943
- 12
- 72
- 119
0
votes
1 answer
Running pre-commit on all files in git beyond HEAD
I have already made git commits, but want to re-run pre-commit on files above a current Git HEAD commit. I intend to do this in CI with a second, more feature-full pre-commit configuration called .pre-commit-other-config.yaml.
I can accomplish this…

Intrastellar Explorer
- 3,005
- 9
- 52
- 119
0
votes
2 answers
Running pylint scoped to particular PR
In my opinion, pylint is a great tool and I love it. However, some individuals don't prefer pylint, and I find myself collaborating on projects with individuals who don't like pylint.
Our CI pipeline has multiple workflows, one of which is an…

Intrastellar Explorer
- 3,005
- 9
- 52
- 119
0
votes
1 answer
Match exact string from list of options
I am using pre-commit to run some hooks, and I have a regex where I only include a list of files (dirs) that I wish to run the hook on. The problem is that my regex matches exact string + any other appending string to the first string.
hooks:
- id:…

coredumped0x
- 768
- 1
- 12
- 28
0
votes
1 answer
pre-commit-hooks: yml validation fails when using merging several anchors
(Side note: This is a follow-up on this https://sourceforge.net/p/ruamel-yaml/tickets/313/)
I'm building a GitLab CI pipeline by defining a .gitlab-ci.yml file, see https://docs.gitlab.com/ee/ci/yaml/.
As my CI consists of several very similar build…

RamNow
- 456
- 5
- 16
0
votes
1 answer
pre-commit AssertionError: black requires Python 3.6+
Running pre-commit gives the error AssertionError: black requires Python 3.6+. But Python 3.8 is installed. The version of pre-commit is 1.15.2.

Raphael
- 1,518
- 2
- 14
- 27
0
votes
1 answer
pre-commit passing files as when using entry
I am using pre-commit to invoke flake8 with a plug-in flake8-requirements.
The plug-in currently requires flake8 to be invoked in the package root, which conveniently isn't the repo root. Per this comment in a pre-commit issue, I have accordingly…

Intrastellar Explorer
- 3,005
- 9
- 52
- 119
0
votes
0 answers
pre-commit pylint failing with 'E0401: Unable to import' for project modules
Below is the structure of my project and when I run pre-commit, pylint hook fails with the following errors.
pylint...................................................................Failed
- hook id: pylint
- exit code: 2
************* Module…

Somasundaram Sekar
- 5,244
- 6
- 43
- 85
0
votes
1 answer
Unexpected Error on committing changes when Talisman is setup for my repository
I did a Talisman setup for my project repository and now I am unable to commit changes to a branch. It aborts with the following error. Please help!
[INFO] Installing environment for https://github.com/thoughtworks/talisman.
[INFO] Once installed…

Rishabh Mishra
- 13
- 3