Add pre-commit hooks
This will ensure that there is standard linting applied to files in the repository. It assists in avoiding conflicts due to different contributers' IDEs. It is recommended that contributers run the following: `pre-commit install -t pre-push -t pre-commit`
This commit is contained in:
parent
6f170b1ad7
commit
108ad3c7c3
2 changed files with 39 additions and 0 deletions
13
.github/workflows/pre-commit.yml
vendored
Normal file
13
.github/workflows/pre-commit.yml
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
name: pre-commit
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
pre-commit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v3
|
||||
- uses: pre-commit/action@v3.0.0
|
26
.pre-commit-config.yaml
Normal file
26
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,26 @@
|
|||
repos:
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: "v2.7.1"
|
||||
hooks:
|
||||
- id: prettier
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.4.0
|
||||
hooks:
|
||||
- id: end-of-file-fixer
|
||||
stages: ["commit"]
|
||||
- id: trailing-whitespace
|
||||
stages: ["commit"]
|
||||
|
||||
- repo: https://github.com/Bahjat/pre-commit-golang
|
||||
rev: v1.0.2
|
||||
hooks:
|
||||
- id: go-fmt-import
|
||||
- id: go-vet
|
||||
- id: go-lint
|
||||
- id: go-unit-tests
|
||||
stages: ["push"]
|
||||
- id: gofumpt # requires github.com/mvdan/gofumpt
|
||||
- id: golangci-lint # requires github.com/golangci/golangci-lint
|
||||
args: [--config=.github/linters/.golangci.yml] # optional
|
||||
- id: go-ruleguard # requires https://github.com/quasilyte/go-ruleguard
|
||||
args: [rules/rules.go] # required
|
Loading…
Add table
Add a link
Reference in a new issue