diff --git a/backend/.golangci.yml b/backend/.golangci.yml index 8938c6f1c..a1cce819d 100644 --- a/backend/.golangci.yml +++ b/backend/.golangci.yml @@ -5,19 +5,12 @@ run: timeout: 5m issues-exit-code: 1 tests: true - skip-dirs: - - vendor/ - - .git/ - - tmp/ - skip-files: - - ".*\\.pb\\.go$" - - ".*\\.gen\\.go$" output: - format: colored-line-number + formats: + - format: colored-line-number print-issued-lines: true print-linter-name: true - uniq-by-line: true path-prefix: "" sort-results: true @@ -85,9 +78,8 @@ linters-settings: max: 8 # Magic numbers - gomnd: + mnd: settings: - mnd: checks: - argument - case @@ -257,9 +249,8 @@ linters: - durationcheck - errname - errorlint - - execinquery - exhaustive - - exportloopref + - copyloopvar - forbidigo - forcetypeassert - funlen @@ -278,7 +269,7 @@ linters: - gofumpt - goheader - goimports - - gomnd + - mnd - gomoddirectives - gomodguard - goprintffuncname @@ -309,7 +300,7 @@ linters: - sqlclosecheck - stylecheck - tagliatelle - - tenv + - usetesting - testableexamples - thelper - tparallel @@ -324,19 +315,22 @@ linters: disable: - depguard # We manage dependencies appropriately - - exhaustivestruct # Too restrictive - exhaustruct # Too restrictive - gochecksumtype # Not needed for this project - - goerr113 # Too restrictive for this project - - golint # Deprecated - - interfacer # Deprecated - - maligned # Deprecated + - err113 # Too restrictive for this project - nosnakecase # We use snake_case for JSON/DB tags - paralleltest # Not all tests need to be parallel - - scopelint # Deprecated - testpackage # Not required for this project issues: + exclude-dirs: + - vendor/ + - .git/ + - tmp/ + exclude-files: + - ".*\\.pb\\.go$" + - ".*\\.gen\\.go$" + uniq-by-line: true exclude-rules: # Exclude some linters from running on tests files. - path: _test\.go @@ -366,7 +360,7 @@ issues: # Exclude magic number issues in tests and main files - path: "(main|_test)\\.go" linters: - - gomnd + - mnd exclude-use-default: false max-issues-per-linter: 0 diff --git a/backend/main_test.go b/backend/main_test.go index d5a85a860..75e4660a4 100644 --- a/backend/main_test.go +++ b/backend/main_test.go @@ -7,10 +7,8 @@ import ( "encoding/base64" "encoding/json" "fmt" - "net/http" "net/http/httptest" "os" - "strings" "testing" "time" diff --git a/backend/notes_test.go b/backend/notes_test.go index 42cfad8cf..3fd82a284 100644 --- a/backend/notes_test.go +++ b/backend/notes_test.go @@ -4,14 +4,15 @@ import ( "bytes" "context" "crypto/rand" - "encoding/base64" "encoding/json" + "fmt" "net/http/httptest" "testing" "time" "github.com/gofiber/fiber/v2" "github.com/google/uuid" + "github.com/jackc/pgx/v5/pgxpool" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" diff --git a/backend/security_test.go b/backend/security_test.go index 9de4d95c9..26a3e18a5 100644 --- a/backend/security_test.go +++ b/backend/security_test.go @@ -2,7 +2,6 @@ package main import ( "bytes" - "context" "crypto/rand" "encoding/json" "fmt"