Skip to content

Commit

Permalink
Update Linting and project automation for better development.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisWiegman committed Sep 4, 2023
1 parent 3b938ec commit 228840d
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 37 deletions.
40 changes: 14 additions & 26 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
linters-settings:
depguard:
list-type: denylist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
dupl:
threshold: 100
funlen:
Expand All @@ -30,7 +22,7 @@ linters-settings:
gocyclo:
min-complexity: 15
goimports:
local-prefixes: github.com/golangci/golangci-lint
local-prefixes: github.com/ChrisWiegman/kana-cli
gomnd:
# don't include the "operation" and "assign"
checks:
Expand Down Expand Up @@ -97,23 +89,19 @@ linters:
- unused
- whitespace
- noctx

# don't enable:
# - asciicheck
# - depguard
# - scopelint
# - gochecknoglobals
# - gocognit
# - godot
# - godox
# - goerr113
# - interfacer
# - maligned
# - nestif
# - prealloc
# - testpackage
# - revive
# - wsl
- asciicheck
- godot
- godox
- prealloc
- bidichk
- containedctx
- contextcheck
- decorder
- predeclared
- reassign
- rowserrcheck
- usestdlibvars
- wastedassign

run:
timeout: 5m
69 changes: 69 additions & 0 deletions .vsdcode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Install",
"type": "shell",
"command": "make install",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "silent",
"revealProblems": "onProblem",
"panel": "dedicated",
"clear": true,
"showReuseMessage": false
},
"problemMatcher": []
},
{
"label": "Create Changelog Entry",
"type": "shell",
"command": "make change",
"presentation": {
"reveal": "always",
"panel": "dedicated",
"focus": true
},
"problemMatcher": []
},
{
"label": "Lint",
"type": "shell",
"command": "make lint",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "silent",
"revealProblems": "onProblem",
"panel": "dedicated",
"clear": true,
"showReuseMessage": false
},
"problemMatcher": []
},
{
"label": "Test",
"type": "shell",
"command": "make test",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always",
"revealProblems": "onProblem",
"panel": "dedicated",
"clear": true,
"showReuseMessage": false
},
"problemMatcher": []
}
]
}
16 changes: 5 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,11 @@ install:

.PHONY: lint
lint:
docker \
run \
-t \
--rm \
-v $(PWD):/app \
-w /app \
golangci/golangci-lint:latest \
golangci-lint \
run \
-v \
./...
@if [ ! -f $GOPATH/bin/gilangci-lint ]; then \
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest;\
fi
@golangci-lint \
run

.PHONY: snapshot
snapshot:
Expand Down

0 comments on commit 228840d

Please sign in to comment.