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
0
votes
0 answers

pre-commit: run prettier on commit when JavaScript code and config are in a subdirectory

I've been researching option three of this document: My goal is to run prettier on commit. The thing is, the root directory of my project looks like this: root/ .git/ ... subdir/ directory_with_javascript/ …
Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356
0
votes
1 answer

Working directory when initialise the pre-commit envs

I'm using the pre-commit to manage my pre-commit and pre-push hooks. I have two hooks (mypy and pylint), and I need to install the requirements to the virtual-env. My directory structure: - project - .pre-commit-config.yaml - path - to …
Ori Levi
  • 3
  • 3
0
votes
2 answers

Solve python ValueError: max_workers must be <= 61 when running pre-commit?

I am using Django to develop an ERP and I want to use pre-commit with my project. I have installed pre-commit, black, flake8, flake8-black. and this is my .pre-commit-config.yaml file configurations content repos: - repo:…
Dhia Shalabi
  • 1,332
  • 1
  • 13
  • 29
0
votes
0 answers

Where are pre-commit hooks installed?

There is a tool called pre-commit (see pre-commit.com) that allows managing pre-commit hooks. When I installed the eslint hook using these instructions, and I run the hook, it complains eslint has no configuration file. However, when I run eslint…
dfrankow
  • 20,191
  • 41
  • 152
  • 214
0
votes
1 answer

Retrieve the output error from a github actions step

I am trying to build a GitHub workflow that performs simple pre-commit checks whenever a PR is created into a certain repository and triggers a message if some check has failed. The problem is that I want that message to be as specific as possible…
João Pacheco
  • 67
  • 2
  • 6
0
votes
0 answers

Pre-commit with mypy in git bash doesn't show where it failed

To make a long story short due to company policy I have to make a local copy on our bitbucket server of this repo: https://github.com/pre-commit/mirrors-mypy I have a python project with a .pre-commmit-config.yaml file that looks like this: repos: -…
mike_gundy123
  • 469
  • 5
  • 18
0
votes
1 answer

Entry command for pre-commit built-in hooks

I would like to run some of the built-in hooks available from the pre-commit package from the command line, not as hooks but just from the command line to spot clean files as necessary. For example, if I want to run black on an arbitrary file in my…
Kosmonaut
  • 128
  • 10
0
votes
1 answer

Using pre-commit.com, How can I fix go vet error "no Go files in"

Our project uses the go standards project layout. Also, I'm using the pre-commit-hooks from pre-commit.com. In this setup, go-vet complains: go vet...................................................................Failed - hook id: go-vet - exit…
Markus Grunwald
  • 133
  • 1
  • 10
0
votes
1 answer

using `git commit —no-verify` for pre-commit azure pipeline

I see that I can use pre-commit with pipelines, is there a way to set up the yaml file for azure pipeline to use git commit --no-verify when if fails for specific cases? or is there a way to troubleshoot the pipeline when the issue occurs? this is…
0
votes
0 answers

Installing hooks as pre-push instead of pre-commit

I have a pre-commit hook defined as follows in a pre-commit-config.yaml file located in the root of my repository - repos: - repo: https://gitlab.com/pycqa/flake8 rev: 3.7.9 hooks: - id: flake8 This works as expected and blocks any…
Ananda
  • 2,925
  • 5
  • 22
  • 45
0
votes
1 answer

How to use R styleR with pre-commit and renv

I have created a virtual environment with rvenv, so that I now have rvenv/ in my project root. I have also installed styler, and would like to have a pre-commit hook that will apply it to R code. From here:…
baxx
  • 3,956
  • 6
  • 37
  • 75
0
votes
0 answers

Unable to commit changes after running pre-commit hooks for django project

here is my pre-commit-config.yaml default_language_version: # force all unspecified python hooks to run python3 python: python3 fail_fast: true repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.3.0 hooks: - …
kefa mutuma
  • 41
  • 1
  • 7
0
votes
1 answer

how to let pre-commit only check the python codes you changed, not the whole file

I used pre-commit to check my python code style before I commit to git. It works very well. But now I am working on an old project, most of my work just modify several lines of the file. But pre-commit always ask me fix all the pep8 issues of the…
Gary Wang
  • 81
  • 1
  • 1
  • 4
0
votes
0 answers

trying to setup a pre-push hook using pre-commit

I am trying to set up a pre-push hook using pre-commit https://pre-commit.com/ when i make a pre-commit hook it works fine like before commit all the checks work but in case of push no hook runs This is how my .pre-commit-config-yaml looks like in…
Origin
  • 1,182
  • 1
  • 10
  • 25
-1
votes
1 answer

precommit: running a linter that only takes one filename at a time

We have a linter that runs with xqlint lint target_file but doesn't seem to support multiple filenames. Is there a way in precommit to run against each file separately, without resorting to entry: bash -c "for $f in $@; do xqlint lint $f;…
David McKee
  • 170
  • 8