80 lines
1.8 KiB
YAML
80 lines
1.8 KiB
YAML
|
|
# Pre-commit hooks configuration
|
||
|
|
# Install: pip install pre-commit && pre-commit install
|
||
|
|
# Run: pre-commit run --all-files
|
||
|
|
|
||
|
|
repos:
|
||
|
|
# Go formatting
|
||
|
|
- repo: local
|
||
|
|
hooks:
|
||
|
|
- id: go-fmt
|
||
|
|
name: go fmt
|
||
|
|
entry: go fmt ./...
|
||
|
|
language: system
|
||
|
|
types: [go]
|
||
|
|
pass_filenames: false
|
||
|
|
|
||
|
|
- id: go-imports
|
||
|
|
name: go imports
|
||
|
|
entry: goimports -w .
|
||
|
|
language: system
|
||
|
|
types: [go]
|
||
|
|
pass_filenames: false
|
||
|
|
|
||
|
|
- id: go-mod-tidy
|
||
|
|
name: go mod tidy
|
||
|
|
entry: go mod tidy
|
||
|
|
language: system
|
||
|
|
types: [go]
|
||
|
|
pass_filenames: false
|
||
|
|
|
||
|
|
# Go linting
|
||
|
|
- repo: https://github.com/golangci/golangci-lint
|
||
|
|
rev: v1.56.0
|
||
|
|
hooks:
|
||
|
|
- id: golangci-lint
|
||
|
|
args: [--fast]
|
||
|
|
|
||
|
|
# General file checks
|
||
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||
|
|
rev: v4.5.0
|
||
|
|
hooks:
|
||
|
|
- id: trailing-whitespace
|
||
|
|
- id: end-of-file-fixer
|
||
|
|
- id: check-yaml
|
||
|
|
- id: check-json
|
||
|
|
- id: check-toml
|
||
|
|
- id: check-merge-conflict
|
||
|
|
- id: detect-private-key
|
||
|
|
- id: detect-aws-credentials
|
||
|
|
- id: mixed-line-ending
|
||
|
|
args: [--fix=lf]
|
||
|
|
|
||
|
|
# Prettier for frontend
|
||
|
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||
|
|
rev: v3.1.0
|
||
|
|
hooks:
|
||
|
|
- id: prettier
|
||
|
|
types: [typescript, json, yaml, markdown, css, html]
|
||
|
|
exclude: ^web/node_modules/
|
||
|
|
|
||
|
|
# Secret detection
|
||
|
|
- repo: https://github.com/truffleHQ/truffleHog
|
||
|
|
rev: v3.70.0
|
||
|
|
hooks:
|
||
|
|
- id: truffleHog
|
||
|
|
args: [--no-verify]
|
||
|
|
|
||
|
|
# Spell check
|
||
|
|
- repo: https://github.com/crateci/typos
|
||
|
|
rev: v1.18.0
|
||
|
|
hooks:
|
||
|
|
- id: typos
|
||
|
|
args: [--config, .typos.toml]
|
||
|
|
|
||
|
|
# Markdown linting
|
||
|
|
- repo: https://github.com/igorshubovych/markdownlint-cli
|
||
|
|
rev: v0.39.0
|
||
|
|
hooks:
|
||
|
|
- id: markdownlint
|
||
|
|
args: [--fix]
|
||
|
|
exclude: ^web/node_modules/
|