Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOISSUE - Add linter config file and add duplicate import check #1880

Merged
merged 4 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
38 changes: 19 additions & 19 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +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'
- './bin/golangci-lint run'
- name: Test Users
commands:
- cd users
Expand Down Expand Up @@ -135,7 +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'
- './bin/golangci-lint run'
- name: Test Things
commands:
- cd things
Expand Down Expand Up @@ -169,7 +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'
- './bin/golangci-lint run'
- name: Test CoAP
commands:
- cd coap
Expand Down Expand Up @@ -203,7 +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'
- './bin/golangci-lint run'
- name: Test HTTP
commands:
- cd http
Expand Down Expand Up @@ -238,7 +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'
- './bin/golangci-lint run'
- name: Test MQTT
commands:
- cd mqtt
Expand Down Expand Up @@ -273,7 +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'
- './bin/golangci-lint run'
- name: Test WS
commands:
- cd ws
Expand Down Expand Up @@ -308,7 +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'
- './bin/golangci-lint run'
- name: Test Bootstrap
commands:
- cd bootstrap
Expand Down Expand Up @@ -343,7 +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'
- './bin/golangci-lint run'
- name: Test Certs
commands:
- cd certs
Expand Down Expand Up @@ -378,7 +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'
- './bin/golangci-lint run'
- name: Test Provision
commands:
- cd provision
Expand Down Expand Up @@ -413,7 +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'
- './bin/golangci-lint run'
- name: Test Twins
commands:
- cd twins
Expand Down Expand Up @@ -448,7 +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'
- './bin/golangci-lint run'
- name: Test Twins
commands:
- cd readers
Expand Down Expand Up @@ -487,7 +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'
- './bin/golangci-lint run'
- name: Test Consumers
commands:
- cd consumers
Expand Down Expand Up @@ -527,7 +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'
- './bin/golangci-lint run'
- name: Test CLI
commands:
- cd cli
Expand Down Expand Up @@ -562,7 +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'
- './bin/golangci-lint run'
- name: Test LoRa
commands:
- cd lora
Expand Down Expand Up @@ -597,7 +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'
- './bin/golangci-lint run'
- name: Test OPC-UA
commands:
- cd opcua
Expand Down Expand Up @@ -632,7 +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'
- './bin/golangci-lint run'
- name: Test Internal
commands:
- cd internal
Expand All @@ -652,7 +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'
- './bin/golangci-lint run'
- name: Test Logger
commands:
- cd logger
Expand All @@ -672,7 +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'
- './bin/golangci-lint run'
- name: Test PKG
commands:
- cd pkg
Expand All @@ -692,7 +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'
- './bin/golangci-lint run'
- name: Test Tools
commands:
- cd tools
Expand Down
3 changes: 1 addition & 2 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

SammyOina marked this conversation as resolved.
Show resolved Hide resolved
}

setup() {
Expand All @@ -86,7 +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
golangci-lint run
echo "Running tests..."
echo "" > coverage.txt
for d in $(go list ./... | grep -v 'vendor\|cmd'); do
Expand Down