Questions tagged [pre-commit]

Pre-commit is an action taken prior to committing your code into a version control system.

A pre-commit is an action that would be applied to source code before it is committed to the version control system. To utilize a pre-commit action you'll need to install a pre-commit hook into the repository. Pre-commit hooks are available in most commonly used version control systems such as SVN or git.

Some actions that could be achieved using pre-commit hooks:

  1. Fixing case issues in file names
  2. Validating file content, such as executing a linter or code convention checker.
  3. Preventing specific users from committing code

pre-commit is also the name of a framework for managing such hooks for git.

406 questions
0
votes
2 answers

Use same hook across all the repositories in the GitHub Organization

I have a pre-commit hook that I would like to apply to all my existing and new repositories in my GitHub Organization. That pre-commit hook is created for "enforcing the GitHub Branch naming policy" by referring this…
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

Running NArrange from SVN pre-commit hook

I am trying to execute NArrange from SVN pre-commit hook using following command: "C:\Fullpath\narrange-console.exe" "C:\SolutionDir\SolutionFile.sln" /b /t It returns with an Error: "The hook script returned an error: " Any one any at rescue?…
NileshChauhan
  • 5,469
  • 2
  • 29
  • 43
0
votes
0 answers

Error with pre-commit: No module named 'pwd', failes pylint(examples.code)

I'm a newbie to pre-commit. I'm trying to locally check a single python file I'd staged after I thought I'd had pre-commit installed on my PC (Windows 10) and properly installed in the directory. Here's what happens when I try to commit a file from…
ViennaMike
  • 2,207
  • 1
  • 24
  • 38
0
votes
0 answers

How do I solve the following git error: No such file or directory

I have done some updates to my React project and when I try to commit I get the following: > git -c diff.mnemonicprefix=false -c core.quotepath=false > --no-optional-locks commit -q -F C:\Users\USERNAME\AppData\Local\Temp\e3x0kha2.snk >…
CodingLittle
  • 1,761
  • 2
  • 17
  • 44
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

sonar QualityGate Should be Checked before SVN Commit-- How to achive this?

QualityGate Should be Checked before SVN Commit I have to check sonar quality gate before SVN commit, Quality gate should check before code commit into SVN repository only, Can you suugest any suitable aproach.
Pradeep
  • 1
  • 1
0
votes
1 answer

Git Pre-Commit Hook - checkout of branch does not work

I have a problem with a Git pre-commit hook. My use case is: When I am in a deatched head state I want to checkout the master branch before the commit is done. The checkout of the master branch needs to be done by an external tool. To reproduce…
aufda
  • 1
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
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
1 answer

Check code quality on CI server using Husky and/or Lint-Staged

In the Python world, it's common to use pre-commit, which provides a git commit hook, and then on your CI server you can run pre-commit run --all-files which will ignore the commit and run the linting tools on all files. This ensures that, for…
Migwell
  • 18,631
  • 21
  • 91
  • 160
0
votes
1 answer

Are there any pre-commit linters that can stop me from committing code with PySnooper decorators?

I use PySnooper library for debugging. It looks like this: import pysnooper @pysnooper.snoop() def number_to_bits(number): ... I don't want to commit such a code. This @pysnooper library is for debugging only. How to prevent it with pre-commit…
Max Block
  • 1,134
  • 3
  • 16
  • 23
0
votes
1 answer

Wildcard file ignore is not working in .talismanrc

I have these files in project root test.sql and test1.sql .talismanrc fileignoreconfig: - filename: '*.sql' checksum: 29a138ee50018bdc968f352d2a69fa09e17de38fcc400630bb04dd7019e768be # - filename: abc.sql # checksum:…