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
votes
1 answer
Pre-commit hook skips files in directory
I'm trying to implement SQLFLUFF linter on a certain directory (models/market) on a repo. I'm using this command pre-commit run --files models/market/
what I see is that it is skipping .sql files inside the directory showing this…

Masoud
- 1
- 3
-1
votes
1 answer
pre commit hook files skipped
repos:
- repo: https://github.com/terraform-docs/terraform-docs
rev: "v0.16.0"
hooks:
- id: terraform-docs-go
args: ["markdown", "table", "--output-file", "README.md", "./"]
- repo:…

dev1993
- 21
- 4
-1
votes
1 answer
Pre-Commit hooks on MacOs require superuser to work
I am working on a python project with a MacOs laptop, I just installed pre-commit with pip install pre-commit and then pre-commit install, and when I try to commit or execute pre-commit run --all-files it gives the following error:
An unexpected…

Thirsty
- 188
- 2
- 12
-1
votes
1 answer
mypy via pre-commit - Duplicate module name 'package.module.py' (and 'package\module.py')
I have the following repo-structure
my-repo/
.github/
linters/
.mypy.ini
.pre-commit-config.yaml
mypackage/
__init__.py
main.py
subpackage/
__init__.py
foo.py
…

tenticon
- 2,639
- 4
- 32
- 76
-1
votes
1 answer
Pnpm for pre-commit custom hook
I work on a python/svelte full-stack app where we use pre-commit. I've installed stylelint to frontend web dir and configured a custom hook for it :
- id: stylelint
name: stylelint
additional_dependencies:
- stylelint
…

meAndrew
- 144
- 1
- 13
-1
votes
2 answers
Pre-commit hooks always fails with index.lock already exists
When running the hooks in the pre-commit-config.yaml the hook fix-encoding-pragma e debug-statements fails (remove the # -*- coding: utf-8 -*- for example, but fails) and then i can't proceed to the commit. If i try to commit again i get the same…

Fanto
- 377
- 3
- 14
-1
votes
1 answer
How to create a pre-commit.com hook that runs an entry which is located in the same repository
I would like to create a repository for pre-commit.com hook with a hook that runs an entry located within this repository.
I have created a repository with a hook:
my-pre-commit-hook> ls -a
.pre-commit-hooks.yaml
my-script.py
with…

V_V
- 612
- 9
- 23
-1
votes
1 answer
How do I exclude multiple folders and/or file-patterns from pre-commit analysis?
I have my python project. I'm trying to setup pre-commit checks using pre-commit. I want to exclude some folders and some files (by pattern) from the analysis. The `exclude tag in config file only supports string not an array.
E.g. in following…

Kashyap
- 15,354
- 13
- 64
- 103
-1
votes
1 answer
I can't exlude the directory from my pre-commit
My goal it's exlude migrations/ from my pre-commit.
I have my .pre-commit-config.yaml which begin with
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-yaml
- id: debug-statements
…

Alexey Razmanov
- 51
- 5
-1
votes
1 answer
VSCode UI causes error that terminal doesn't - The hook `black` requires pre-commit version 2.9.2 but version 2.6.0 is installed
I have installed pre-commit in a virtual environment. The following error pops up whenever I use the commit button / press ctrl + enter in visual studio code.
If I use the vs code terminal (WSL) then there is no problem and all the tests including…

RedBeard
- 145
- 2
- 15
-1
votes
2 answers
How to make pre-commit clang-format skip over .js files?
I have the following pre-commit hook:
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6
hooks:
- id: clang-format
While in the past I have seen pre-commit skip over non-CPP files, a coworker just showed me an…

Tyler Shellberg
- 1,086
- 11
- 28
-1
votes
1 answer
Magit: show buffer with pre-commit hooks output on error
This is similar to Magit : how to see pre-commit hooks before editing commit log?
I use a package called pre-commit (unfortunate name) that runs several checks on git's pre-commit hook. When these checks fail, I can see their output in magit process…

Matteo Gamboz
- 373
- 3
- 11
-1
votes
1 answer
mypy throws "error: Too many arguments for 'object'" on pre-commit hook run but not on local run
from typing import Callable, Type, TypeVar
T = TypeVar("T")
def repo(class_: Type[T]) -> Callable:
def instantiate(*args, **kwargs) -> T:
return class_(*args, **kwargs)
return instantiate
Code above throws "error: Too many…

Joe Catin
- 33
- 3
-1
votes
1 answer
Check Jupyter cells executed in sequence
I would like to enforce a policy that all Jupyter notebooks that are checked into a git repository were run top to bottom. That is, I would like to check whether the cells in the notebook were executed in sequence.
Are there any existing solutions…

RoyalTS
- 9,545
- 12
- 60
- 101
-1
votes
1 answer
Pre commit hook throwing error https://github.com/dnephin/pre-commit-golang
Check for added large files..............................................Passed
Don't commit to branch...................................................Passed
Fix End of Files.........................................................Passed
Trim…

EagerLearner
- 447
- 1
- 5
- 11