From feced4cd7fa69c3d69aa798d5e9c3d33505b89cf Mon Sep 17 00:00:00 2001 From: Sacha Ligthert Date: Wed, 5 Mar 2025 11:55:28 +0100 Subject: [PATCH] New and improved linting capabilities. --- .pre-commit-config.yaml | 22 ++++++++++++++++------ Taskfile.dist.yaml | 12 ++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2a788d6..6782cf4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,18 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 # this is optional, use `pre-commit autoupdate` to get the latest rev! +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 hooks: - - id: check-yaml - - id: end-of-file-fixer - - id: trailing-whitespace - + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files +- repo: https://github.com/dnephin/pre-commit-golang + rev: v0.5.1 + hooks: + - id: go-fmt + - id: go-imports + - id: no-go-testing + - id: golangci-lint + - id: go-unit-tests diff --git a/Taskfile.dist.yaml b/Taskfile.dist.yaml index ee7e39b..d9a0932 100644 --- a/Taskfile.dist.yaml +++ b/Taskfile.dist.yaml @@ -14,3 +14,15 @@ tasks: - rm {{.BUILD_DIR}}/* || true - go tool dist list | grep -v android | grep -v ios | grep -v wasip1 | awk -F '/' '{printf "echo Compiling %s/%s; env CGO_ENABLED=1 GOOS=%s GOARCH=%s go build -o {{.BUILD_DIR}}/{{.APP}}.%s-%s\n",$1,$2,$1,$2,$1,$2 }' | sh - for i in `ls {{.BUILD_DIR}}/*windows*`; do mv -v $i $i.exe; done + lint: + cmds: + - golangci-lint run + precommit: + cmds: + - pre-commit autoupdate + - pre-commit run --all + silent: true + gource: + cmds: + - gource --auto-skip-seconds 1 --key -r 60 + silent: true