Questions tagged [pre-commit-hook]

In the context of Software Configuration Management (SCM), a pre-commit hook is a command run just before a commit is performed.

Typically, this hook is used to protect against commits that are disallowed due to content or location (e.g. to forbid empty commit log messages).

Usually, i.e. with SVN, if the pre-commit hook program returns a nonzero exit value, the commit is aborted, the commit transaction is removed, and anything printed to stderr is marshalled back to the client.

Related tags

  • Tag may be used in combination with this tag for git specific pre-commit hooks
  • Tag may be used in combination with this tag for SVN specific pre-commit hooks
626 questions
-2
votes
1 answer

run pre-commit quit format a documents

I have a problem when executing the pre-commit in a python project, although my files have the correct format, it shows an error and removes the correct format. Could you help me find out what is causing…
Lana
  • 117
  • 5
-2
votes
2 answers

Force extension for given file type in a hook

How can I configure a pre-commit hook which will force yaml/yml files to have yaml extension. Pass: lol.yaml Fail: lol.yml
Opal
  • 81,889
  • 28
  • 189
  • 210
-2
votes
1 answer

husky precommit want to developer to force make relivant changes in two similar file otherwise commit msg thow error

if you want when developer changed one file of the project and you want to force to make relevant changes in to another "similar " file with the help of husky and shellScript..
-2
votes
1 answer

git pre-commit error : Check filenames : .git/hooks/pre-commit; line 25; syntax error : unexpected end of file

Below is hook code I am using for pre-commit in VS 2019. I want to restrict some files being committed always. Trying with string.exe. But getting error. Help needed on this. #!/bin/sh #!/usr/bin/env bash listchange=$(git diff --name-only) echo…
-2
votes
1 answer

Pre Commit Run Failing

Whenever I am trying to run pre-commit run is failing.I am getting errors in flake8,black,end of file,Validate filenames ,and trailling white spaces .My python code is from __future__ import annotations def hopkinsons_law( …
R3hankhan
  • 58
  • 1
  • 10
-2
votes
2 answers

Trying to implement trufflehog in my pre-commit however, receiving an entry point error- does any have an example pre-commit config file?

I am trying to use Truffle hog credentials scanner every time I run a commit. Below is both my .precommit config file and error in the terminal. repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3.2.0 hooks: - id:…
JnooriRS
  • 103
  • 11
-2
votes
1 answer

pre-commit --comment-style regex

I have a precommit file which checks for commented line format in .cfg files. The current comment style is a semicolon, so this will fail if a pound sign is used for file comments. Can RegEx somehow be used to match multiple comment patterns? For…
GreNIX
  • 47
  • 1
  • 6
-2
votes
1 answer

can't apply partial context to unlabeled file `pre-commit'

I am getting this error when trying to modify the SELinux label on a pre-commit hook. My first try was chcon -t httpd_exec_t pre-commit Then I tried by adding the full context to the command chcon -u unconfined_u -r object_r -t httpd_exec_t…
Ricardo Alfaro
  • 110
  • 1
  • 10
-2
votes
1 answer

How to link svn hooks to checked out repository

How to link svn hooks to checked out repository?. I have checked out a sample SVN repo. And with SVN-admin option, I created svn repo(?), which has sample hooks . But how do I link my newly written script to work on local checked-out repo?. Its…
user1587504
  • 764
  • 1
  • 10
  • 25
-3
votes
3 answers

Git commit issue after updating Mac OS

I am getting the below commit error in my Mac OS after updating to the latest version. Tried restarting VS Code and also tried to use terminal and same error. Until git add . step it works fine. Only the commit command is not working fine. What…
Krishnamurthy
  • 139
  • 2
  • 8
-4
votes
1 answer

Can I run "go mod tidy" recursively?

I have a Go repo which is like this: sdkpackage go.mod _examples one go.mod two go.mod three go.mod I know multiple modules in a single repository are not recommended for most use cases (from wiki), but my scenario fits under one of…
Ed Harrod
  • 3,423
  • 4
  • 32
  • 53
1 2 3
41
42