1
0
mirror of https://github.com/rclone/rclone.git synced 2025-10-06 05:47:10 +02:00

build: update golangci-lint configuration

This commit is contained in:
albertony
2025-08-19 15:03:56 +02:00
committed by Nick Craig-Wood
parent ae5cc1ab37
commit 9e4fe18830

View File

@@ -1,24 +1,29 @@
version: "2" version: "2"
linters: linters:
# Configure the linter set. To avoid unexpected results the implicit default
# set is ignored and all the ones to use are explicitly enabled.
default: none default: none
enable: enable:
# Default
- errcheck - errcheck
- gocritic
- govet - govet
- ineffassign - ineffassign
- misspell
- revive
- staticcheck - staticcheck
- unconvert
- unused - unused
#- prealloc # Additional
- gocritic
- misspell
#- prealloc # TODO
- revive
- unconvert
# Configure checks. Mostly using defaults but with some commented exceptions.
settings: settings:
staticcheck: staticcheck:
# Enable all default checks performed by the staticcheck stand-alone tool # With staticcheck there is only one setting, so to extend the implicit
# (see https://staticcheck.io/docs/configuration/options/#checks), with # default value it must be explicitly included.
# some exceptions/additions (commented).
checks: checks:
# Default
- all - all
- -ST1000 - -ST1000
- -ST1003 - -ST1003
@@ -26,22 +31,24 @@ linters:
- -ST1020 - -ST1020
- -ST1021 - -ST1021
- -ST1022 - -ST1022
- -ST1023 # Not enabled by default # Disable quickfix checks
- -QF*
gocritic: gocritic:
# Enable all default checks with some exceptions/additions (commented). # With gocritic there are different settings, but since enabled-checks
# Cannot use both enabled-checks and disabled-checks, so must specify all # and disabled-checks cannot both be set, for full customization the
# to be used. # alternative is to disable all defaults and explicitly enable the ones
# to use.
disable-all: true disable-all: true
enabled-checks: enabled-checks:
#- appendAssign # Enabled by default #- appendAssign # Skip default
- argOrder - argOrder
- assignOp - assignOp
- badCall - badCall
- badCond - badCond
#- captLocal # Enabled by default #- captLocal # Skip default
- caseOrder - caseOrder
- codegenComment - codegenComment
#- commentFormatting # Enabled by default #- commentFormatting # Skip default
- defaultCaseOrder - defaultCaseOrder
- deprecatedComment - deprecatedComment
- dupArg - dupArg
@@ -49,16 +56,16 @@ linters:
- dupCase - dupCase
- dupSubExpr - dupSubExpr
- elseif - elseif
#- exitAfterDefer # Enabled by default #- exitAfterDefer # Skip default
- flagDeref - flagDeref
- flagName - flagName
#- ifElseChain # Enabled by default #- ifElseChain # Skip default
- mapKey - mapKey
- newDeref - newDeref
- offBy1 - offBy1
- regexpMust - regexpMust
- ruleguard # Not enabled by default - ruleguard # Enable additional check that are not enabled by default
#- singleCaseSwitch # Enabled by default #- singleCaseSwitch # Skip default
- sloppyLen - sloppyLen
- sloppyTypeAssert - sloppyTypeAssert
- switchTrue - switchTrue
@@ -72,8 +79,10 @@ linters:
ruleguard: ruleguard:
rules: ${base-path}/bin/rules.go rules: ${base-path}/bin/rules.go
revive: revive:
# Disable some of the default rules which produces a lot of issues currently. # With revive there is in reality only one setting, and when at least one
# Since setting any rule disable all others, we must re-enable them. # rule are specified then only these rules will be considered, defaults
# and all others are then implicitly disabled, so must explicitly enable
# all rules to be used.
rules: rules:
- name: blank-imports - name: blank-imports
disabled: false disabled: false
@@ -83,8 +92,8 @@ linters:
disabled: false disabled: false
- name: dot-imports - name: dot-imports
disabled: false disabled: false
- name: empty-block #- name: empty-block # Skip default
disabled: true # disabled: true
- name: error-naming - name: error-naming
disabled: false disabled: false
- name: error-return - name: error-return
@@ -95,10 +104,8 @@ linters:
disabled: false disabled: false
- name: exported - name: exported
disabled: false disabled: false
- name: if-return #- name: increment-decrement # Skip default
disabled: true # disabled: true
- name: increment-decrement
disabled: true
- name: indent-error-flow - name: indent-error-flow
disabled: false disabled: false
- name: package-comments - name: package-comments
@@ -107,38 +114,26 @@ linters:
disabled: false disabled: false
- name: receiver-naming - name: receiver-naming
disabled: false disabled: false
- name: redefines-builtin-id #- name: redefines-builtin-id # Skip default
disabled: true # disabled: true
- name: superfluous-else #- name: superfluous-else # Skip default
disabled: true # disabled: true
- name: time-naming - name: time-naming
disabled: false disabled: false
- name: unexported-return - name: unexported-return
disabled: false disabled: false
- name: unreachable-code #- name: unreachable-code # Skip default
disabled: true # disabled: true
- name: unused-parameter #- name: unused-parameter # Skip default
disabled: true # disabled: true
- name: var-declaration - name: var-declaration
disabled: false disabled: false
- name: var-naming - name: var-naming
disabled: false disabled: false
exclusions:
# Exclude sources that contain lines like `autogenerated file`,
# `code generated`, `do not edit`, etc. This is what golangci-lint v1 did,
# while in v2 the default is to strictly following the Go generated file
# convention.
generated: lax
rules:
- linters:
- staticcheck
text: 'SA1019: "github.com/rclone/rclone/cmd/serve/httplib" is deprecated'
formatters: formatters:
enable: enable:
- goimports - goimports
exclusions:
generated: lax
issues: issues:
# Maximum issues count per one linter. Set to 0 to disable. Default is 50. # Maximum issues count per one linter. Set to 0 to disable. Default is 50.