NOISSUE - Add linter config file and add duplicate import check (#1880)
* add duplicate import check Signed-off-by: SammyOina <sammyoina@gmail.com> * add for new CI Signed-off-by: SammyOina <sammyoina@gmail.com> * use config file Signed-off-by: SammyOina <sammyoina@gmail.com> * remove duplicate case Signed-off-by: SammyOina <sammyoina@gmail.com> --------- Signed-off-by: SammyOina <sammyoina@gmail.com>
This commit is contained in:
parent
5e8555444a
commit
91e3873a13
|
@ -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
|
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
|
|
@ -276,8 +276,7 @@ func encodeError(_ context.Context, err error, w http.ResponseWriter) {
|
|||
errors.Contains(err, apiutil.ErrBootstrapState),
|
||||
errors.Contains(err, apiutil.ErrLimitSize):
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
case errors.Contains(err, errors.ErrNotFound),
|
||||
errors.Contains(err, bootstrap.ErrThings):
|
||||
case errors.Contains(err, errors.ErrNotFound):
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
case errors.Contains(err, bootstrap.ErrExternalKey),
|
||||
errors.Contains(err, bootstrap.ErrExternalKeySecure),
|
||||
|
|
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue