375 questions
0
votes
1
answer
177
views
Successful mypy run interpreted as failure in pre-commit
Given a .pre-commit-config.yaml:
repos:
- repo: local
hooks:
- id: mypy
name: mypy
language: system
entry: uv run mypy
types: [python]
require_serial: true
exclude: scripts/...
0
votes
1
answer
126
views
Execute another command in entry in pre-commit hook
I have to run command, which 1 argument requires output from another command (see below). Is there a way how to accomplish this? Either in entry or args? Or does pre-commit offer some built in feature ...
2
votes
1
answer
133
views
Pre-commit pointing to /snap/bin/pre-commit
I am working on new project and installed pre-commit using:
python -m pip install pre-commit
within my created environment (i.e. a python=3.9 env)
When I run pre-commit, I had an incompatibility ...
-2
votes
2
answers
1k
views
How prevent check-yaml for specific file or line inside that file with pre-commit and pre-commit-hooks?
I am trying to enable mermaid in mkdocs using the material theme.
According to the docs I should be able to enable it via:
markdown_extensions:
- pymdownx.extra:
pymdownx.superfences:
...
1
vote
1
answer
81
views
How do I escape spaces in arguments that are a part of a pre-commit hook’s entry value?
I’m currently working on a few repositories that contain Nix flakes. You can test a Nix flake by running this Bash command:
nix flake check
That command will only work if you have the nix-command and ...
-3
votes
1
answer
127
views
How to exclude a directory from google-java-format via Git pre-commit hook?
.pre-commit-hooks.yaml is like below:
- id: google-style-java
name: Google Java Code Style for Java
description: Formats code in Google's Java codestyle.
entry: ./format-code.sh
...
0
votes
1
answer
817
views
How to export dependencies to requirement.txt and requirements-dev.txt using uv-pre-commit
I'm using uv as my package manager in my Python project. My pyproject.toml file looks like this:
[project]
name = "some-name"
version = "0.1.0"
readme = "README.md"
...
0
votes
2
answers
97
views
Apply fixes only on the modified text
Is there a way to tell the pre-commit (pre-commit.com) to apply fixes just to the modified text instead of the entire files touched? We want to set up spellchecking (using typos) on our API models, ...
0
votes
1
answer
105
views
Checkov running on Swagger docs even though excluded
I have a pre-commit configuration that I use inside a Go repository. This repository includes Go files and Swagger docs generated by Protobuf so I want to exclude those from the checks to avoid issues ...
0
votes
1
answer
233
views
buf pre-commit expecting system-installed go but it is
I'm using some pre-commit hooks for Buf to help me check Protobuf files before compiling them to Go:
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0 # Use the ref you ...
0
votes
0
answers
61
views
Why do I need to specify some dependencies to pyright but not others? [duplicate]
I'm building a python app with a .toml file. I'm using poetry to deal with dependencies and packaging. Here is an extract of my toml file
[tool.poetry]
name = "app_name"
version = "0.1....
-1
votes
1
answer
110
views
Cloudformation linter regions unsupported
I'm setting up cfn-lint as a pre-commit hook using this guide: https://aws.amazon.com/blogs/mt/git-pre-commit-validation-of-aws-cloudformation-templates-with-cfn-lint/
My .pre-commit-config.yaml:
...
0
votes
1
answer
999
views
Getting `An error has occurred: FatalError: git failed.` when running pre-commit in GitLab pipeline
I'm trying to run the pre-commit tool in a GitLab pipeline. I use a custom-built Python image that has git installed in the pipeline job. I install pre-commit at the start of the job using a pip ...
-1
votes
1
answer
391
views
pre-commit fails with ModuleNotFoundError: No module named 'yaml'
I am using pre-commit. In one of the hooks, I use a python script that imports the yaml library.
However, when I try to commit something, I get the following error on this hook :
ModuleNotFoundError: ...
1
vote
1
answer
217
views
Pre-commit finds local hooks even after deleting the hooks directory and clearing the cache
I am using pre-commit to manage local hooks for my repository. Initially, I added a local repository containing my hooks and configured the .pre-commit-config.yaml file to reference these hooks. It ...