mirror of
https://github.com/daeuniverse/dae.git
synced 2024-12-23 01:04:40 +07:00
chore: add pre-commit hook (#59)
* chore: add pre-commit-hook * doc(contribute): add pre-commit setup guide * doc(contribute.md): add pre-commit doc url * chore(pre-commit): add gofmt custom hook * fix: fix syntax * chore(pre-commit): rename gofmt as gofmt-fixer * chore(pre-commit): add config reference * chore(pre-commit): add golangci-lint
This commit is contained in:
parent
80ae760ebf
commit
064bf1ebbc
30
.pre-commit-config.yaml
Normal file
30
.pre-commit-config.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
# reference: https://verdantfox.com/blog/view/how-to-use-git-pre-commit-hooks-the-hard-way-and-the-easy-way
|
||||
---
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.4.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-json
|
||||
- id: check-yaml
|
||||
args:
|
||||
- --unsafe
|
||||
- id: double-quote-string-fixer
|
||||
- id: end-of-file-fixer
|
||||
- repo: https://github.com/golangci/golangci-lint
|
||||
rev: v1.52.2
|
||||
hooks:
|
||||
- id: golangci-lint
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: gofmt-fixer
|
||||
name: gofmt
|
||||
entry: gofmt -w .
|
||||
language: golang
|
||||
types: [go]
|
||||
# - id: check-x
|
||||
# name: Check X
|
||||
# entry: ./bin/check-x.sh
|
||||
# language: script
|
||||
# files: \.x$
|
@ -14,6 +14,17 @@ Before you start any Pull Request, `it is recommended that you create an issue`
|
||||
|
||||
`Pull Requests` can only be merged once all status checks are green.
|
||||
|
||||
### Pre-commit Hook
|
||||
|
||||
This repo uses [pre-commit hook](https://github.com/pre-commit/pre-commit-hooks) to apply linting check prior to writing commit to local git history. To set up pre-commit, do the followings:
|
||||
|
||||
```bash
|
||||
# install pre-commit
|
||||
pip3 install pre-commit
|
||||
# install pre-commit hooks
|
||||
pre-commit install
|
||||
```
|
||||
|
||||
### How to make a clean pull request
|
||||
|
||||
- Create a `personal fork` of the project on Github.
|
||||
|
Loading…
Reference in New Issue
Block a user