Skip to content

Commit

Permalink
Trying out pre commit hooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
mhutchinson committed May 20, 2024
1 parent e7e4d72 commit d48b62f
Showing 1 changed file with 122 additions and 0 deletions.
122 changes: 122 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
repos:
# ==========================================================================
# Golang Pre-Commit Hooks | https://github.com/tekwizely/pre-commit-golang
#
# !! ALL Hooks enabled by default - Comment out hooks you are not using
#
# Visit the project home page to learn more about the available Hooks,
# including useful arguments you might want to pass into them.
#
# NOTE: When passing options to hooks, if your options contain a reference
# to an existing file, then you will need to use a trailing '--'
# argument to separate the hook options from the modified-file list
# that Pre-Commit passes into the hook.
# For repo-based hooks, '--' is not needed.
#
# NOTE: You can pass environment variables to hooks using args with the
# following format:
#
# --hook:env:NAME=VALUE
#
# Consider adding aliases to longer-named hooks for easier CLI usage.
# ==========================================================================
- repo: https://github.com/tekwizely/pre-commit-golang
rev: master
hooks:
#
# Go Build
#
- id: go-build-mod
- id: go-build-pkg
- id: go-build-repo-mod
- id: go-build-repo-pkg
#
# Go Mod Tidy
#
- id: go-mod-tidy
- id: go-mod-tidy-repo
#
# Go Test
#
- id: go-test-mod
- id: go-test-pkg
- id: go-test-repo-mod
- id: go-test-repo-pkg
#
# Go Vet
#
- id: go-vet
- id: go-vet-mod
- id: go-vet-pkg
- id: go-vet-repo-mod
- id: go-vet-repo-pkg
#
# Revive
#
- id: go-revive
- id: go-revive-mod
- id: go-revive-repo-mod
#
# GoSec
#
- id: go-sec-mod
- id: go-sec-pkg
- id: go-sec-repo-mod
- id: go-sec-repo-pkg
#
# StaticCheck
#
- id: go-staticcheck-mod
- id: go-staticcheck-pkg
- id: go-staticcheck-repo-mod
- id: go-staticcheck-repo-pkg
#
# StructSlop
#
- id: go-structslop-mod
- id: go-structslop-pkg
- id: go-structslop-repo-mod
- id: go-structslop-repo-pkg
#
# Formatters
#
- id: go-fmt
- id: go-fmt-repo
- id: go-fumpt # replaces go-fmt
- id: go-fumpt-repo # replaces go-fmt-repo
- id: go-imports # replaces go-fmt
- id: go-imports-repo # replaces go-fmt-repo
- id: go-returns # replaces go-imports & go-fmt
- id: go-returns-repo # replaces go-imports-repo & go-fmt-repo
#
# Style Checkers
#
- id: go-lint
- id: go-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
- id: golangci-lint-mod
- id: golangci-lint-pkg
- id: golangci-lint-repo-mod
- id: golangci-lint-repo-pkg
#
# Invoking Custom Go Tools
# - Configured *entirely* through the `args` attribute, ie:
# args: [ go, test, ./... ]
# - Use arg `--hook:error-on-output` to indicate that any output from the tool
# should be treated as an error.
# - Use the `name` attribute to provide better messaging when the hook runs
# - Use the `alias` attribute to be able to invoke your hook via `pre-commit run`
#
- id: my-cmd
- id: my-cmd-mod
- id: my-cmd-pkg
- id: my-cmd-repo
- id: my-cmd-repo-mod
- id: my-cmd-repo-pkg

0 comments on commit d48b62f

Please sign in to comment.