Lint: Update linter config, fix linter errors
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
36359bdcb8
commit
668a9960b8
5 changed files with 10 additions and 10 deletions
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue