Переглянути джерело

New and improved linting capabilities.

Sacha Ligthert 1 рік тому
батько
коміт
feced4cd7f
2 змінених файлів з 28 додано та 6 видалено
  1. 16 6
      .pre-commit-config.yaml
  2. 12 0
      Taskfile.dist.yaml

+ 16 - 6
.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

+ 12 - 0
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