Skip to content

Commit

Permalink
use config file
Browse files Browse the repository at this point in the history
Signed-off-by: SammyOina <sammyoina@gmail.com>
  • Loading branch information
SammyOina committed Aug 9, 2023
1 parent a03d972 commit dcacf51
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 44 deletions.
27 changes: 27 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
run:
timeout: 3m
linters-settings:
gocritic:
enabled-checks:
- captLocal
- dupImport
- singleCaseSwitch
disabled-checks:
- appendAssign
enabled-tags:
- diagnostic
disabled-tags:
- performance
- style
- experimental
- opinionated
linters:
disable-all: true
enable:
- gocritic
- gosimple
- errcheck
- govet
- unused
- goconst
- godot
60 changes: 19 additions & 41 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ blocks:
commands:
- 'curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.53.3'
- cache store linter ./bin/golangci-lint
- name: Setup GoCritic
commands:
- 'go install -v github.com/go-critic/go-critic/cmd/gocritic@latest'
secrets:
- name: CODECOV_TOKEN
- name: Check Generated Protocol Buffer Files
Expand Down Expand Up @@ -104,8 +101,7 @@ blocks:
commands:
- cd users
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test Users
commands:
- cd users
Expand Down Expand Up @@ -139,8 +135,7 @@ blocks:
commands:
- cd things
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test Things
commands:
- cd things
Expand Down Expand Up @@ -174,8 +169,7 @@ blocks:
commands:
- cd coap
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test CoAP
commands:
- cd coap
Expand Down Expand Up @@ -209,8 +203,7 @@ blocks:
commands:
- cd http
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test HTTP
commands:
- cd http
Expand Down Expand Up @@ -245,8 +238,7 @@ blocks:
commands:
- cd mqtt
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test MQTT
commands:
- cd mqtt
Expand Down Expand Up @@ -281,8 +273,7 @@ blocks:
commands:
- cd ws
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test WS
commands:
- cd ws
Expand Down Expand Up @@ -317,8 +308,7 @@ blocks:
commands:
- cd bootstrap
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test Bootstrap
commands:
- cd bootstrap
Expand Down Expand Up @@ -353,8 +343,7 @@ blocks:
commands:
- cd certs
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test Certs
commands:
- cd certs
Expand Down Expand Up @@ -389,8 +378,7 @@ blocks:
commands:
- cd provision
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test Provision
commands:
- cd provision
Expand Down Expand Up @@ -425,8 +413,7 @@ blocks:
commands:
- cd twins
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test Twins
commands:
- cd twins
Expand Down Expand Up @@ -461,8 +448,7 @@ blocks:
commands:
- cd readers
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test Twins
commands:
- cd readers
Expand Down Expand Up @@ -501,8 +487,7 @@ blocks:
commands:
- cd consumers
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test Consumers
commands:
- cd consumers
Expand Down Expand Up @@ -542,8 +527,7 @@ blocks:
commands:
- cd cli
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test CLI
commands:
- cd cli
Expand Down Expand Up @@ -578,8 +562,7 @@ blocks:
commands:
- cd lora
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test LoRa
commands:
- cd lora
Expand Down Expand Up @@ -614,8 +597,7 @@ blocks:
commands:
- cd opcua
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test OPC-UA
commands:
- cd opcua
Expand Down Expand Up @@ -650,8 +632,7 @@ blocks:
commands:
- cd internal
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test Internal
commands:
- cd internal
Expand All @@ -671,8 +652,7 @@ blocks:
commands:
- cd logger
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test Logger
commands:
- cd logger
Expand All @@ -692,8 +672,7 @@ blocks:
commands:
- cd pkg
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test PKG
commands:
- cd pkg
Expand All @@ -713,8 +692,7 @@ blocks:
commands:
- cd tools
- cache restore linter
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
- 'gocritic check -enable=dupImport ./...'
- './bin/golangci-lint run'
- name: Test Tools
commands:
- cd tools
Expand Down
4 changes: 1 addition & 3 deletions scripts/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ setup_mf() {
setup_lint() {
# binary will be $(go env GOBIN)/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOBIN) $GOLANGCI_LINT_VERSION
go install -v github.com/go-critic/go-critic/cmd/gocritic@latest
}

setup() {
Expand All @@ -86,8 +85,7 @@ setup() {

run_test() {
echo "Running lint..."
golangci-lint run --no-config --disable-all --enable gosimple --enable errcheck --enable govet --enable unused --enable goconst --enable godot --timeout 3m
gocritic check -enable=dupImport ./...
golangci-lint run
echo "Running tests..."
echo "" > coverage.txt
for d in $(go list ./... | grep -v 'vendor\|cmd'); do
Expand Down

0 comments on commit dcacf51

Please sign in to comment.