diff --git a/.golangci.yml b/.golangci.yml index e4d0cf1..69e5e6c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -9,7 +9,9 @@ run: modules-download-mode: readonly output: - format: tab + formats: + - format: tab + path: stdout issues: # This disables the included exclude-list in golangci-lint as that @@ -44,12 +46,12 @@ linters: - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true] - gofumpt # Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true] - goimports # Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true, auto-fix: true] - - gomnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false] - gosec # Inspects source code for security problems [fast: true, auto-fix: false] - gosimple # Linter for Go source code that specializes in simplifying a code [fast: true, auto-fix: false] - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: true, auto-fix: false] - ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false] - misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true] + - mnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false] - nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false] - nilerr # Finds the code that returns nil even if it checks that the error is not nil. [fast: false, auto-fix: false] - nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value. [fast: false, auto-fix: false] @@ -75,9 +77,7 @@ linters-settings: min-complexity: 15 gomnd: - settings: - mnd: - ignored-functions: 'strconv.(?:Format|Parse)\B+' + ignored-functions: 'strconv.(?:Format|Parse)\B+' revive: rules: diff --git a/pkg/api/transaction.go b/pkg/api/transaction.go index 5fb5053..7d9b781 100644 --- a/pkg/api/transaction.go +++ b/pkg/api/transaction.go @@ -196,7 +196,7 @@ func (a apiServer) handleTransactionJSONPatch(txID uuid.UUID, w http.ResponseWri return } - if reqBody.Len() < 2 { //nolint:gomnd + if reqBody.Len() < 2 { //nolint:mnd w.WriteHeader(http.StatusNoContent) return } diff --git a/pkg/database/constants.go b/pkg/database/constants.go index 49ddfde..50930bc 100644 --- a/pkg/database/constants.go +++ b/pkg/database/constants.go @@ -16,7 +16,7 @@ var ( UnallocatedMoney = makeConstAcctID(1) // StartingBalance is a category UUID which is automatically created // and hidden during database migration and used in frontend as constant - StartingBalance = makeConstAcctID(2) //nolint:gomnd + StartingBalance = makeConstAcctID(2) //nolint:mnd invalidAcc = makeConstAcctID(math.MaxUint32) diff --git a/pkg/database/database.go b/pkg/database/database.go index eb9531b..982d225 100644 --- a/pkg/database/database.go +++ b/pkg/database/database.go @@ -187,7 +187,7 @@ func (c *Client) ListAccountBalances(showHidden bool) (a []AccountBalance, err e if v != nil { // Fix database doing e-15 stuff by rounding to full cents - ab.Balance = math.Round(*v*100) / 100 //nolint:gomnd + ab.Balance = math.Round(*v*100) / 100 //nolint:mnd } a = append(a, ab) @@ -473,7 +473,7 @@ func (c *Client) UpdateTransaction(txID uuid.UUID, tx Transaction) (err error) { var oldTX Transaction if err := db.First(&oldTX, "id = ?", txID).Error; err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { - return backoff.NewErrCannotRetry(fmt.Errorf("fetching old transaction: %w", err)) //nolint:wrapcheck + return backoff.NewErrCannotRetry(fmt.Errorf("fetching old transaction: %w", err)) } return fmt.Errorf("fetching old transaction: %w", err) } diff --git a/pkg/database/logger.go b/pkg/database/logger.go index f693516..1691f74 100644 --- a/pkg/database/logger.go +++ b/pkg/database/logger.go @@ -10,5 +10,5 @@ type ( ) func (l loggerWriter) Printf(format string, data ...any) { - fmt.Fprintf(l.Writer, format, data...) + fmt.Fprintf(l.Writer, format, data...) //nolint:errcheck }