-
Notifications
You must be signed in to change notification settings - Fork 9
/
.pre-commit-config.yaml
88 lines (85 loc) · 3.29 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# ==============================================================================
# Pre-commit hook configuration
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
# ==============================================================================
repos:
# ==========================================================================
# Built-in hooks
# ==========================================================================
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer
exclude: 'PKGBUILD'
- id: trailing-whitespace
# ==========================================================================
# Golang Pre-Commit Hooks | https://github.com/tekwizely/pre-commit-golang
#
# Visit the project home page to learn more about the available Hooks,
# including useful arguments you might want to pass into them.
#
# Staged Files:
# Unless configured to "always_run" (see below), hooks ONLY run when
# matching file types (usually *.go) are staged.
#
# File-Based Hooks:
# By default, hooks run against matching staged files individually.
# Currently, file-based hooks DO NOT accept user-args.
#
# Repo-Based Hooks:
# Hooks named '*-repo-*' only run once (if any matching files are staged).
# They are NOT provided the list of staged files.
# Generally, repo-based hooks DO accept user-args.
#
# Repo-Hook Suffixes:
# *-repo : Hook runs with no target argument
# (good for adding custom arguments / targets)
# *-repo-dir : Hook runs using './...' as target.
# *-repo-pkg : Hook runs using '$(go list)/...' as target.
#
# Fix Suffix:
# Hooks named `*-fix` fix (modify) files directly, when possible.
#
# Aliases:
# Consider adding aliases to longer-named hooks for easier CLI usage.
#
# Useful Hook Parameters:
# - id: hook-id
# alias: hook-alias # Create an alias
# args: [arg1, arg2, ...] # Pass arguments
# always_run: true # Run even if no matching files staged
# ==========================================================================
- repo: https://github.com/tekwizely/pre-commit-golang
rev: v1.0.0-rc.1
hooks:
- id: go-build-mod
alias: build
- id: go-test-mod
alias: test
- id: go-vet-mod
alias: vet
- id: go-sec-mod
alias: sec
args: ['-exclude=G204']
# - id: go-fmt
# - id: go-imports # replaces go-fmt
- id: go-returns # replaces go-imports & go-fmt
alias: fmt
args: [-d=false, -w]
- id: go-lint
alias: lint
- id: go-critic
alias: critic
#
# GolangCI-Lint
# - Fast Multi-Linter
# - Can be configured to replace MOST other hooks
# - Supports repo config file for configuration
# - https://github.com/golangci/golangci-lint
#
- id: golangci-lint-mod
alias: ci
args: ['-D=deadcode,unused', --fix]