Skip to content

Commit

Permalink
chore: 添加 pre-commit 作为 lint 工具
Browse files Browse the repository at this point in the history
  • Loading branch information
dzpao committed Oct 17, 2020
1 parent 471d42c commit 852ff79
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,15 @@ jobs:
- name: Build
run: go build -v .

- name: Lint
run: docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.23.3 golangci-lint run -v ./...
- name: Set up Python
uses: actions/setup-python@v2

- name: Routine style checks
uses: pre-commit/action@v2.0.0
env:
SKIP: golangci-lint

- name: GolangCI-Lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.31
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-case-conflict
- id: check-byte-order-marker
- id: check-added-large-files
- id: check-symlinks
- id: check-executables-have-shebangs
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- id: check-merge-conflict
- id: detect-private-key
- id: check-yaml
- id: check-json
- id: pretty-format-json
args: [--no-sort-keys]
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.3.5
hooks:
- id: go-fmt
- id: go-vet
- id: go-build
- id: golangci-lint
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
</a>
<a href="https://goreportcard.com/report/github.com/mudclient/go-mud">
<img alt="Go Report" src="https://goreportcard.com/badge/github.com/mudclient/go-mud">
</a>
<a href="https://github.com/pre-commit/pre-commit">
<img alt="pre-commit" src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit">
</a>
</p>
</p>
Expand Down

0 comments on commit 852ff79

Please sign in to comment.