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

Python pre-commit fails but does not make corrections

I'm using some pre-commit hooks and running into an error with python-import-sorter. I'm getting the error below: hookid: python-import-sorter Files were modified by this hook. Additional output: ERROR:…
TomNash
  • 3,147
  • 2
  • 21
  • 57
2
votes
1 answer

Using the python library "pre-commit", how can I add a git pre-commit hook that runs a single python file?

I am using this library to try and add a pre-commit hook to my project. It's a lot to take in and I don't think the pre-commit check I want needs the large scope most of their examples use. All I want to do, is run a single python file. Depending on…
Rosey
  • 739
  • 1
  • 12
  • 27
2
votes
0 answers

Getting error when running pre-commit run

I have installed and configured pre-commit. When running pre-commit run I get this INFO followed by an error message: [INFO] Initializing environment for C:\Users\username\projectname. [INFO] Installing environment for…
2
votes
1 answer

flake8 e999 on using fstrings in python2 (with future_fstrings)

I'm using fstrings in python2 after pip install future-fstrings like the following: # -*- coding: future_fstrings -*- class A(object): def __init__(self, **kw): self.__dict__.update(**kw) print (f'{self.a}') print…
CIsForCookies
  • 12,097
  • 11
  • 59
  • 124
2
votes
1 answer

autopep8 doesn't seem to be finding config file?

According to autopep8's documentation (here: https://github.com/hhatto/autopep8#configuration ), if I place a file called "setup.cfg" in the root of my git repo, with something like [pycodestyle] ignore =…
user3534080
  • 1,201
  • 1
  • 14
  • 21
2
votes
1 answer

Pre-commit does not allow GPG code-signing?

We sign each commit with GPG2 for security purposes. Usually this involves a full-terminal-window "popup" asking you to enter a password after running git commit (the terminal screen is replaced with just the GPG message). However we have started…
Will Taylor
  • 1,994
  • 2
  • 23
  • 36
1
vote
1 answer

How can I resolve this error regarding dbt templater? Templater cannot be set in a .sqlfluff file in a subdirectory of the current working directory

I am trying to use dbt templater with pre-commit hooks, but I am constantly receiving this error message: Attempt to set templater to dbt failed. Using jinja templater. Templater cannot be set in a .sqlfluff file in a subdirectory of the current…
shrimpini
  • 41
  • 3
1
vote
0 answers

Configure pre-commit to install additional dependencies consumed from pyproject.toml

I'm in the process of onboarding an existing open source project on pre-commit. The list of dependencies is tracked in pyproject.toml. The pylint hook is raising an import error because additional_dependencies key is not populated. Can I populate it…
Liora Milbaum
  • 99
  • 1
  • 1
  • 7
1
vote
0 answers

pre-commit and maven gitflow plugin

I'm happily using pre-commit to force myself using feature branches with a hook which checks if I'm committing in main/develop branch. To support versioning etc etc I run mvn gitflow:release (see https://github.com/aleksandr-m/gitflow-maven-plugin)…
lrkwz
  • 6,105
  • 3
  • 36
  • 59
1
vote
1 answer

What is the meaning of . (dot, period) in additional_dependencies array of pre-commit config?

I came across the following .pre-commit-hooks.yaml here. It contains the following section: additional_dependencies: - . What is the meaning of the dot? Is it necessary? After solution I created PR to remove the unused . here.
trallnag
  • 2,041
  • 1
  • 17
  • 33
1
vote
1 answer

github_conf/branch_protection_rules.json keeps on showing up

I am using GitHub Codespaces and try to run pre-commit run --all-files on its terminal. I have pasted the pre-commit configuration below for reference. - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.4.0 hooks: - id:…
gue
  • 67
  • 8
1
vote
1 answer

What hook language should I use for local pre-commit hooks written in Python?

I’m working on a local pre-commit hook written in Python. At first, I saw this quote from the pre-commit documentation: python The hook repository must be installable via pip install . (usually by either setup.py or pyproject.toml). I made the…
Ginger Jesus
  • 95
  • 1
  • 2
  • 13
1
vote
1 answer

IntelliJ pre-commit.com integration

I'm using pre-commit hooks in my project. When I'm doing my commits from the command-line everything is great and the hooks are working but when I try to commit from the IDE it failed with the message: 0 file committed, 2 files failed to commit:…
lior.i
  • 573
  • 1
  • 7
  • 20
1
vote
1 answer

pyproject.toml : toml parser not available, reinstall with toml extra

I am configuring my pyproject.toml so that bandit excludes the test files but it gives me the error ERROR pyproject.toml : toml parser not available, reinstall with toml extra this is my pyproject.toml [tool.bandit] exclude_dirs = ["*/test/*"] tests…
1
vote
1 answer

commitizen: No commit found with range: 'origin/HEAD..HEAD'

I've recently started using commitizen in my day-to-day development, however I don't understand why I get the following error with the first commit to a new branch, ie: ...on current main branch... git checkout -b fix/my-new-branch ...make some…
Chris
  • 2,739
  • 4
  • 29
  • 57