mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
ci: Add pre-commit hook to catch issues locally
The Git hooks force the developers to satisty certain rules before commiting changes(locally). Following checks will be run before allowing developers to commit changes: 1. Check if the commit message has a valid sign-off. 2. Catch gofmt issues, if any. 3. Verify syntax of yaml and json files.(if present) 4. Makes sure that files end in a new line. 5. Trims trailing whitespace. 6. Run commitlint check on the commit message. The developers will not be allowed to commit changes without satisfying the above mentioned rules; This will inturn help in avoiding failures on CI. Signed-off-by: Yug <yuggupta27@gmail.com>
This commit is contained in:
parent
27d2cc644d
commit
6287f6c6ec
35
.pre-commit-config.yaml
Normal file
35
.pre-commit-config.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
repos:
|
||||
|
||||
# Check if the commit message has a valid sign-off.
|
||||
- repo: https://github.com/gklein/check_signoff
|
||||
rev: v1.0.5
|
||||
hooks:
|
||||
- id: check-signoff
|
||||
|
||||
# Catch gofmt issues, if any.
|
||||
- repo: git://github.com/dnephin/pre-commit-golang
|
||||
rev: v0.3.5
|
||||
hooks:
|
||||
- id: go-fmt
|
||||
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v2.5.0
|
||||
hooks:
|
||||
# Verify syntax of yaml and json files.
|
||||
- id: check-json
|
||||
- id: check-yaml
|
||||
args: [--multi]
|
||||
|
||||
# Makes sure that files end in a new line.
|
||||
- id: end-of-file-fixer
|
||||
|
||||
# Trims trailing whitespace.
|
||||
- id: trailing-whitespace
|
||||
|
||||
# Run commitlint check on the commit message.
|
||||
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
|
||||
rev: v2.2.0
|
||||
hooks:
|
||||
- id: commitlint
|
||||
stages: [commit-msg]
|
Loading…
Reference in New Issue
Block a user