diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml index 65435055ef02..b36b90983c79 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/post-release.yml @@ -40,11 +40,10 @@ jobs: token: ${{ secrets.GOLANGCI_LINT_TOKEN }} branch-suffix: timestamp title: "docs: update documentation" - team-reviewers: golangci/team delete-branch: true - update-assets: - name: "Update assets" + update-gha-assets: + name: "Update GitHub Action assets" runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.GOLANGCI_LINT_TOKEN }} @@ -59,7 +58,7 @@ jobs: # - 1.18rc1 -> 1.18.0-rc.1 go-version: '1.22' - - name: Update GitHub action config + - name: Update GitHub Action config run: make assets/github-action-config.json - name: Update reference files @@ -77,6 +76,39 @@ jobs: base: master token: ${{ secrets.GOLANGCI_LINT_TOKEN }} branch-suffix: timestamp - title: "docs: update assets" - team-reviewers: golangci/team + title: "docs: update GitHub Action assets" + delete-branch: true + + update-assets: + name: "Update documentation assets" + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GOLANGCI_LINT_TOKEN }} + steps: + - uses: actions/checkout@v4 + - name: Install Go + uses: actions/setup-go@v5 + with: + # https://github.com/actions/setup-go#supported-version-syntax + # ex: + # - 1.18beta1 -> 1.18.0-beta.1 + # - 1.18rc1 -> 1.18.0-rc.1 + go-version: '1.22' + + - name: Update reference files + run: cp .golangci.next.reference.yml .golangci.reference.yml + + - name: Update JSON schema files + run: cp jsonschema/golangci.next.jsonschema.json jsonschema/golangci.jsonschema.json + + - name: Update information + run: make website_dump_info + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + base: master + token: ${{ secrets.GOLANGCI_LINT_TOKEN }} + branch-suffix: timestamp + title: "docs: update documentation assets" delete-branch: true diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 7ee9ce3a8cbf..61b94f60ce98 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -6,7 +6,8 @@ # Options for analysis running. run: - # Number of CPUs to use when running golangci-lint. + # Number of operating system threads (`GOMAXPROCS`) that can execute golangci-lint simultaneously. + # If it is explicitly set to 0 (i.e. not the default) then golangci-lint will automatically set the value to match Linux container CPU quota. # Default: the number of logical CPUs in the machine concurrency: 4 @@ -27,31 +28,6 @@ run: build-tags: - mytag - # Which dirs to skip: issues from them won't be reported. - # Can use regexp here: `generated.*`, regexp is applied on full path, - # including the path prefix if one is set. - # Default dirs are skipped independently of this option's value (see skip-dirs-use-default). - # "/" will be replaced by current OS file path separator to properly work on Windows. - # Default: [] - skip-dirs: - - src/external_libs - - autogenerated_by_my_lib - - # Enables skipping of directories: - # - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ - # Default: true - skip-dirs-use-default: false - - # Which files to skip: they will be analyzed, but issues from them won't be reported. - # There is no need to include all autogenerated files, - # we confidently recognize autogenerated files. - # If it's not, please let us know. - # "/" will be replaced by current OS file path separator to properly work on Windows. - # Default: [] - skip-files: - - ".*\\.my\\.go$" - - lib/bad.go - # If set, we pass it to "go list -mod={option}". From "go help modules": # If invoked with -mod=readonly, the go command is disallowed from the implicit # automatic updating of go.mod described above. Instead, it fails when any changes @@ -80,22 +56,28 @@ run: # Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.17 go: '1.19' - # Show statistics per linter. - # Default: false - show-stats: true - # output configuration options output: - # Format: colored-line-number|line-number|json|colored-tab|tab|checkstyle|code-climate|junit-xml|github-actions|teamcity - # - # Multiple can be specified by separating them by comma, output can be provided - # for each of them by separating format name and path by colon symbol. + # The formats used to render issues. + # Format: `colored-line-number`, `line-number`, `json`, `colored-tab`, `tab`, `checkstyle`, `code-climate`, `junit-xml`, `github-actions`, `teamcity` # Output path can be either `stdout`, `stderr` or path to the file to write to. - # Example: "checkstyle:report.xml,json:stdout,colored-line-number" # - # Default: colored-line-number - format: json + # For the CLI flag (`--out-format`), multiple formats can be specified by separating them by comma. + # The output can be specified for each of them by separating format name and path by colon symbol. + # Example: "--out-format=checkstyle:report.xml,json:stdout,colored-line-number" + # The CLI flag (`--out-format`) override the configuration file. + # + # Default: + # formats: + # - format: colored-line-number + # path: stdout + formats: + - format: json + path: stderr + - format: checkstyle + path: report.xml + - format: colored-line-number # Print lines of code with issue. # Default: true @@ -113,10 +95,32 @@ output: # Default: "" path-prefix: "" - # Sort results by: filepath, line and column. + # Sort results by the order defined in `sort-order`. # Default: false sort-results: true + # Order to use when sorting results. + # Require `sort-results` to `true`. + # Possible values: `file`, `linter`, and `severity`. + # + # If the severity values are inside the following list, they are ordered in this order: + # 1. error + # 2. warning + # 3. high + # 4. medium + # 5. low + # Either they are sorted alphabetically. + # + # Default: ["file"] + sort-order: + - linter + - severity + - file # filepath, line, and column. + + # Show statistics per linter. + # Default: false + show-stats: true + # All available settings of specific linters. linters-settings: @@ -149,6 +153,11 @@ linters-settings: first-strong-isolate: false pop-directional-isolate: false + copyloopvar: + # If true, ignore aliasing of loop variables. + # Default: false + ignore-alias: true + cyclop: # The maximal code complexity to report. # Default: 10 @@ -364,16 +373,6 @@ linters-settings: # Default: false default-case-required: true - exhaustivestruct: - # Struct Patterns is list of expressions to match struct packages and names. - # The struct packages have the form `example.com/package.ExampleStruct`. - # The matching patterns can use matching syntax from https://pkg.go.dev/path#Match. - # If this list is empty, all structs are tested. - # Default: [] - struct-patterns: - - '*.Test' - - 'example.com/package.ExampleStruct' - exhaustruct: # List of regular expressions to match struct packages and their names. # Regular expressions must match complete canonical struct package/name/structname. @@ -478,11 +477,11 @@ linters-settings: # Default: false suppress-async-assertion: true - # Suppress warning for comparing values from different types, like int32 and uint32 + # Suppress warning for comparing values from different types, like `int32` and `uint32` # Default: false suppress-type-compare-assertion: true - # Trigger warning for ginkgo focus containers like FDescribe, FContext, FWhen or FIt + # Trigger warning for ginkgo focus containers like `FDescribe`, `FContext`, `FWhen` or `FIt` # Default: false forbid-focus-container: true @@ -490,6 +489,20 @@ linters-settings: # Default: false allow-havelen-zero: true + # Force using `Expect` with `To`, `ToNot` or `NotTo`. + # Reject using `Expect` with `Should` or `ShouldNot`. + # Default: false + force-expect-to: true + + # Best effort validation of async intervals (timeout and polling). + # Ignored the suppress-async-assertion is true. + # Default: false + validate-async-intervals: true + + # Trigger a warning for variable assignments in ginkgo containers like `Describe`, `Context` and `When`, instead of in `BeforeEach()`. + # Default: false + forbid-spec-pollution: true + gocognit: # Minimal code complexity to report. # Default: 30 (but we recommend 10-20) @@ -541,6 +554,9 @@ linters-settings: - ruleguard - truncateCmp + # Enable all checks. + # Default: false + enable-all: true # Which checks should be disabled; can't be combined with 'enabled-checks'. # Default: [] disabled-checks: @@ -763,11 +779,6 @@ linters-settings: # Default: "" local-prefixes: github.com/org/project - golint: - # Minimal confidence for issues. - # Default: 0.8 - min-confidence: 0.7 - gomnd: # List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. # Default: ["argument", "case", "condition", "operation", "return", "assign"] @@ -1063,40 +1074,6 @@ linters-settings: - Katakana govet: - # Report about shadowed variables. - # Default: false - check-shadowing: true - - # Settings per analyzer. - settings: - # Analyzer name, run `go tool vet help` to see all analyzers. - printf: - # Comma-separated list of print function names to check (in addition to default, see `go tool vet help printf`). - # Default: [] - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - shadow: - # Whether to be strict about shadowing; can be noisy. - # Default: false - strict: true - unusedresult: - # Comma-separated list of functions whose results must be used - # (in addition to default: - # context.WithCancel, context.WithDeadline, context.WithTimeout, context.WithValue, errors.New, fmt.Errorf, - # fmt.Sprint, fmt.Sprintf, sort.Reverse - # ). - # Default: [] - funcs: - - pkg.MyFunc - # Comma-separated list of names of methods of type func() string whose results must be used - # (in addition to default Error,String) - # Default: [] - stringmethods: - - MyMethod - # Disable all analyzers. # Default: false disable-all: true @@ -1107,7 +1084,7 @@ linters-settings: # stdmethods, stringintconv, structtag, testinggoroutine, tests, timeformat, unmarshal, unreachable, unsafeptr, # unusedresult # ). - # Run `go tool vet help` to see all analyzers. + # Run `GL_DEBUG=govet golangci-lint run --enable=govet` to see default, all available analyzers, and enabled analyzers. # Default: [] enable: - appends @@ -1159,7 +1136,7 @@ linters-settings: # atomicalign, deepequalerrors, fieldalignment, findcall, nilness, reflectvaluecompare, shadow, sortslice, # timeformat, unusedwrite # ). - # Run `go tool vet help` to see all analyzers. + # Run `GL_DEBUG=govet golangci-lint run --enable=govet` to see default, all available analyzers, and enabled analyzers. # Default: [] disable: - appends @@ -1203,6 +1180,36 @@ linters-settings: - unusedresult - unusedwrite + # Settings per analyzer. + settings: + # Analyzer name, run `go tool vet help` to see all analyzers. + printf: + # Comma-separated list of print function names to check (in addition to default, see `go tool vet help printf`). + # Default: [] + funcs: + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf + shadow: + # Whether to be strict about shadowing; can be noisy. + # Default: false + strict: true + unusedresult: + # Comma-separated list of functions whose results must be used + # (in addition to default: + # context.WithCancel, context.WithDeadline, context.WithTimeout, context.WithValue, errors.New, fmt.Errorf, + # fmt.Sprint, fmt.Sprintf, sort.Reverse + # ). + # Default: [] + funcs: + - pkg.MyFunc + # Comma-separated list of names of methods of type func() string whose results must be used + # (in addition to default Error,String) + # Default: [] + stringmethods: + - MyMethod + grouper: # Require the use of a single global 'const' declaration only. # Default: false @@ -1232,15 +1239,6 @@ linters-settings: # Default: false var-require-grouping: true - ifshort: - # Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax. - # Has higher priority than max-decl-chars. - # Default: 1 - max-decl-lines: 2 - # Maximum length of variable declaration measured in number of characters, after which linter won't suggest using short syntax. - # Default: 30 - max-decl-chars: 40 - importas: # Do not allow unaliased imports of aliased packages. # Default: false @@ -1344,19 +1342,25 @@ linters-settings: # Default: false always: true - maligned: - # Print struct with more effective memory layout or not. - # Default: false - suggest-new: true - misspell: # Correct spellings using locale preferences for US or UK. # Setting locale to US will correct the British spelling of 'colour' to 'color'. # Default is to use a neutral variety of English. locale: US + # Typos to ignore. + # Should be in lower case. # Default: [] ignore-words: - someword + # Extra word corrections. + # `typo` and `correction` should only contain letters. + # The words are case-insensitive. + # Default: [] + extra-words: + - typo: "iff" + correction: "if" + - typo: "cancelation" + correction: "cancellation" # Mode of the analysis: # - default: checks all the file content. # - restricted: checks only comments. @@ -1441,6 +1445,9 @@ linters-settings: # Optimizes `fmt.Sprintf` with only one argument. # Default: true sprintf1: false + # Optimizes into strings concatenation. + # Default: true + strconcat: false prealloc: # IMPORTANT: we don't recommend using this linter before doing performance profiling. @@ -1537,6 +1544,7 @@ linters-settings: - name: add-constant severity: warning disabled: false + exclude: [""] arguments: - maxLitCount: "3" allowStrs: '""' @@ -1546,41 +1554,50 @@ linters-settings: - name: argument-limit severity: warning disabled: false + exclude: [""] arguments: [ 4 ] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#atomic - name: atomic severity: warning + exclude: [""] disabled: false # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#banned-characters - name: banned-characters severity: warning disabled: false + exclude: [""] arguments: [ "Ω","Σ","σ", "7" ] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bare-return - name: bare-return severity: warning + exclude: [""] disabled: false # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#blank-imports - name: blank-imports severity: warning + exclude: [""] disabled: false # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr - name: bool-literal-in-expr severity: warning + exclude: [""] disabled: false # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#call-to-gc - name: call-to-gc severity: warning + exclude: [""] disabled: false # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#cognitive-complexity - name: cognitive-complexity severity: warning disabled: false + exclude: [""] arguments: [ 7 ] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#comment-spacings - name: comment-spacings severity: warning disabled: false + exclude: [""] arguments: - mypragma - otherpragma @@ -1588,103 +1605,125 @@ linters-settings: - name: confusing-naming severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#confusing-results - name: confusing-results severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#constant-logical-expr - name: constant-logical-expr severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument - name: context-as-argument severity: warning disabled: false + exclude: [""] arguments: - allowTypesBefore: "*testing.T,*github.com/user/repo/testing.Harness" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-keys-type - name: context-keys-type severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#cyclomatic - name: cyclomatic severity: warning disabled: false + exclude: [""] arguments: [ 3 ] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#datarace - name: datarace severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#deep-exit - name: deep-exit severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#defer - name: defer severity: warning disabled: false + exclude: [""] arguments: - [ "call-chain", "loop" ] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#dot-imports - name: dot-imports severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#duplicated-imports - name: duplicated-imports severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return - name: early-return severity: warning disabled: false + exclude: [""] arguments: - "preserveScope" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-block - name: empty-block severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines - name: empty-lines severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#enforce-map-style - name: enforce-map-style severity: warning disabled: false + exclude: [""] arguments: - "make" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#enforce-repeated-arg-type-style - name: enforce-repeated-arg-type-style severity: warning disabled: false + exclude: [""] arguments: - "short" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#enforce-slice-style - name: enforce-slice-style severity: warning disabled: false + exclude: [""] arguments: - "make" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-naming - name: error-naming severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-return - name: error-return severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-strings - name: error-strings severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#errorf - name: errorf severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported - name: exported severity: warning disabled: false + exclude: [""] arguments: - "preserveScope" - "checkPrivateReceivers" @@ -1693,54 +1732,65 @@ linters-settings: - name: file-header severity: warning disabled: false + exclude: [""] arguments: - This is the text that must appear at the top of source files. # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#flag-parameter - name: flag-parameter severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#function-result-limit - name: function-result-limit severity: warning disabled: false + exclude: [""] arguments: [ 2 ] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#function-length - name: function-length severity: warning disabled: false + exclude: [""] arguments: [ 10, 0 ] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#get-return - name: get-return severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#identical-branches - name: identical-branches severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#if-return - name: if-return severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#increment-decrement - name: increment-decrement severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#indent-error-flow - name: indent-error-flow severity: warning disabled: false + exclude: [""] arguments: - "preserveScope" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#import-alias-naming - name: import-alias-naming severity: warning disabled: false + exclude: [""] arguments: - "^[a-z][a-z0-9]{0,}$" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#imports-blocklist - name: imports-blocklist severity: warning disabled: false + exclude: [""] arguments: - "crypto/md5" - "crypto/sha1" @@ -1748,73 +1798,90 @@ linters-settings: - name: import-shadowing severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#line-length-limit - name: line-length-limit severity: warning disabled: false + exclude: [""] arguments: [ 80 ] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#max-control-nesting - name: max-control-nesting severity: warning disabled: false + exclude: [""] arguments: [ 3 ] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#max-public-structs - name: max-public-structs severity: warning disabled: false + exclude: [""] arguments: [ 3 ] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#modifies-parameter - name: modifies-parameter severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#modifies-value-receiver - name: modifies-value-receiver severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#nested-structs - name: nested-structs severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#optimize-operands-order - name: optimize-operands-order severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#package-comments - name: package-comments severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range - name: range severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-in-closure - name: range-val-in-closure severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-address - name: range-val-address severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#receiver-naming - name: receiver-naming severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redundant-import-alias - name: redundant-import-alias severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redefines-builtin-id - name: redefines-builtin-id severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-of-int - name: string-of-int severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format - name: string-format severity: warning disabled: false + exclude: [""] arguments: - - 'core.WriteError[1].Message' - '/^([^A-Z]|$)/' @@ -1832,24 +1899,29 @@ linters-settings: - "bson,outline,gnu" severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#superfluous-else - name: superfluous-else severity: warning disabled: false + exclude: [""] arguments: - "preserveScope" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#time-equal - name: time-equal severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#time-naming - name: time-naming severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-naming - name: var-naming severity: warning disabled: false + exclude: [""] arguments: - [ "ID" ] # AllowList - [ "VM" ] # DenyList @@ -1858,22 +1930,27 @@ linters-settings: - name: var-declaration severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unconditional-recursion - name: unconditional-recursion severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-naming - name: unexported-naming severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-return - name: unexported-return severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error - name: unhandled-error severity: warning disabled: false + exclude: [""] arguments: - "fmt.Printf" - "myFunction" @@ -1881,30 +1958,36 @@ linters-settings: - name: unnecessary-stmt severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unreachable-code - name: unreachable-code severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter - name: unused-parameter severity: warning disabled: false + exclude: [""] arguments: - allowRegex: "^_" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver - name: unused-receiver severity: warning disabled: false + exclude: [""] arguments: - allowRegex: "^_" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break - name: useless-break severity: warning disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#waitgroup-by-value - name: waitgroup-by-value severity: warning disabled: false + exclude: [""] rowserrcheck: # database/sql is always checked @@ -1919,6 +2002,9 @@ linters-settings: # Enforce using key-value pairs only (overrides no-mixed-args, incompatible with attr-only). # Default: false kv-only: true + # Enforce not using global loggers. + # Default: default + no-global: all # Enforce using attributes only (overrides no-mixed-args, incompatible with kv-only). # Default: false attr-only: true @@ -2099,6 +2185,10 @@ linters-settings: - suite-thelper - useless-assert + bool-compare: + # To ignore user defined types (over builtin bool). + # Default: false + ignore-custom-types: true expected-actual: # Regexp for expected variable name. # Default: (^(exp(ected)?|want(ed)?)([A-Z]\w*)?$)|(^(\w*[a-z])?(Exp(ected)?|Want(ed)?)$) @@ -2202,6 +2292,14 @@ linters-settings: # Default: false syslog-priority: true + unconvert: + # Remove conversions that force intermediate rounding. + # Default: false + fast-math: true + # Be more conservative (experimental). + # Default: false + safe: true + unparam: # Inspect exported functions. # @@ -2236,11 +2334,6 @@ linters-settings: # Default: true generated-is-used: false - varcheck: - # Check usage of exported fields and variables. - # Default: false - exported-fields: true - varnamelen: # The longest distance, in source lines, that is being considered a "small scope". # Variables used in at most this many lines will be ignored. @@ -2386,6 +2479,10 @@ linters-settings: custom: # Each custom linter should have a unique name. example: + # The plugin type. + # It can be `goplugin` or `module`. + # Default: goplugin + type: module # The path to the plugin *.so. Can be absolute or local. # Required for each custom linter. path: /path/to/example.so @@ -2395,6 +2492,11 @@ linters-settings: # Intended to point to the repo location of the linter. # Optional. original-url: github.com/golangci/example-linter + # Plugins settings/configuration. + # Only work with plugin based on `linterdb.PluginConstructor`. + # Optional. + settings: + foo: bar linters: @@ -2410,8 +2512,8 @@ linters: - bodyclose - containedctx - contextcheck + - copyloopvar - cyclop - - deadcode - decorder - depguard - dogsled @@ -2424,7 +2526,6 @@ linters: - errorlint - execinquery - exhaustive - - exhaustivestruct - exhaustruct - exportloopref - forbidigo @@ -2447,7 +2548,6 @@ linters: - gofumpt - goheader - goimports - - golint - gomnd - gomoddirectives - gomodguard @@ -2457,18 +2557,16 @@ linters: - gosmopolitan - govet - grouper - - ifshort - importas - inamedparam - ineffassign - interfacebloat - - interfacer + - intrange - ireturn - lll - loggercheck - maintidx - makezero - - maligned - mirror - misspell - musttag @@ -2480,7 +2578,6 @@ linters: - noctx - nolintlint - nonamedreturns - - nosnakecase - nosprintfhostport - paralleltest - perfsprint @@ -2491,12 +2588,10 @@ linters: - reassign - revive - rowserrcheck - - scopelint - sloglint - spancheck - sqlclosecheck - staticcheck - - structcheck - stylecheck - tagalign - tagliatelle @@ -2511,7 +2606,6 @@ linters: - unparam - unused - usestdlibvars - - varcheck - varnamelen - wastedassign - whitespace @@ -2531,8 +2625,8 @@ linters: - bodyclose - containedctx - contextcheck + - copyloopvar - cyclop - - deadcode - decorder - depguard - dogsled @@ -2545,7 +2639,6 @@ linters: - errorlint - execinquery - exhaustive - - exhaustivestruct - exhaustruct - exportloopref - forbidigo @@ -2568,7 +2661,6 @@ linters: - gofumpt - goheader - goimports - - golint - gomnd - gomoddirectives - gomodguard @@ -2578,18 +2670,16 @@ linters: - gosmopolitan - govet - grouper - - ifshort - importas - inamedparam - ineffassign - interfacebloat - - interfacer + - intrange - ireturn - lll - loggercheck - maintidx - makezero - - maligned - mirror - misspell - musttag @@ -2601,7 +2691,6 @@ linters: - noctx - nolintlint - nonamedreturns - - nosnakecase - nosprintfhostport - paralleltest - perfsprint @@ -2612,12 +2701,10 @@ linters: - reassign - revive - rowserrcheck - - scopelint - sloglint - spancheck - sqlclosecheck - staticcheck - - structcheck - stylecheck - tagalign - tagliatelle @@ -2632,13 +2719,22 @@ linters: - unparam - unused - usestdlibvars - - varcheck - varnamelen - wastedassign - whitespace - wrapcheck - wsl - zerologlint + - deadcode # Deprecated + - exhaustivestruct # Deprecated + - golint # Deprecated + - ifshort # Deprecated + - interfacer # Deprecated + - maligned # Deprecated + - nosnakecase # Deprecated + - scopelint # Deprecated + - structcheck # Deprecated + - varcheck # Deprecated # Enable presets. # https://golangci-lint.run/usage/linters @@ -2713,10 +2809,47 @@ issues: # Default: true exclude-use-default: false - # If set to true exclude and exclude-rules regular expressions become case-sensitive. + # If set to true, `exclude` and `exclude-rules` regular expressions become case-sensitive. # Default: false exclude-case-sensitive: false + # Which dirs to exclude: issues from them won't be reported. + # Can use regexp here: `generated.*`, regexp is applied on full path, + # including the path prefix if one is set. + # Default dirs are skipped independently of this option's value (see exclude-dirs-use-default). + # "/" will be replaced by current OS file path separator to properly work on Windows. + # Default: [] + exclude-dirs: + - src/external_libs + - autogenerated_by_my_lib + + # Enables exclude of directories: + # - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ + # Default: true + exclude-dirs-use-default: false + + # Which files to exclude: they will be analyzed, but issues from them won't be reported. + # There is no need to include all autogenerated files, + # we confidently recognize autogenerated files. + # If it's not, please let us know. + # "/" will be replaced by current OS file path separator to properly work on Windows. + # Default: [] + exclude-files: + - ".*\\.my\\.go$" + - lib/bad.go + + # To follow strictly the Go generated file convention. + # + # If set to true, source files that have lines matching only the following regular expression will be excluded: + # `^// Code generated .* DO NOT EDIT\.$` + # This line must appear before the first non-comment, non-blank text in the file. + # https://go.dev/s/generatedcode + # + # By default, a lax pattern is applied: + # sources are excluded if they contain lines `autogenerated file`, `code generated`, `do not edit`, etc. + # Default: false + exclude-generated-strict: true + # The list of ids of default excludes to include or disable. # https://golangci-lint.run/usage/false-positives/#default-exclusions # Default: [] @@ -2783,6 +2916,8 @@ severity: # - GitHub: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message # - TeamCity: https://www.jetbrains.com/help/teamcity/service-messages.html#Inspection+Instance # + # `@linter` can be used as severity value to keep the severity from linters (e.g. revive, gosec, ...) + # # Default: "" default-severity: error @@ -2793,6 +2928,9 @@ severity: # When a list of severity rules are provided, severity information will be added to lint issues. # Severity rules have the same filtering capability as exclude rules # except you are allowed to specify one matcher per severity rule. + # + # `@linter` can be used as severity value to keep the severity from linters (e.g. revive, gosec, ...) + # # Only affects out formats that support setting severity information. # # Default: [] diff --git a/.golangci.yml b/.golangci.yml index 9b2d786f7a05..28a5dda7b992 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -9,7 +9,7 @@ # # We have specific constraints, so we use a specific configuration. # -# See the file `.golangci.reference.yml` to have a list of all available configuration options. +# See the file `.golangci.reference.yml` to have a list of all available configuration options. linters-settings: depguard: @@ -133,7 +133,6 @@ linters: - revive - staticcheck - stylecheck - - typecheck - unconvert - unparam - unused @@ -146,7 +145,7 @@ linters: issues: # Excluding configuration per-path, per-linter, per-text and per-source exclude-rules: - - path: _test\.go + - path: (.+)_test\.go linters: - dupl - gomnd @@ -187,14 +186,13 @@ issues: - path: pkg/golinters/unused.go linters: [gocritic] text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - linters: [gocritic] - text: "string `gocritic.go` has 3 occurrences, make it a constant" -run: - timeout: 5m - skip-dirs: # TODO(ldez): should be replaced by `issues.exclude-dirs` after the next release. + exclude-dirs: - test/testdata_etc # test files - internal/cache # extracted from Go code - internal/renameio # extracted from Go code - internal/robustio # extracted from Go code + +run: + timeout: 5m + diff --git a/.goreleaser.yml b/.goreleaser.yml index 36d129b8ea76..914d40cf2be5 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -69,8 +69,10 @@ changelog: - '(?i)^docs\[[^:]+\]:' - '^tests?:' - '(?i)^dev:' + - '(?i)^chore:' - '^build\(deps\): bump .* in /docs \(#\d+\)' - '^build\(deps\): bump .* in /\.github/peril \(#\d+\)' + - '^build\(deps\): bump .* in /scripts/gen_github_action_config \(#\d+\)' - Merge pull request - Merge branch diff --git a/CHANGELOG.md b/CHANGELOG.md index fb24ac84aafc..fe73356470c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,66 @@ Follow the news and releases on [Mastodon](https://fosstodon.org/@golangcilint) There is the most valuable changes log: +### v1.57.0 + +1. New linters + * `copyloopvar`: https://github.com/karamaru-alpha/copyloopvar + * `intrange`: https://github.com/ckaznocha/intrange +2. Updated linters + * `dupword`: from 0.0.13 to 0.0.14 + * `gci`: from 0.12.1 to 0.12.3 + * `ginkgolinter`: from 0.15.2 to 0.16.1 (new option `force-expect-to`, `validate-async-intervals`, and `forbid-spec-pollution`) + * `go-critic`: from 0.11.1 to 0.11.2 + * `go-critic`: support of `enable-all` and `disable-all` options + * `go-spancheck`: from 0.5.2 to 0.5.3 + * `gomodguard`: from 1.3.0 to 1.3.1 + * `govet`: deprecation of `check-shadowing` ⚠️ + * `govet`: disable temporarily `httpresponse` because of a bug https://github.com/golang/go/issues/66259 + * `misspell`: add `extra-words` + * `musttag`: from 0.8.0 to 0.9.0 + * `nakedret`: from 2.0.2 to 2.0.4 + * `paralleltest`: from 1.0.9 to 1.0.10 + * `perfsprint`: from 0.6.0 to 0.7.1 (new option `strconcat`) + * `protogetter`: from 0.3.4 to 0.3.5 + * `revive`: add `exclude` option + * `sloglint`: from 0.4.0 to 0.5.0 (new option `no-global`) + * `staticcheck`: from 0.4.6 to 0.4.7 + * `testifylint`: from 1.1.2 to 1.2.0 (new option `bool-compare`) + * `unconvert`: to HEAD (new options `fast-math` and `safe`) + * `wrapcheck`: from 2.8.1 to 2.8.3 + * Disable `copyloopvar` and `intrange` on Go < 1.22 +3. Enhancements + * 🧩 New custom linters system https://golangci-lint.run/plugins/module-plugins/ + * 🎉 Allow running only a specific linter without modifying the file configuration (`--enable-only`) + * Allow custom sort order for the reports (`output.sort-order`) + * Automatically adjust the maximum concurrency to the container CPU quota if `run.concurrency=0` + * Add `verify` command to check the configuration against the JSON Schema + * Option to strictly follow Go generated file convention (`issues.exclude-generated-strict`) + * Syntax to not override `severity` from linters (`@linter`) + * Use severities from `gosec` + * Create automatically directory related to `output.formats.path` + * Use the first issue without inline on `mergeLineIssues` on multiple issues +4. Misc. + * ⚠️ Inactivate deprecated linters (`deadcode`, `exhaustivestruct`, `golint`, `ifshort`, `interfacer`, `maligned`, `nosnakecase`, `scopelint`, `structcheck`, `varcheck`) + * ⚠️ Deprecated CLI flags have been removed (deprecated since 2018) + * ⚠️ Move `show-stats` option from `run` to `output` configuration section + * ⚠️ Replace `run.skip-xxx` options by `issues.exclude-xxx` options + * ⚠️ Replace `output.format` by `output.formats` with a new file configuration syntax + * Internal rewrite of the CLI + * Improve 'no go files to analyze' message + * Use `GOTOOLCHAIN=auto` inside the Docker images +5. Documentation + * ⚠️ Define the linter deprecation cycle https://golangci-lint.run/product/roadmap/#linter-deprecation-cycle + * 🎉 Use information from the previous release to create linter pages + * 🎉 Publish JSON schema on https://golangci-lint.run/jsonschema/golangci.jsonschema.json + * Reorganize documentation pages + * Add an explanation about the configuration file inside golangci-lint repository + +**⚠️ Important ⚠️** + +1. Deprecated linters are inactivated, you still need to disable them if you are using `enable-all`. +2. Deprecated CLI flags (about linter settings and `deadline`) have been removed. + ### v1.56.2 1. updated linters @@ -13,7 +73,7 @@ There is the most valuable changes log: 2. misc. * Fix missing version in Docker image 3. Documentation - * Explain the limitation of new-from-rev and new-from-patch + * Explain the limitation of `new-from-rev` and `new-from-patch` ### v1.56.1 @@ -26,7 +86,7 @@ There is the most valuable changes log: ### v1.56.0 1. new linters - * feat: add `spancheck` linter https://github.com/jjti/go-spancheck + * `spancheck`: https://github.com/jjti/go-spancheck 2. updated linters * `depguard`: from 2.1.0 to 2.2.0 * `exhaustive`: from 0.11.0 to 0.12.0 @@ -59,15 +119,15 @@ There is the most valuable changes log: 3. misc. * 🎉 go1.22 support * Implement stats per linter with a flag - * fix: make versioning inside Docker image consistent with binaries - * fix: parse Go RC version + * Make versioning inside Docker image consistent with binaries + * Parse Go RC version 4. Documentation - * Add missing fields to .golangci.reference.yml - * Fix noctx description - * Improve .golangci.reference.yml defaults - * Improve typecheck FAQ - * Note that `exhaustruct` struct regular expressions are expected to match the entire `package/name/structname` - * Adjust wrapcheck ignoreSigs to new defaults + * Fix `noctx` description + * Add missing fields to `.golangci.reference.yml` + * Improve `.golangci.reference.yml` defaults + * `typecheck`: improve FAQ + * `exhaustruct`: note that struct regular expressions are expected to match the entire `package/name/structname` + * `wrapcheck`: adjust `ignoreSigs` to new defaults **Important** @@ -1183,7 +1243,7 @@ IMPORTANT: `varcheck` and `deadcode` has been removed of default linters. ### April 2020 1. Add new linters: `testpackage`, `nestif`, `godot`, `gomodguard`, `asciicheck` -2. Add github actions output format +2. Add GitHub Actions output format 3. Update linters: `wsl`, `gomodguard`, `gosec` 4. Support `disabled-tags` setting for `gocritic` 5. Mitigate OOM and "failed prerequisites" @@ -1197,7 +1257,7 @@ IMPORTANT: `varcheck` and `deadcode` has been removed of default linters. 2. Add new linters: `funlen`, `whitespace` (with auto-fix) and `godox` 3. Update linters: `gochecknoglobals`, `scopelint`, `gosec` 4. Provide pre-built binary for ARM and FreeBSD -5. 2. Fix false-positives in `unused` +5. Fix false-positives in `unused` 6. Support `--skip-dirs-use-default` 7. Add support for bash completions diff --git a/assets/cli-help.json b/assets/cli-help.json index 55d66d5ed021..83f810bbbc10 100644 --- a/assets/cli-help.json +++ b/assets/cli-help.json @@ -1,5 +1,4 @@ { - "enable": "Enabled by default linters:\nerrcheck: errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases [fast: false, auto-fix: false]\ngosimple (megacheck): Linter for Go source code that specializes in simplifying code [fast: false, auto-fix: false]\ngovet (vet, vetshadow): Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: false, auto-fix: false]\nineffassign: Detects when assignments to existing variables are not used [fast: true, auto-fix: false]\nstaticcheck (megacheck): It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint. [fast: false, auto-fix: false]\nunused (megacheck): Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]", - "disable": "Disabled by default linters:\nasasalint: check for pass []any as any in variadic func(...any) [fast: false, auto-fix: false]\nasciicheck: checks that all code identifiers does not have non-ASCII symbols in the name [fast: true, auto-fix: false]\nbidichk: Checks for dangerous unicode character sequences [fast: true, auto-fix: false]\nbodyclose: checks whether HTTP response body is closed successfully [fast: false, auto-fix: false]\ncontainedctx: containedctx is a linter that detects struct contained context.Context field [fast: false, auto-fix: false]\ncontextcheck: check whether the function uses a non-inherited context [fast: false, auto-fix: false]\ncyclop: checks function and package cyclomatic complexity [fast: false, auto-fix: false]\ndeadcode [deprecated]: Finds unused code [fast: false, auto-fix: false]\ndecorder: check declaration order and count of types, constants, variables and functions [fast: true, auto-fix: false]\ndepguard: Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]\ndogsled: Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]\ndupl: Tool for code clone detection [fast: true, auto-fix: false]\ndupword: checks for duplicate words in the source code [fast: true, auto-fix: true]\ndurationcheck: check for two durations multiplied together [fast: false, auto-fix: false]\nerrchkjson: Checks types passed to the json encoding functions. Reports unsupported types and reports occations, where the check for the returned error can be omitted. [fast: false, auto-fix: false]\nerrname: Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`. [fast: false, auto-fix: false]\nerrorlint: errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. [fast: false, auto-fix: false]\nexecinquery: execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds [fast: false, auto-fix: false]\nexhaustive: check exhaustiveness of enum switch statements [fast: false, auto-fix: false]\nexhaustivestruct [deprecated]: Checks if all struct's fields are initialized [fast: false, auto-fix: false]\nexhaustruct: Checks if all structure fields are initialized [fast: false, auto-fix: false]\nexportloopref: checks for pointers to enclosing loop variables [fast: false, auto-fix: false]\nforbidigo: Forbids identifiers [fast: false, auto-fix: false]\nforcetypeassert: finds forced type assertions [fast: true, auto-fix: false]\nfunlen: Tool for detection of long functions [fast: true, auto-fix: false]\ngci: Gci controls Go package import order and makes it always deterministic. [fast: true, auto-fix: false]\nginkgolinter: enforces standards of using ginkgo and gomega [fast: false, auto-fix: false]\ngocheckcompilerdirectives: Checks that go compiler directive comments (//go:) are valid. [fast: true, auto-fix: false]\ngochecknoglobals: check that no global variables exist [fast: false, auto-fix: false]\ngochecknoinits: Checks that no init functions are present in Go code [fast: true, auto-fix: false]\ngochecksumtype: Run exhaustiveness checks on Go \"sum types\" [fast: false, auto-fix: false]\ngocognit: Computes and checks the cognitive complexity of functions [fast: true, auto-fix: false]\ngoconst: Finds repeated strings that could be replaced by a constant [fast: true, auto-fix: false]\ngocritic: Provides diagnostics that check for bugs, performance and style issues. [fast: false, auto-fix: false]\ngocyclo: Computes and checks the cyclomatic complexity of functions [fast: true, auto-fix: false]\ngodot: Check if comments end in a period [fast: true, auto-fix: true]\ngodox: Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false]\ngoerr113: Go linter to check the errors handling expressions [fast: false, auto-fix: false]\ngofmt: 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]\ngofumpt: Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true]\ngoheader: Checks is file header matches to pattern [fast: true, auto-fix: false]\ngoimports: Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode. [fast: true, auto-fix: true]\ngolint [deprecated]: Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes [fast: false, auto-fix: false]\ngomnd: An analyzer to detect magic numbers. [fast: true, auto-fix: false]\ngomoddirectives: Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. [fast: true, auto-fix: false]\ngomodguard: Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations. [fast: true, auto-fix: false]\ngoprintffuncname: Checks that printf-like functions are named with `f` at the end. [fast: true, auto-fix: false]\ngosec (gas): Inspects source code for security problems [fast: false, auto-fix: false]\ngosmopolitan: Report certain i18n/l10n anti-patterns in your Go codebase [fast: false, auto-fix: false]\ngrouper: Analyze expression groups. [fast: true, auto-fix: false]\nifshort [deprecated]: Checks that your code uses short syntax for if-statements whenever possible. [fast: true, auto-fix: false]\nimportas: Enforces consistent import aliases [fast: false, auto-fix: false]\ninamedparam: reports interfaces with unnamed method parameters [fast: true, auto-fix: false]\ninterfacebloat: A linter that checks the number of methods inside an interface. [fast: true, auto-fix: false]\ninterfacer [deprecated]: Linter that suggests narrower interface types [fast: false, auto-fix: false]\nireturn: Accept Interfaces, Return Concrete Types [fast: false, auto-fix: false]\nlll: Reports long lines [fast: true, auto-fix: false]\nloggercheck (logrlint): Checks key value pairs for common logger libraries (kitlog,klog,logr,zap). [fast: false, auto-fix: false]\nmaintidx: maintidx measures the maintainability index of each function. [fast: true, auto-fix: false]\nmakezero: Finds slice declarations with non-zero initial length [fast: false, auto-fix: false]\nmaligned [deprecated]: Tool to detect Go structs that would take less memory if their fields were sorted [fast: false, auto-fix: false]\nmirror: reports wrong mirror patterns of bytes/strings usage [fast: false, auto-fix: false]\nmisspell: Finds commonly misspelled English words [fast: true, auto-fix: true]\nmusttag: enforce field tags in (un)marshaled structs [fast: false, auto-fix: false]\nnakedret: Checks that functions with naked returns are not longer than a maximum size (can be zero). [fast: true, auto-fix: false]\nnestif: Reports deeply nested if statements [fast: true, auto-fix: false]\nnilerr: Finds the code that returns nil even if it checks that the error is not nil. [fast: false, auto-fix: false]\nnilnil: Checks that there is no simultaneous return of `nil` error and an invalid value. [fast: false, auto-fix: false]\nnlreturn: nlreturn checks for a new line before return and branch statements to increase code clarity [fast: true, auto-fix: false]\nnoctx: Finds sending http request without context.Context [fast: false, auto-fix: false]\nnolintlint: Reports ill-formed or insufficient nolint directives [fast: true, auto-fix: false]\nnonamedreturns: Reports all named returns [fast: false, auto-fix: false]\nnosnakecase [deprecated]: nosnakecase is a linter that detects snake case of variable naming and function name. [fast: true, auto-fix: false]\nnosprintfhostport: Checks for misuse of Sprintf to construct a host with port in a URL. [fast: true, auto-fix: false]\nparalleltest: Detects missing usage of t.Parallel() method in your Go test [fast: false, auto-fix: false]\nperfsprint: Checks that fmt.Sprintf can be replaced with a faster alternative. [fast: false, auto-fix: false]\nprealloc: Finds slice declarations that could potentially be pre-allocated [fast: true, auto-fix: false]\npredeclared: find code that shadows one of Go's predeclared identifiers [fast: true, auto-fix: false]\npromlinter: Check Prometheus metrics naming via promlint [fast: true, auto-fix: false]\nprotogetter: Reports direct reads from proto message fields when getters should be used [fast: false, auto-fix: true]\nreassign: Checks that package variables are not reassigned [fast: false, auto-fix: false]\nrevive: Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. [fast: false, auto-fix: false]\nrowserrcheck: checks whether Rows.Err of rows is checked successfully [fast: false, auto-fix: false]\nscopelint [deprecated]: Scopelint checks for unpinned variables in go programs [fast: true, auto-fix: false]\nsloglint: ensure consistent code style when using log/slog [fast: false, auto-fix: false]\nspancheck: Checks for mistakes with OpenTelemetry/Census spans. [fast: false, auto-fix: false]\nsqlclosecheck: Checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed. [fast: false, auto-fix: false]\nstructcheck [deprecated]: Finds unused struct fields [fast: false, auto-fix: false]\nstylecheck: Stylecheck is a replacement for golint [fast: false, auto-fix: false]\ntagalign: check that struct tags are well aligned [fast: true, auto-fix: true]\ntagliatelle: Checks the struct tags. [fast: true, auto-fix: false]\ntenv: tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 [fast: false, auto-fix: false]\ntestableexamples: linter checks if examples are testable (have an expected output) [fast: true, auto-fix: false]\ntestifylint: Checks usage of github.com/stretchr/testify. [fast: false, auto-fix: false]\ntestpackage: linter that makes you use a separate _test package [fast: true, auto-fix: false]\nthelper: thelper detects tests helpers which is not start with t.Helper() method. [fast: false, auto-fix: false]\ntparallel: tparallel detects inappropriate usage of t.Parallel() method in your Go test codes. [fast: false, auto-fix: false]\nunconvert: Remove unnecessary type conversions [fast: false, auto-fix: false]\nunparam: Reports unused function parameters [fast: false, auto-fix: false]\nusestdlibvars: A linter that detect the possibility to use variables/constants from the Go standard library. [fast: true, auto-fix: false]\nvarcheck [deprecated]: Finds unused global variables and constants [fast: false, auto-fix: false]\nvarnamelen: checks that the length of a variable's name matches its scope [fast: false, auto-fix: false]\nwastedassign: Finds wasted assignment statements [fast: false, auto-fix: false]\nwhitespace: Whitespace is a linter that checks for unnecessary newlines at the start and end of functions, if, for, etc. [fast: true, auto-fix: true]\nwrapcheck: Checks that errors returned from external packages are wrapped [fast: false, auto-fix: false]\nwsl: add or remove empty lines [fast: true, auto-fix: false]\nzerologlint: Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg` [fast: false, auto-fix: false]", - "help": "Usage:\n golangci-lint run [flags]\n\nFlags:\n -c, --config PATH Read config from file path PATH\n --no-config Don't read config file\n --out-format string Format of output: colored-line-number|line-number|json|tab|checkstyle|code-climate|html|junit-xml|github-actions|teamcity (default \"colored-line-number\")\n --print-issued-lines Print lines of code with issue (default true)\n --print-linter-name Print linter name in issue line (default true)\n --uniq-by-line Make issues output unique by line (default true)\n --sort-results Sort linter results\n --path-prefix string Path prefix to add to output\n --modules-download-mode string Modules download mode. If not empty, passed as -mod=\u003cmode\u003e to go tools\n --issues-exit-code int Exit code when issues were found (default 1)\n --go string Targeted Go version\n --build-tags strings Build tags\n --timeout duration Timeout for total work (default 1m0s)\n --tests Analyze tests (*_test.go) (default true)\n --print-resources-usage Print avg and max memory usage of golangci-lint and total time\n --skip-dirs strings Regexps of directories to skip\n --skip-dirs-use-default Use or not use default excluded directories:\n - (^|/)vendor($|/)\n - (^|/)third_party($|/)\n - (^|/)testdata($|/)\n - (^|/)examples($|/)\n - (^|/)Godeps($|/)\n - (^|/)builtin($|/)\n (default true)\n --skip-files strings Regexps of files to skip\n --allow-parallel-runners Allow multiple parallel golangci-lint instances running. If false (default) - golangci-lint acquires file lock on start.\n --allow-serial-runners Allow multiple golangci-lint instances running, but serialize them around a lock. If false (default) - golangci-lint exits with an error if it fails to acquire file lock on start.\n --show-stats Show statistics per linter\n -D, --disable strings Disable specific linter\n --disable-all Disable all linters\n -E, --enable strings Enable specific linter\n --enable-all Enable all linters\n --fast Enable only fast linters from enabled linters set (first run won't be fast)\n -p, --presets strings Enable presets (bugs|comment|complexity|error|format|import|metalinter|module|performance|sql|style|test|unused) of linters. Run 'golangci-lint help linters' to see them. This option implies option --disable-all\n -e, --exclude strings Exclude issue by regexp\n --exclude-use-default Use or not use default excludes:\n # EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok\n - Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked\n \n # EXC0002 golint: Annoying issue about not having a comment. The rare codebase has such comments\n - (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)\n \n # EXC0003 golint: False positive when tests are defined in package 'test'\n - func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this\n \n # EXC0004 govet: Common false positives\n - (possible misuse of unsafe.Pointer|should have signature)\n \n # EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore\n - ineffective break statement. Did you mean to break out of the outer loop\n \n # EXC0006 gosec: Too many false-positives on 'unsafe' usage\n - Use of unsafe calls should be audited\n \n # EXC0007 gosec: Too many false-positives for parametrized shell calls\n - Subprocess launch(ed with variable|ing should be audited)\n \n # EXC0008 gosec: Duplicated errcheck checks\n - (G104)\n \n # EXC0009 gosec: Too many issues in popular repos\n - (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)\n \n # EXC0010 gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)'\n - Potential file inclusion via variable\n \n # EXC0011 stylecheck: Annoying issue about not having a comment. The rare codebase has such comments\n - (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)\n \n # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments\n - exported (.+) should have comment( \\(or a comment on this block\\))? or be unexported\n \n # EXC0013 revive: Annoying issue about not having a comment. The rare codebase has such comments\n - package comment should be of the form \"(.+)...\n \n # EXC0014 revive: Annoying issue about not having a comment. The rare codebase has such comments\n - comment on exported (.+) should be of the form \"(.+)...\"\n \n # EXC0015 revive: Annoying issue about not having a comment. The rare codebase has such comments\n - should have a package comment\n (default true)\n --exclude-case-sensitive If set to true exclude and exclude rules regular expressions are case sensitive\n --max-issues-per-linter int Maximum issues count per one linter. Set to 0 to disable (default 50)\n --max-same-issues int Maximum count of issues with the same text. Set to 0 to disable (default 3)\n -n, --new Show only new issues: if there are unstaged changes or untracked files, only those changes are analyzed, else only changes in HEAD~ are analyzed.\n It's a super-useful option for integration of golangci-lint into existing large codebase.\n It's not practical to fix all existing issues at the moment of integration: much better to not allow issues in new code.\n For CI setups, prefer --new-from-rev=HEAD~, as --new can skip linting the current patch if any scripts generate unstaged files before golangci-lint runs.\n --new-from-rev REV Show only new issues created after git revision REV\n --new-from-patch PATH Show only new issues created in git patch with file path PATH\n --whole-files Show issues in any part of update files (requires new-from-rev or new-from-patch)\n --fix Fix found issues (if it's supported by the linter)\n -h, --help help for run\n\nGlobal Flags:\n --color string Use color when printing; can be 'always', 'auto', or 'never' (default \"auto\")\n -j, --concurrency int Number of CPUs to use (Default: number of logical CPUs) (default 8)\n --cpu-profile-path string Path to CPU profile output file\n --mem-profile-path string Path to memory profile output file\n --trace-path string Path to trace output file\n -v, --verbose Verbose output\n --version Print version\n" + "enable": "Enabled by default linters:\nerrcheck: errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases [fast: false, auto-fix: false]\ngosimple (megacheck): Linter for Go source code that specializes in simplifying code [fast: false, auto-fix: false]\ngovet (vet, vetshadow): Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes. [fast: false, auto-fix: false]\nineffassign: Detects when assignments to existing variables are not used [fast: true, auto-fix: false]\nstaticcheck (megacheck): It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint. [fast: false, auto-fix: false]\nunused (megacheck): Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]", + "help": "Usage:\n golangci-lint run [flags]\n\nFlags:\n -c, --config PATH Read config from file path PATH\n --no-config Don't read config file\n -D, --disable strings Disable specific linter\n --disable-all Disable all linters\n -E, --enable strings Enable specific linter\n --enable-all Enable all linters\n --fast Enable only fast linters from enabled linters set (first run won't be fast)\n -p, --presets strings Enable presets (bugs|comment|complexity|error|format|import|metalinter|module|performance|sql|style|test|unused) of linters. Run 'golangci-lint help linters' to see them. This option implies option --disable-all\n --enable-only strings Override linters configuration section to only run the specific linter(s)\n -j, --concurrency int Number of CPUs to use (Default: number of logical CPUs) (default 8)\n --modules-download-mode string Modules download mode. If not empty, passed as -mod=\u003cmode\u003e to go tools\n --issues-exit-code int Exit code when issues were found (default 1)\n --go string Targeted Go version\n --build-tags strings Build tags\n --timeout duration Timeout for total work (default 1m0s)\n --tests Analyze tests (*_test.go) (default true)\n --allow-parallel-runners Allow multiple parallel golangci-lint instances running. If false (default) - golangci-lint acquires file lock on start.\n --allow-serial-runners Allow multiple golangci-lint instances running, but serialize them around a lock. If false (default) - golangci-lint exits with an error if it fails to acquire file lock on start.\n --out-format string Formats of output: colored-line-number|line-number|json|tab|checkstyle|code-climate|html|junit-xml|github-actions|teamcity (default \"colored-line-number\")\n --print-issued-lines Print lines of code with issue (default true)\n --print-linter-name Print linter name in issue line (default true)\n --uniq-by-line Make issues output unique by line (default true)\n --sort-results Sort linter results\n --sort-order strings Sort order of linter results\n --path-prefix string Path prefix to add to output\n --show-stats Show statistics per linter\n -e, --exclude strings Exclude issue by regexp\n --exclude-use-default Use or not use default excludes:\n # EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok\n - Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked\n \n # EXC0002 golint: Annoying issue about not having a comment. The rare codebase has such comments\n - (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)\n \n # EXC0003 golint: False positive when tests are defined in package 'test'\n - func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this\n \n # EXC0004 govet: Common false positives\n - (possible misuse of unsafe.Pointer|should have signature)\n \n # EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore\n - ineffective break statement. Did you mean to break out of the outer loop\n \n # EXC0006 gosec: Too many false-positives on 'unsafe' usage\n - Use of unsafe calls should be audited\n \n # EXC0007 gosec: Too many false-positives for parametrized shell calls\n - Subprocess launch(ed with variable|ing should be audited)\n \n # EXC0008 gosec: Duplicated errcheck checks\n - (G104)\n \n # EXC0009 gosec: Too many issues in popular repos\n - (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)\n \n # EXC0010 gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)'\n - Potential file inclusion via variable\n \n # EXC0011 stylecheck: Annoying issue about not having a comment. The rare codebase has such comments\n - (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)\n \n # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments\n - exported (.+) should have comment( \\(or a comment on this block\\))? or be unexported\n \n # EXC0013 revive: Annoying issue about not having a comment. The rare codebase has such comments\n - package comment should be of the form \"(.+)...\n \n # EXC0014 revive: Annoying issue about not having a comment. The rare codebase has such comments\n - comment on exported (.+) should be of the form \"(.+)...\"\n \n # EXC0015 revive: Annoying issue about not having a comment. The rare codebase has such comments\n - should have a package comment\n (default true)\n --exclude-case-sensitive If set to true exclude and exclude rules regular expressions are case-sensitive\n --max-issues-per-linter int Maximum issues count per one linter. Set to 0 to disable (default 50)\n --max-same-issues int Maximum count of issues with the same text. Set to 0 to disable (default 3)\n --exclude-files strings Regexps of files to exclude\n --exclude-dirs strings Regexps of directories to exclude\n --exclude-dirs-use-default Use or not use default excluded directories:\n - (^|/)vendor($|/)\n - (^|/)third_party($|/)\n - (^|/)testdata($|/)\n - (^|/)examples($|/)\n - (^|/)Godeps($|/)\n - (^|/)builtin($|/)\n (default true)\n -n, --new Show only new issues: if there are unstaged changes or untracked files, only those changes are analyzed, else only changes in HEAD~ are analyzed.\n It's a super-useful option for integration of golangci-lint into existing large codebase.\n It's not practical to fix all existing issues at the moment of integration: much better to not allow issues in new code.\n For CI setups, prefer --new-from-rev=HEAD~, as --new can skip linting the current patch if any scripts generate unstaged files before golangci-lint runs.\n --new-from-rev REV Show only new issues created after git revision REV\n --new-from-patch PATH Show only new issues created in git patch with file path PATH\n --whole-files Show issues in any part of update files (requires new-from-rev or new-from-patch)\n --fix Fix found issues (if it's supported by the linter)\n --cpu-profile-path string Path to CPU profile output file\n --mem-profile-path string Path to memory profile output file\n --print-resources-usage Print avg and max memory usage of golangci-lint and total time\n --trace-path string Path to trace output file\n\nGlobal Flags:\n --color string Use color when printing; can be 'always', 'auto', or 'never' (default \"auto\")\n -h, --help Help for a command\n -v, --verbose Verbose output\n" } diff --git a/assets/linters-info.json b/assets/linters-info.json index eab346ceed01..9717b9fbfa39 100644 --- a/assets/linters-info.json +++ b/assets/linters-info.json @@ -1,6 +1,7 @@ [ { - "linter": {}, + "name": "asasalint", + "desc": "check for pass []any as any in variadic func(...any)", "loadMode": 575, "inPresets": [ "bugs" @@ -8,12 +9,11 @@ "originalURL": "https://github.com/alingse/asasalint", "internal": false, "isSlow": true, - "since": "1.47.0", - "name": "asasalint", - "desc": "check for pass []any as any in variadic func(...any)" + "since": "1.47.0" }, { - "linter": {}, + "name": "asciicheck", + "desc": "checks that all code identifiers does not have non-ASCII symbols in the name", "loadMode": 7, "inPresets": [ "bugs", @@ -22,12 +22,11 @@ "originalURL": "https://github.com/tdakkota/asciicheck", "internal": false, "isSlow": false, - "since": "v1.26.0", - "name": "asciicheck", - "desc": "checks that all code identifiers does not have non-ASCII symbols in the name" + "since": "v1.26.0" }, { - "linter": {}, + "name": "bidichk", + "desc": "Checks for dangerous unicode character sequences", "loadMode": 7, "inPresets": [ "bugs" @@ -35,12 +34,11 @@ "originalURL": "https://github.com/breml/bidichk", "internal": false, "isSlow": false, - "since": "1.43.0", - "name": "bidichk", - "desc": "Checks for dangerous unicode character sequences" + "since": "1.43.0" }, { - "linter": {}, + "name": "bodyclose", + "desc": "checks whether HTTP response body is closed successfully", "loadMode": 575, "inPresets": [ "performance", @@ -49,12 +47,11 @@ "originalURL": "https://github.com/timakin/bodyclose", "internal": false, "isSlow": true, - "since": "v1.18.0", - "name": "bodyclose", - "desc": "checks whether HTTP response body is closed successfully" + "since": "v1.18.0" }, { - "linter": {}, + "name": "containedctx", + "desc": "containedctx is a linter that detects struct contained context.Context field", "loadMode": 575, "inPresets": [ "style" @@ -62,12 +59,11 @@ "originalURL": "https://github.com/sivchari/containedctx", "internal": false, "isSlow": true, - "since": "1.44.0", - "name": "containedctx", - "desc": "containedctx is a linter that detects struct contained context.Context field" + "since": "1.44.0" }, { - "linter": {}, + "name": "contextcheck", + "desc": "check whether the function uses a non-inherited context", "loadMode": 575, "inPresets": [ "bugs" @@ -75,12 +71,23 @@ "originalURL": "https://github.com/kkHAIKE/contextcheck", "internal": false, "isSlow": true, - "since": "v1.43.0", - "name": "contextcheck", - "desc": "check whether the function uses a non-inherited context" + "since": "v1.43.0" }, { - "linter": {}, + "name": "copyloopvar", + "desc": "copyloopvar is a linter detects places where loop variables are copied", + "loadMode": 7, + "inPresets": [ + "style" + ], + "originalURL": "https://github.com/karamaru-alpha/copyloopvar", + "internal": false, + "isSlow": false, + "since": "v1.57.0" + }, + { + "name": "cyclop", + "desc": "checks function and package cyclomatic complexity", "loadMode": 575, "inPresets": [ "complexity" @@ -88,12 +95,11 @@ "originalURL": "https://github.com/bkielbasa/cyclop", "internal": false, "isSlow": true, - "since": "v1.37.0", - "name": "cyclop", - "desc": "checks function and package cyclomatic complexity" + "since": "v1.37.0" }, { - "linter": {}, + "name": "decorder", + "desc": "check declaration order and count of types, constants, variables and functions", "loadMode": 7, "inPresets": [ "format", @@ -102,12 +108,11 @@ "originalURL": "https://gitlab.com/bosi/decorder", "internal": false, "isSlow": false, - "since": "v1.44.0", - "name": "decorder", - "desc": "check declaration order and count of types, constants, variables and functions" + "since": "v1.44.0" }, { - "linter": {}, + "name": "deadcode", + "desc": "Deprecated", "loadMode": 575, "inPresets": [ "unused" @@ -120,12 +125,11 @@ "since": "v1.49.0", "message": "The owner seems to have abandoned the linter.", "replacement": "unused" - }, - "name": "deadcode", - "desc": "Finds unused code" + } }, { - "linter": {}, + "name": "depguard", + "desc": "Go linter that checks if package imports are in a list of acceptable packages", "loadMode": 7, "inPresets": [ "style", @@ -135,12 +139,11 @@ "originalURL": "https://github.com/OpenPeeDeeP/depguard", "internal": false, "isSlow": false, - "since": "v1.4.0", - "name": "depguard", - "desc": "Go linter that checks if package imports are in a list of acceptable packages" + "since": "v1.4.0" }, { - "linter": {}, + "name": "dogsled", + "desc": "Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())", "loadMode": 7, "inPresets": [ "style" @@ -148,12 +151,11 @@ "originalURL": "https://github.com/alexkohler/dogsled", "internal": false, "isSlow": false, - "since": "v1.19.0", - "name": "dogsled", - "desc": "Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())" + "since": "v1.19.0" }, { - "linter": {}, + "name": "dupl", + "desc": "Tool for code clone detection", "loadMode": 7, "inPresets": [ "style" @@ -161,26 +163,23 @@ "originalURL": "https://github.com/mibk/dupl", "internal": false, "isSlow": false, - "since": "v1.0.0", - "name": "dupl", - "desc": "Tool for code clone detection" + "since": "v1.0.0" }, { - "linter": {}, + "name": "dupword", + "desc": "checks for duplicate words in the source code", "loadMode": 7, "inPresets": [ "comment" ], "originalURL": "https://github.com/Abirdcfly/dupword", "internal": false, - "canAutoFix": true, "isSlow": false, - "since": "1.50.0", - "name": "dupword", - "desc": "checks for duplicate words in the source code" + "since": "1.50.0" }, { - "linter": {}, + "name": "durationcheck", + "desc": "check for two durations multiplied together", "loadMode": 575, "inPresets": [ "bugs" @@ -188,12 +187,11 @@ "originalURL": "https://github.com/charithe/durationcheck", "internal": false, "isSlow": true, - "since": "v1.37.0", - "name": "durationcheck", - "desc": "check for two durations multiplied together" + "since": "v1.37.0" }, { - "linter": {}, + "name": "errcheck", + "desc": "errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases", "enabledByDefault": true, "loadMode": 575, "inPresets": [ @@ -203,12 +201,11 @@ "originalURL": "https://github.com/kisielk/errcheck", "internal": false, "isSlow": true, - "since": "v1.0.0", - "name": "errcheck", - "desc": "errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases" + "since": "v1.0.0" }, { - "linter": {}, + "name": "errchkjson", + "desc": "Checks types passed to the json encoding functions. Reports unsupported types and reports occations, where the check for the returned error can be omitted.", "loadMode": 575, "inPresets": [ "bugs" @@ -216,12 +213,11 @@ "originalURL": "https://github.com/breml/errchkjson", "internal": false, "isSlow": true, - "since": "1.44.0", - "name": "errchkjson", - "desc": "Checks types passed to the json encoding functions. Reports unsupported types and reports occations, where the check for the returned error can be omitted." + "since": "1.44.0" }, { - "linter": {}, + "name": "errname", + "desc": "Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`.", "loadMode": 575, "inPresets": [ "style" @@ -229,12 +225,11 @@ "originalURL": "https://github.com/Antonboom/errname", "internal": false, "isSlow": true, - "since": "v1.42.0", - "name": "errname", - "desc": "Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`." + "since": "v1.42.0" }, { - "linter": {}, + "name": "errorlint", + "desc": "errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.", "loadMode": 575, "inPresets": [ "bugs", @@ -243,12 +238,11 @@ "originalURL": "https://github.com/polyfloyd/go-errorlint", "internal": false, "isSlow": true, - "since": "v1.32.0", - "name": "errorlint", - "desc": "errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13." + "since": "v1.32.0" }, { - "linter": {}, + "name": "execinquery", + "desc": "execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds", "loadMode": 575, "inPresets": [ "sql" @@ -256,12 +250,11 @@ "originalURL": "https://github.com/lufeee/execinquery", "internal": false, "isSlow": true, - "since": "v1.46.0", - "name": "execinquery", - "desc": "execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds" + "since": "v1.46.0" }, { - "linter": {}, + "name": "exhaustive", + "desc": "check exhaustiveness of enum switch statements", "loadMode": 575, "inPresets": [ "bugs" @@ -269,12 +262,11 @@ "originalURL": "https://github.com/nishanths/exhaustive", "internal": false, "isSlow": true, - "since": " v1.28.0", - "name": "exhaustive", - "desc": "check exhaustiveness of enum switch statements" + "since": " v1.28.0" }, { - "linter": {}, + "name": "exhaustivestruct", + "desc": "Deprecated", "loadMode": 575, "inPresets": [ "style", @@ -286,14 +278,13 @@ "since": "v1.32.0", "deprecation": { "since": "v1.46.0", - "message": "The owner seems to have abandoned the linter.", + "message": "The repository of the linter has been deprecated by the owner.", "replacement": "exhaustruct" - }, - "name": "exhaustivestruct", - "desc": "Checks if all struct's fields are initialized" + } }, { - "linter": {}, + "name": "exhaustruct", + "desc": "Checks if all structure fields are initialized", "loadMode": 575, "inPresets": [ "style", @@ -302,12 +293,11 @@ "originalURL": "https://github.com/GaijinEntertainment/go-exhaustruct", "internal": false, "isSlow": true, - "since": "v1.46.0", - "name": "exhaustruct", - "desc": "Checks if all structure fields are initialized" + "since": "v1.46.0" }, { - "linter": {}, + "name": "exportloopref", + "desc": "checks for pointers to enclosing loop variables", "loadMode": 575, "inPresets": [ "bugs" @@ -315,12 +305,11 @@ "originalURL": "https://github.com/kyoh86/exportloopref", "internal": false, "isSlow": true, - "since": "v1.28.0", - "name": "exportloopref", - "desc": "checks for pointers to enclosing loop variables" + "since": "v1.28.0" }, { - "linter": {}, + "name": "forbidigo", + "desc": "Forbids identifiers", "loadMode": 575, "inPresets": [ "style" @@ -328,12 +317,11 @@ "originalURL": "https://github.com/ashanbrown/forbidigo", "internal": false, "isSlow": true, - "since": "v1.34.0", - "name": "forbidigo", - "desc": "Forbids identifiers" + "since": "v1.34.0" }, { - "linter": {}, + "name": "forcetypeassert", + "desc": "finds forced type assertions", "loadMode": 7, "inPresets": [ "style" @@ -341,12 +329,11 @@ "originalURL": "https://github.com/gostaticanalysis/forcetypeassert", "internal": false, "isSlow": false, - "since": "v1.38.0", - "name": "forcetypeassert", - "desc": "finds forced type assertions" + "since": "v1.38.0" }, { - "linter": {}, + "name": "funlen", + "desc": "Tool for detection of long functions", "loadMode": 7, "inPresets": [ "complexity" @@ -354,12 +341,11 @@ "originalURL": "https://github.com/ultraware/funlen", "internal": false, "isSlow": false, - "since": "v1.18.0", - "name": "funlen", - "desc": "Tool for detection of long functions" + "since": "v1.18.0" }, { - "linter": {}, + "name": "gci", + "desc": "Gci controls Go package import order and makes it always deterministic.", "loadMode": 7, "inPresets": [ "format", @@ -368,12 +354,11 @@ "originalURL": "https://github.com/daixiang0/gci", "internal": false, "isSlow": false, - "since": "v1.30.0", - "name": "gci", - "desc": "Gci controls Go package import order and makes it always deterministic." + "since": "v1.30.0" }, { - "linter": {}, + "name": "ginkgolinter", + "desc": "enforces standards of using ginkgo and gomega", "loadMode": 575, "inPresets": [ "style" @@ -381,12 +366,11 @@ "originalURL": "https://github.com/nunnatsa/ginkgolinter", "internal": false, "isSlow": true, - "since": "v1.51.0", - "name": "ginkgolinter", - "desc": "enforces standards of using ginkgo and gomega" + "since": "v1.51.0" }, { - "linter": {}, + "name": "gocheckcompilerdirectives", + "desc": "Checks that go compiler directive comments (//go:) are valid.", "loadMode": 7, "inPresets": [ "bugs" @@ -394,12 +378,11 @@ "originalURL": "https://github.com/leighmcculloch/gocheckcompilerdirectives", "internal": false, "isSlow": false, - "since": "v1.51.0", - "name": "gocheckcompilerdirectives", - "desc": "Checks that go compiler directive comments (//go:) are valid." + "since": "v1.51.0" }, { - "linter": {}, + "name": "gochecknoglobals", + "desc": "Check that no global variables exist.", "loadMode": 575, "inPresets": [ "style" @@ -407,24 +390,22 @@ "originalURL": "https://github.com/leighmcculloch/gochecknoglobals", "internal": false, "isSlow": true, - "since": "v1.12.0", - "name": "gochecknoglobals", - "desc": "check that no global variables exist\n\nThis analyzer checks for global variables and errors on any found.\n\nA global variable is a variable declared in package scope and that can be read\nand written to by any function within the package. Global variables can cause\nside effects which are difficult to keep track of. A code in one function may\nchange the variables state while another unrelated chunk of code may be\neffected by it." + "since": "v1.12.0" }, { - "linter": {}, + "name": "gochecknoinits", + "desc": "Checks that no init functions are present in Go code", "loadMode": 7, "inPresets": [ "style" ], "internal": false, "isSlow": false, - "since": "v1.12.0", - "name": "gochecknoinits", - "desc": "Checks that no init functions are present in Go code" + "since": "v1.12.0" }, { - "linter": {}, + "name": "gochecksumtype", + "desc": "Run exhaustiveness checks on Go \"sum types\"", "loadMode": 575, "inPresets": [ "bugs" @@ -432,12 +413,11 @@ "originalURL": "https://github.com/alecthomas/go-check-sumtype", "internal": false, "isSlow": true, - "since": "v1.55.0", - "name": "gochecksumtype", - "desc": "Run exhaustiveness checks on Go \"sum types\"" + "since": "v1.55.0" }, { - "linter": {}, + "name": "gocognit", + "desc": "Computes and checks the cognitive complexity of functions", "loadMode": 7, "inPresets": [ "complexity" @@ -445,12 +425,11 @@ "originalURL": "https://github.com/uudashr/gocognit", "internal": false, "isSlow": false, - "since": "v1.20.0", - "name": "gocognit", - "desc": "Computes and checks the cognitive complexity of functions" + "since": "v1.20.0" }, { - "linter": {}, + "name": "goconst", + "desc": "Finds repeated strings that could be replaced by a constant", "loadMode": 7, "inPresets": [ "style" @@ -458,12 +437,11 @@ "originalURL": "https://github.com/jgautheron/goconst", "internal": false, "isSlow": false, - "since": "v1.0.0", - "name": "goconst", - "desc": "Finds repeated strings that could be replaced by a constant" + "since": "v1.0.0" }, { - "linter": {}, + "name": "gocritic", + "desc": "Provides diagnostics that check for bugs, performance and style issues.\nExtensible without recompilation through dynamic rules.\nDynamic rules are written declaratively with AST patterns, filters, report message and optional suggestion.", "loadMode": 575, "inPresets": [ "style", @@ -472,12 +450,11 @@ "originalURL": "https://github.com/go-critic/go-critic", "internal": false, "isSlow": true, - "since": "v1.12.0", - "name": "gocritic", - "desc": "Provides diagnostics that check for bugs, performance and style issues.\nExtensible without recompilation through dynamic rules.\nDynamic rules are written declaratively with AST patterns, filters, report message and optional suggestion." + "since": "v1.12.0" }, { - "linter": {}, + "name": "gocyclo", + "desc": "Computes and checks the cyclomatic complexity of functions", "loadMode": 7, "inPresets": [ "complexity" @@ -485,12 +462,11 @@ "originalURL": "https://github.com/fzipp/gocyclo", "internal": false, "isSlow": false, - "since": "v1.0.0", - "name": "gocyclo", - "desc": "Computes and checks the cyclomatic complexity of functions" + "since": "v1.0.0" }, { - "linter": {}, + "name": "godot", + "desc": "Check if comments end in a period", "loadMode": 7, "inPresets": [ "style", @@ -500,12 +476,11 @@ "internal": false, "canAutoFix": true, "isSlow": false, - "since": "v1.25.0", - "name": "godot", - "desc": "Check if comments end in a period" + "since": "v1.25.0" }, { - "linter": {}, + "name": "godox", + "desc": "Tool for detection of FIXME, TODO and other comment keywords", "loadMode": 7, "inPresets": [ "style", @@ -514,12 +489,11 @@ "originalURL": "https://github.com/matoous/godox", "internal": false, "isSlow": false, - "since": "v1.19.0", - "name": "godox", - "desc": "Tool for detection of FIXME, TODO and other comment keywords" + "since": "v1.19.0" }, { - "linter": {}, + "name": "goerr113", + "desc": "Go linter to check the errors handling expressions", "loadMode": 575, "inPresets": [ "style", @@ -528,12 +502,11 @@ "originalURL": "https://github.com/Djarvur/go-err113", "internal": false, "isSlow": true, - "since": "v1.26.0", - "name": "goerr113", - "desc": "Go linter to check the errors handling expressions" + "since": "v1.26.0" }, { - "linter": {}, + "name": "gofmt", + "desc": "Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification", "loadMode": 7, "inPresets": [ "format" @@ -542,12 +515,11 @@ "internal": false, "canAutoFix": true, "isSlow": false, - "since": "v1.0.0", - "name": "gofmt", - "desc": "Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification" + "since": "v1.0.0" }, { - "linter": {}, + "name": "gofumpt", + "desc": "Gofumpt checks whether code was gofumpt-ed.", "loadMode": 7, "inPresets": [ "format" @@ -556,12 +528,11 @@ "internal": false, "canAutoFix": true, "isSlow": false, - "since": "v1.28.0", - "name": "gofumpt", - "desc": "Gofumpt checks whether code was gofumpt-ed." + "since": "v1.28.0" }, { - "linter": {}, + "name": "goheader", + "desc": "Checks is file header matches to pattern", "loadMode": 7, "inPresets": [ "style" @@ -569,12 +540,11 @@ "originalURL": "https://github.com/denis-tingaikin/go-header", "internal": false, "isSlow": false, - "since": "v1.28.0", - "name": "goheader", - "desc": "Checks is file header matches to pattern" + "since": "v1.28.0" }, { - "linter": {}, + "name": "goimports", + "desc": "Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode.", "loadMode": 7, "inPresets": [ "format", @@ -584,12 +554,11 @@ "internal": false, "canAutoFix": true, "isSlow": false, - "since": "v1.20.0", - "name": "goimports", - "desc": "Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode." + "since": "v1.20.0" }, { - "linter": {}, + "name": "golint", + "desc": "Deprecated", "loadMode": 575, "inPresets": [ "style" @@ -602,12 +571,11 @@ "since": "v1.41.0", "message": "The repository of the linter has been archived by the owner.", "replacement": "revive" - }, - "name": "golint", - "desc": "Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes" + } }, { - "linter": {}, + "name": "gomnd", + "desc": "An analyzer to detect magic numbers.", "loadMode": 7, "inPresets": [ "style" @@ -615,12 +583,11 @@ "originalURL": "https://github.com/tommy-muehle/go-mnd", "internal": false, "isSlow": false, - "since": "v1.22.0", - "name": "gomnd", - "desc": "An analyzer to detect magic numbers." + "since": "v1.22.0" }, { - "linter": {}, + "name": "gomoddirectives", + "desc": "Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.", "loadMode": 7, "inPresets": [ "style", @@ -629,12 +596,11 @@ "originalURL": "https://github.com/ldez/gomoddirectives", "internal": false, "isSlow": false, - "since": "v1.39.0", - "name": "gomoddirectives", - "desc": "Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod." + "since": "v1.39.0" }, { - "linter": {}, + "name": "gomodguard", + "desc": "Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations.", "loadMode": 7, "inPresets": [ "style", @@ -644,12 +610,11 @@ "originalURL": "https://github.com/ryancurrah/gomodguard", "internal": false, "isSlow": false, - "since": "v1.25.0", - "name": "gomodguard", - "desc": "Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations." + "since": "v1.25.0" }, { - "linter": {}, + "name": "goprintffuncname", + "desc": "Checks that printf-like functions are named with `f` at the end.", "loadMode": 7, "inPresets": [ "style" @@ -657,12 +622,11 @@ "originalURL": "https://github.com/jirfag/go-printf-func-name", "internal": false, "isSlow": false, - "since": "v1.23.0", - "name": "goprintffuncname", - "desc": "Checks that printf-like functions are named with `f` at the end." + "since": "v1.23.0" }, { - "linter": {}, + "name": "gosec", + "desc": "Inspects source code for security problems", "loadMode": 575, "inPresets": [ "bugs" @@ -673,12 +637,11 @@ "originalURL": "https://github.com/securego/gosec", "internal": false, "isSlow": true, - "since": "v1.0.0", - "name": "gosec", - "desc": "Inspects source code for security problems" + "since": "v1.0.0" }, { - "linter": {}, + "name": "gosimple", + "desc": "Linter for Go source code that specializes in simplifying code", "enabledByDefault": true, "loadMode": 575, "inPresets": [ @@ -690,12 +653,11 @@ "originalURL": "https://github.com/dominikh/go-tools/tree/master/simple", "internal": false, "isSlow": true, - "since": "v1.20.0", - "name": "gosimple", - "desc": "Linter for Go source code that specializes in simplifying code" + "since": "v1.20.0" }, { - "linter": {}, + "name": "gosmopolitan", + "desc": "Report certain i18n/l10n anti-patterns in your Go codebase", "loadMode": 575, "inPresets": [ "bugs" @@ -703,12 +665,11 @@ "originalURL": "https://github.com/xen0n/gosmopolitan", "internal": false, "isSlow": true, - "since": "v1.53.0", - "name": "gosmopolitan", - "desc": "Report certain i18n/l10n anti-patterns in your Go codebase" + "since": "v1.53.0" }, { - "linter": {}, + "name": "govet", + "desc": "Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes.", "enabledByDefault": true, "loadMode": 575, "inPresets": [ @@ -722,12 +683,11 @@ "originalURL": "https://pkg.go.dev/cmd/vet", "internal": false, "isSlow": true, - "since": "v1.0.0", - "name": "govet", - "desc": "Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string" + "since": "v1.0.0" }, { - "linter": {}, + "name": "grouper", + "desc": "Analyze expression groups.", "loadMode": 7, "inPresets": [ "style" @@ -735,12 +695,11 @@ "originalURL": "https://github.com/leonklingele/grouper", "internal": false, "isSlow": false, - "since": "v1.44.0", - "name": "grouper", - "desc": "Analyze expression groups." + "since": "v1.44.0" }, { - "linter": {}, + "name": "ifshort", + "desc": "Deprecated", "loadMode": 7, "inPresets": [ "style" @@ -752,12 +711,11 @@ "deprecation": { "since": "v1.48.0", "message": "The repository of the linter has been deprecated by the owner." - }, - "name": "ifshort", - "desc": "Checks that your code uses short syntax for if-statements whenever possible." + } }, { - "linter": {}, + "name": "importas", + "desc": "Enforces consistent import aliases", "loadMode": 575, "inPresets": [ "style" @@ -765,12 +723,11 @@ "originalURL": "https://github.com/julz/importas", "internal": false, "isSlow": true, - "since": "v1.38.0", - "name": "importas", - "desc": "Enforces consistent import aliases" + "since": "v1.38.0" }, { - "linter": {}, + "name": "inamedparam", + "desc": "reports interfaces with unnamed method parameters", "loadMode": 7, "inPresets": [ "style" @@ -778,12 +735,11 @@ "originalURL": "https://github.com/macabu/inamedparam", "internal": false, "isSlow": false, - "since": "v1.55.0", - "name": "inamedparam", - "desc": "reports interfaces with unnamed method parameters" + "since": "v1.55.0" }, { - "linter": {}, + "name": "ineffassign", + "desc": "Detects when assignments to existing variables are not used", "enabledByDefault": true, "loadMode": 7, "inPresets": [ @@ -792,12 +748,11 @@ "originalURL": "https://github.com/gordonklaus/ineffassign", "internal": false, "isSlow": false, - "since": "v1.0.0", - "name": "ineffassign", - "desc": "Detects when assignments to existing variables are not used" + "since": "v1.0.0" }, { - "linter": {}, + "name": "interfacebloat", + "desc": "A linter that checks the number of methods inside an interface.", "loadMode": 7, "inPresets": [ "style" @@ -805,12 +760,11 @@ "originalURL": "https://github.com/sashamelentyev/interfacebloat", "internal": false, "isSlow": false, - "since": "v1.49.0", - "name": "interfacebloat", - "desc": "A linter that checks the number of methods inside an interface." + "since": "v1.49.0" }, { - "linter": {}, + "name": "interfacer", + "desc": "Deprecated", "loadMode": 575, "inPresets": [ "style" @@ -822,12 +776,20 @@ "deprecation": { "since": "v1.38.0", "message": "The repository of the linter has been archived by the owner." - }, - "name": "interfacer", - "desc": "Linter that suggests narrower interface types" + } + }, + { + "name": "intrange", + "desc": "intrange is a linter to find places where for loops could make use of an integer range.", + "loadMode": 7, + "originalURL": "https://github.com/ckaznocha/intrange", + "internal": false, + "isSlow": false, + "since": "v1.57.0" }, { - "linter": {}, + "name": "ireturn", + "desc": "Accept Interfaces, Return Concrete Types", "loadMode": 575, "inPresets": [ "style" @@ -835,24 +797,22 @@ "originalURL": "https://github.com/butuzov/ireturn", "internal": false, "isSlow": true, - "since": "v1.43.0", - "name": "ireturn", - "desc": "Accept Interfaces, Return Concrete Types" + "since": "v1.43.0" }, { - "linter": {}, + "name": "lll", + "desc": "Reports long lines", "loadMode": 7, "inPresets": [ "style" ], "internal": false, "isSlow": false, - "since": "v1.8.0", - "name": "lll", - "desc": "Reports long lines" + "since": "v1.8.0" }, { - "linter": {}, + "name": "loggercheck", + "desc": "Checks key value pairs for common logger libraries (kitlog,klog,logr,zap).", "loadMode": 575, "inPresets": [ "style", @@ -864,12 +824,11 @@ "originalURL": "https://github.com/timonwong/loggercheck", "internal": false, "isSlow": true, - "since": "v1.49.0", - "name": "loggercheck", - "desc": "Checks key value pairs for common logger libraries (kitlog,klog,logr,zap)." + "since": "v1.49.0" }, { - "linter": {}, + "name": "maintidx", + "desc": "maintidx measures the maintainability index of each function.", "loadMode": 7, "inPresets": [ "complexity" @@ -877,12 +836,11 @@ "originalURL": "https://github.com/yagipy/maintidx", "internal": false, "isSlow": false, - "since": "v1.44.0", - "name": "maintidx", - "desc": "maintidx measures the maintainability index of each function." + "since": "v1.44.0" }, { - "linter": {}, + "name": "makezero", + "desc": "Finds slice declarations with non-zero initial length", "loadMode": 575, "inPresets": [ "style", @@ -891,12 +849,11 @@ "originalURL": "https://github.com/ashanbrown/makezero", "internal": false, "isSlow": true, - "since": "v1.34.0", - "name": "makezero", - "desc": "Finds slice declarations with non-zero initial length" + "since": "v1.34.0" }, { - "linter": {}, + "name": "maligned", + "desc": "Deprecated", "loadMode": 575, "inPresets": [ "performance" @@ -909,12 +866,11 @@ "since": "v1.38.0", "message": "The repository of the linter has been archived by the owner.", "replacement": "govet 'fieldalignment'" - }, - "name": "maligned", - "desc": "Tool to detect Go structs that would take less memory if their fields were sorted" + } }, { - "linter": {}, + "name": "mirror", + "desc": "reports wrong mirror patterns of bytes/strings usage", "loadMode": 575, "inPresets": [ "style" @@ -922,12 +878,11 @@ "originalURL": "https://github.com/butuzov/mirror", "internal": false, "isSlow": true, - "since": "v1.53.0", - "name": "mirror", - "desc": "reports wrong mirror patterns of bytes/strings usage" + "since": "v1.53.0" }, { - "linter": {}, + "name": "misspell", + "desc": "Finds commonly misspelled English words", "loadMode": 7, "inPresets": [ "style", @@ -937,12 +892,11 @@ "internal": false, "canAutoFix": true, "isSlow": false, - "since": "v1.8.0", - "name": "misspell", - "desc": "Finds commonly misspelled English words" + "since": "v1.8.0" }, { - "linter": {}, + "name": "musttag", + "desc": "enforce field tags in (un)marshaled structs", "loadMode": 575, "inPresets": [ "style", @@ -951,12 +905,11 @@ "originalURL": "https://github.com/go-simpler/musttag", "internal": false, "isSlow": true, - "since": "v1.51.0", - "name": "musttag", - "desc": "enforce field tags in (un)marshaled structs" + "since": "v1.51.0" }, { - "linter": {}, + "name": "nakedret", + "desc": "Checks that functions with naked returns are not longer than a maximum size (can be zero).", "loadMode": 7, "inPresets": [ "style" @@ -964,12 +917,11 @@ "originalURL": "https://github.com/alexkohler/nakedret", "internal": false, "isSlow": false, - "since": "v1.19.0", - "name": "nakedret", - "desc": "Checks that functions with naked returns are not longer than a maximum size (can be zero)." + "since": "v1.19.0" }, { - "linter": {}, + "name": "nestif", + "desc": "Reports deeply nested if statements", "loadMode": 7, "inPresets": [ "complexity" @@ -977,12 +929,11 @@ "originalURL": "https://github.com/nakabonne/nestif", "internal": false, "isSlow": false, - "since": "v1.25.0", - "name": "nestif", - "desc": "Reports deeply nested if statements" + "since": "v1.25.0" }, { - "linter": {}, + "name": "nilerr", + "desc": "Finds the code that returns nil even if it checks that the error is not nil.", "loadMode": 575, "inPresets": [ "bugs" @@ -990,12 +941,11 @@ "originalURL": "https://github.com/gostaticanalysis/nilerr", "internal": false, "isSlow": true, - "since": "v1.38.0", - "name": "nilerr", - "desc": "Finds the code that returns nil even if it checks that the error is not nil." + "since": "v1.38.0" }, { - "linter": {}, + "name": "nilnil", + "desc": "Checks that there is no simultaneous return of `nil` error and an invalid value.", "loadMode": 575, "inPresets": [ "style" @@ -1003,12 +953,11 @@ "originalURL": "https://github.com/Antonboom/nilnil", "internal": false, "isSlow": true, - "since": "v1.43.0", - "name": "nilnil", - "desc": "Checks that there is no simultaneous return of `nil` error and an invalid value." + "since": "v1.43.0" }, { - "linter": {}, + "name": "nlreturn", + "desc": "nlreturn checks for a new line before return and branch statements to increase code clarity", "loadMode": 7, "inPresets": [ "style" @@ -1016,12 +965,11 @@ "originalURL": "https://github.com/ssgreg/nlreturn", "internal": false, "isSlow": false, - "since": "v1.30.0", - "name": "nlreturn", - "desc": "nlreturn checks for a new line before return and branch statements to increase code clarity" + "since": "v1.30.0" }, { - "linter": {}, + "name": "noctx", + "desc": "Finds sending http request without context.Context", "loadMode": 575, "inPresets": [ "performance", @@ -1030,12 +978,11 @@ "originalURL": "https://github.com/sonatard/noctx", "internal": false, "isSlow": true, - "since": "v1.28.0", - "name": "noctx", - "desc": "Finds sending http request without context.Context" + "since": "v1.28.0" }, { - "linter": {}, + "name": "nonamedreturns", + "desc": "Reports all named returns", "loadMode": 575, "inPresets": [ "style" @@ -1043,12 +990,11 @@ "originalURL": "https://github.com/firefart/nonamedreturns", "internal": false, "isSlow": true, - "since": "v1.46.0", - "name": "nonamedreturns", - "desc": "Reports all named returns" + "since": "v1.46.0" }, { - "linter": {}, + "name": "nosnakecase", + "desc": "Deprecated", "loadMode": 7, "inPresets": [ "style" @@ -1060,13 +1006,12 @@ "deprecation": { "since": "v1.48.1", "message": "The repository of the linter has been deprecated by the owner.", - "replacement": "revive(var-naming)" - }, - "name": "nosnakecase", - "desc": "nosnakecase is a linter that detects snake case of variable naming and function name." + "replacement": "revive 'var-naming'" + } }, { - "linter": {}, + "name": "nosprintfhostport", + "desc": "Checks for misuse of Sprintf to construct a host with port in a URL.", "loadMode": 7, "inPresets": [ "style" @@ -1074,12 +1019,11 @@ "originalURL": "https://github.com/stbenjam/no-sprintf-host-port", "internal": false, "isSlow": false, - "since": "v1.46.0", - "name": "nosprintfhostport", - "desc": "Checks for misuse of Sprintf to construct a host with port in a URL." + "since": "v1.46.0" }, { - "linter": {}, + "name": "paralleltest", + "desc": "Detects missing usage of t.Parallel() method in your Go test", "loadMode": 575, "inPresets": [ "style", @@ -1088,12 +1032,11 @@ "originalURL": "https://github.com/kunwardeep/paralleltest", "internal": false, "isSlow": true, - "since": "v1.33.0", - "name": "paralleltest", - "desc": "Detects missing usage of t.Parallel() method in your Go test" + "since": "v1.33.0" }, { - "linter": {}, + "name": "perfsprint", + "desc": "Checks that fmt.Sprintf can be replaced with a faster alternative.", "loadMode": 575, "inPresets": [ "performance" @@ -1101,12 +1044,11 @@ "originalURL": "https://github.com/catenacyber/perfsprint", "internal": false, "isSlow": true, - "since": "v1.55.0", - "name": "perfsprint", - "desc": "Checks that fmt.Sprintf can be replaced with a faster alternative." + "since": "v1.55.0" }, { - "linter": {}, + "name": "prealloc", + "desc": "Finds slice declarations that could potentially be pre-allocated", "loadMode": 7, "inPresets": [ "performance" @@ -1114,12 +1056,11 @@ "originalURL": "https://github.com/alexkohler/prealloc", "internal": false, "isSlow": false, - "since": "v1.19.0", - "name": "prealloc", - "desc": "Finds slice declarations that could potentially be pre-allocated" + "since": "v1.19.0" }, { - "linter": {}, + "name": "predeclared", + "desc": "find code that shadows one of Go's predeclared identifiers", "loadMode": 7, "inPresets": [ "style" @@ -1127,12 +1068,11 @@ "originalURL": "https://github.com/nishanths/predeclared", "internal": false, "isSlow": false, - "since": "v1.35.0", - "name": "predeclared", - "desc": "find code that shadows one of Go's predeclared identifiers" + "since": "v1.35.0" }, { - "linter": {}, + "name": "promlinter", + "desc": "Check Prometheus metrics naming via promlint", "loadMode": 7, "inPresets": [ "style" @@ -1140,12 +1080,11 @@ "originalURL": "https://github.com/yeya24/promlinter", "internal": false, "isSlow": false, - "since": "v1.40.0", - "name": "promlinter", - "desc": "Check Prometheus metrics naming via promlint" + "since": "v1.40.0" }, { - "linter": {}, + "name": "protogetter", + "desc": "Reports direct reads from proto message fields when getters should be used", "loadMode": 575, "inPresets": [ "bugs" @@ -1154,12 +1093,11 @@ "internal": false, "canAutoFix": true, "isSlow": true, - "since": "v1.55.0", - "name": "protogetter", - "desc": "Reports direct reads from proto message fields when getters should be used" + "since": "v1.55.0" }, { - "linter": {}, + "name": "reassign", + "desc": "Checks that package variables are not reassigned", "loadMode": 575, "inPresets": [ "bugs" @@ -1167,12 +1105,11 @@ "originalURL": "https://github.com/curioswitch/go-reassign", "internal": false, "isSlow": true, - "since": "1.49.0", - "name": "reassign", - "desc": "Checks that package variables are not reassigned" + "since": "1.49.0" }, { - "linter": {}, + "name": "revive", + "desc": "Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.", "loadMode": 7, "inPresets": [ "style", @@ -1181,12 +1118,11 @@ "originalURL": "https://github.com/mgechev/revive", "internal": false, "isSlow": true, - "since": "v1.37.0", - "name": "revive", - "desc": "Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint." + "since": "v1.37.0" }, { - "linter": {}, + "name": "rowserrcheck", + "desc": "checks whether Rows.Err of rows is checked successfully", "loadMode": 575, "inPresets": [ "bugs", @@ -1195,12 +1131,11 @@ "originalURL": "https://github.com/jingyugao/rowserrcheck", "internal": false, "isSlow": true, - "since": "v1.23.0", - "name": "rowserrcheck", - "desc": "checks whether Rows.Err of rows is checked successfully" + "since": "v1.23.0" }, { - "linter": {}, + "name": "sloglint", + "desc": "ensure consistent code style when using log/slog", "loadMode": 575, "inPresets": [ "style", @@ -1209,12 +1144,11 @@ "originalURL": "https://github.com/go-simpler/sloglint", "internal": false, "isSlow": true, - "since": "v1.55.0", - "name": "sloglint", - "desc": "ensure consistent code style when using log/slog" + "since": "v1.55.0" }, { - "linter": {}, + "name": "scopelint", + "desc": "Deprecated", "loadMode": 7, "inPresets": [ "bugs" @@ -1227,12 +1161,11 @@ "since": "v1.39.0", "message": "The repository of the linter has been deprecated by the owner.", "replacement": "exportloopref" - }, - "name": "scopelint", - "desc": "Scopelint checks for unpinned variables in go programs" + } }, { - "linter": {}, + "name": "sqlclosecheck", + "desc": "Checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed.", "loadMode": 575, "inPresets": [ "bugs", @@ -1241,12 +1174,11 @@ "originalURL": "https://github.com/ryanrolds/sqlclosecheck", "internal": false, "isSlow": true, - "since": "v1.28.0", - "name": "sqlclosecheck", - "desc": "Checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed." + "since": "v1.28.0" }, { - "linter": {}, + "name": "spancheck", + "desc": "Checks for mistakes with OpenTelemetry/Census spans.", "loadMode": 575, "inPresets": [ "bugs" @@ -1254,12 +1186,11 @@ "originalURL": "https://github.com/jjti/go-spancheck", "internal": false, "isSlow": true, - "since": "v1.56.0", - "name": "spancheck", - "desc": "Checks for mistakes with OpenTelemetry/Census spans." + "since": "v1.56.0" }, { - "linter": {}, + "name": "staticcheck", + "desc": "It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint.", "enabledByDefault": true, "loadMode": 575, "inPresets": [ @@ -1272,12 +1203,11 @@ "originalURL": "https://staticcheck.io/", "internal": false, "isSlow": true, - "since": "v1.0.0", - "name": "staticcheck", - "desc": "It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint." + "since": "v1.0.0" }, { - "linter": {}, + "name": "structcheck", + "desc": "Deprecated", "loadMode": 575, "inPresets": [ "unused" @@ -1290,12 +1220,11 @@ "since": "v1.49.0", "message": "The owner seems to have abandoned the linter.", "replacement": "unused" - }, - "name": "structcheck", - "desc": "Finds unused struct fields" + } }, { - "linter": {}, + "name": "stylecheck", + "desc": "Stylecheck is a replacement for golint", "loadMode": 575, "inPresets": [ "style" @@ -1303,12 +1232,11 @@ "originalURL": "https://github.com/dominikh/go-tools/tree/master/stylecheck", "internal": false, "isSlow": true, - "since": "v1.20.0", - "name": "stylecheck", - "desc": "Stylecheck is a replacement for golint" + "since": "v1.20.0" }, { - "linter": {}, + "name": "tagalign", + "desc": "check that struct tags are well aligned", "loadMode": 7, "inPresets": [ "style", @@ -1318,12 +1246,11 @@ "internal": false, "canAutoFix": true, "isSlow": false, - "since": "v1.53.0", - "name": "tagalign", - "desc": "check that struct tags are well aligned" + "since": "v1.53.0" }, { - "linter": {}, + "name": "tagliatelle", + "desc": "Checks the struct tags.", "loadMode": 7, "inPresets": [ "style" @@ -1331,12 +1258,11 @@ "originalURL": "https://github.com/ldez/tagliatelle", "internal": false, "isSlow": false, - "since": "v1.40.0", - "name": "tagliatelle", - "desc": "Checks the struct tags." + "since": "v1.40.0" }, { - "linter": {}, + "name": "tenv", + "desc": "tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17", "loadMode": 575, "inPresets": [ "style" @@ -1344,12 +1270,11 @@ "originalURL": "https://github.com/sivchari/tenv", "internal": false, "isSlow": true, - "since": "v1.43.0", - "name": "tenv", - "desc": "tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17" + "since": "v1.43.0" }, { - "linter": {}, + "name": "testableexamples", + "desc": "linter checks if examples are testable (have an expected output)", "loadMode": 7, "inPresets": [ "test" @@ -1357,12 +1282,11 @@ "originalURL": "https://github.com/maratori/testableexamples", "internal": false, "isSlow": false, - "since": "v1.50.0", - "name": "testableexamples", - "desc": "linter checks if examples are testable (have an expected output)" + "since": "v1.50.0" }, { - "linter": {}, + "name": "testifylint", + "desc": "Checks usage of github.com/stretchr/testify.", "loadMode": 575, "inPresets": [ "test", @@ -1371,12 +1295,11 @@ "originalURL": "https://github.com/Antonboom/testifylint", "internal": false, "isSlow": true, - "since": "v1.55.0", - "name": "testifylint", - "desc": "Checks usage of github.com/stretchr/testify." + "since": "v1.55.0" }, { - "linter": {}, + "name": "testpackage", + "desc": "linter that makes you use a separate _test package", "loadMode": 7, "inPresets": [ "style", @@ -1385,12 +1308,11 @@ "originalURL": "https://github.com/maratori/testpackage", "internal": false, "isSlow": false, - "since": "v1.25.0", - "name": "testpackage", - "desc": "linter that makes you use a separate _test package" + "since": "v1.25.0" }, { - "linter": {}, + "name": "thelper", + "desc": "thelper detects tests helpers which is not start with t.Helper() method.", "loadMode": 575, "inPresets": [ "style" @@ -1398,12 +1320,11 @@ "originalURL": "https://github.com/kulti/thelper", "internal": false, "isSlow": true, - "since": "v1.34.0", - "name": "thelper", - "desc": "thelper detects tests helpers which is not start with t.Helper() method." + "since": "v1.34.0" }, { - "linter": {}, + "name": "tparallel", + "desc": "tparallel detects inappropriate usage of t.Parallel() method in your Go test codes.", "loadMode": 575, "inPresets": [ "style", @@ -1412,12 +1333,11 @@ "originalURL": "https://github.com/moricho/tparallel", "internal": false, "isSlow": true, - "since": "v1.32.0", - "name": "tparallel", - "desc": "tparallel detects inappropriate usage of t.Parallel() method in your Go test codes." + "since": "v1.32.0" }, { - "linter": {}, + "name": "typecheck", + "desc": "Like the front-end of a Go compiler, parses and type-checks Go code", "enabledByDefault": true, "loadMode": 575, "inPresets": [ @@ -1425,12 +1345,11 @@ ], "internal": true, "isSlow": true, - "since": "v1.3.0", - "name": "typecheck", - "desc": "Like the front-end of a Go compiler, parses and type-checks Go code" + "since": "v1.3.0" }, { - "linter": {}, + "name": "unconvert", + "desc": "Remove unnecessary type conversions", "loadMode": 575, "inPresets": [ "style" @@ -1438,12 +1357,11 @@ "originalURL": "https://github.com/mdempsky/unconvert", "internal": false, "isSlow": true, - "since": "v1.0.0", - "name": "unconvert", - "desc": "Remove unnecessary type conversions" + "since": "v1.0.0" }, { - "linter": {}, + "name": "unparam", + "desc": "Reports unused function parameters", "loadMode": 575, "inPresets": [ "unused" @@ -1451,12 +1369,11 @@ "originalURL": "https://github.com/mvdan/unparam", "internal": false, "isSlow": true, - "since": "v1.9.0", - "name": "unparam", - "desc": "Reports unused function parameters" + "since": "v1.9.0" }, { - "linter": {}, + "name": "unused", + "desc": "Checks Go code for unused constants, variables, functions and types", "enabledByDefault": true, "loadMode": 575, "inPresets": [ @@ -1469,12 +1386,11 @@ "internal": false, "isSlow": true, "doesChangeTypes": true, - "since": "v1.20.0", - "name": "unused", - "desc": "Checks Go code for unused constants, variables, functions and types" + "since": "v1.20.0" }, { - "linter": {}, + "name": "usestdlibvars", + "desc": "A linter that detect the possibility to use variables/constants from the Go standard library.", "loadMode": 7, "inPresets": [ "style" @@ -1482,12 +1398,11 @@ "originalURL": "https://github.com/sashamelentyev/usestdlibvars", "internal": false, "isSlow": false, - "since": "v1.48.0", - "name": "usestdlibvars", - "desc": "A linter that detect the possibility to use variables/constants from the Go standard library." + "since": "v1.48.0" }, { - "linter": {}, + "name": "varcheck", + "desc": "Deprecated", "loadMode": 575, "inPresets": [ "unused" @@ -1500,12 +1415,11 @@ "since": "v1.49.0", "message": "The owner seems to have abandoned the linter.", "replacement": "unused" - }, - "name": "varcheck", - "desc": "Finds unused global variables and constants" + } }, { - "linter": {}, + "name": "varnamelen", + "desc": "checks that the length of a variable's name matches its scope", "loadMode": 575, "inPresets": [ "style" @@ -1513,12 +1427,11 @@ "originalURL": "https://github.com/blizzy78/varnamelen", "internal": false, "isSlow": true, - "since": "v1.43.0", - "name": "varnamelen", - "desc": "checks that the length of a variable's name matches its scope" + "since": "v1.43.0" }, { - "linter": {}, + "name": "wastedassign", + "desc": "Finds wasted assignment statements", "loadMode": 575, "inPresets": [ "style" @@ -1526,12 +1439,11 @@ "originalURL": "https://github.com/sanposhiho/wastedassign", "internal": false, "isSlow": true, - "since": "v1.38.0", - "name": "wastedassign", - "desc": "Finds wasted assignment statements" + "since": "v1.38.0" }, { - "linter": {}, + "name": "whitespace", + "desc": "Whitespace is a linter that checks for unnecessary newlines at the start and end of functions, if, for, etc.", "loadMode": 7, "inPresets": [ "style" @@ -1540,12 +1452,11 @@ "internal": false, "canAutoFix": true, "isSlow": false, - "since": "v1.19.0", - "name": "whitespace", - "desc": "Whitespace is a linter that checks for unnecessary newlines at the start and end of functions, if, for, etc." + "since": "v1.19.0" }, { - "linter": {}, + "name": "wrapcheck", + "desc": "Checks that errors returned from external packages are wrapped", "loadMode": 575, "inPresets": [ "style", @@ -1554,12 +1465,11 @@ "originalURL": "https://github.com/tomarrell/wrapcheck", "internal": false, "isSlow": true, - "since": "v1.32.0", - "name": "wrapcheck", - "desc": "Checks that errors returned from external packages are wrapped" + "since": "v1.32.0" }, { - "linter": {}, + "name": "wsl", + "desc": "add or remove empty lines", "loadMode": 7, "inPresets": [ "style" @@ -1567,12 +1477,11 @@ "originalURL": "https://github.com/bombsimon/wsl", "internal": false, "isSlow": false, - "since": "v1.20.0", - "name": "wsl", - "desc": "add or remove empty lines" + "since": "v1.20.0" }, { - "linter": {}, + "name": "zerologlint", + "desc": "Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg`", "loadMode": 575, "inPresets": [ "bugs" @@ -1580,12 +1489,11 @@ "originalURL": "https://github.com/ykadowak/zerologlint", "internal": false, "isSlow": true, - "since": "v1.53.0", - "name": "zerologlint", - "desc": "Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg`" + "since": "v1.53.0" }, { - "linter": {}, + "name": "nolintlint", + "desc": "Reports ill-formed or insufficient nolint directives", "loadMode": 7, "inPresets": [ "style" @@ -1593,8 +1501,6 @@ "originalURL": "https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/nolintlint/README.md", "internal": false, "isSlow": false, - "since": "v1.26.0", - "name": "nolintlint", - "desc": "Reports ill-formed or insufficient nolint directives" + "since": "v1.26.0" } ] diff --git a/jsonschema/golangci.jsonschema.json b/jsonschema/golangci.jsonschema.json index 0355f9b804ce..fb5c2a468cde 100644 --- a/jsonschema/golangci.jsonschema.json +++ b/jsonschema/golangci.jsonschema.json @@ -217,6 +217,7 @@ "bodyclose", "containedctx", "contextcheck", + "copyloopvar", "cyclop", "deadcode", "decorder", @@ -270,6 +271,7 @@ "ineffassign", "interfacebloat", "interfacer", + "intrange", "ireturn", "lll", "loggercheck", @@ -383,15 +385,18 @@ "additionalProperties": false } }, + "type": "object", + "additionalProperties": false, "properties": { "run": { "description": "Options for analysis running,", "type": "object", + "additionalProperties": false, "properties": { "concurrency": { "description": "Number of concurrent runners. Defaults to the number of available CPU cores.", "type": "integer", - "minimum": 1, + "minimum": 0, "examples": [4] }, "timeout": { @@ -420,33 +425,6 @@ "default": [], "examples": [["mytag"]] }, - "skip-dirs": { - "description": "Which directories to skip: issues from them won't be reported.", - "type": "array", - "items": { - "description": "You can use regexp here. The regexp is applied on the full path.\n\"/\" will be replaced by current OS file path separator to properly work on Windows.", - "type": "string", - "examples": ["generated.*"] - }, - "default": [], - "examples": [["src/external_libs", "autogenerated_by_my_lib"]] - }, - "skip-dirs-use-default": { - "description": "Enable skipping of directories \"vendor\", \"third_party\", \"testdata\", \"examples\", \"Godeps\", and \"builtin\".", - "type": "boolean", - "default": true - }, - "skip-files": { - "description": "Which files to skip: they will be analyzed, but issues from them will not be reported.", - "type": "array", - "items": { - "description": "You can use regexp here. There is no need to include all autogenerated files, we confidently recognize them. If that is not the case, please let us know.\n\"/\" will be replaced by current OS file path separator to properly work on Windows.", - "type": "string", - "examples": [".*\\.my\\.go$"] - }, - "default": [], - "examples": [[".*\\.my\\.go$", "lib/bad.go"]] - }, "modules-download-mode": { "description": "Option to pass to \"go list -mod={option}\".\nSee \"go help modules\" for more information.", "enum": ["mod", "readonly", "vendor"] @@ -461,37 +439,54 @@ "type": "boolean", "default": false }, - "print-resources-usage": { - "description": "Print avg and max memory usage of golangci-lint and total time.", - "type": "boolean", - "default": false - }, - "show-stats": { - "description": "Show statistics per linter.", - "type": "boolean", - "default": false - }, "go": { "description": "Targeted Go version.", "type": "string", "default": "1.17" } - }, - "additionalProperties": false + } }, "output": { "description": "Output configuration options.", "type": "object", + "additionalProperties": false, "properties": { - "format": { - "description": "Output format to use.", - "pattern": "^(,?(colored-line-number|line-number|json|colored-tab|tab|checkstyle|code-climate|junit-xml|github-actions|teamcity)(:[^,]+)?)+$", - "default": "colored-line-number", - "examples": [ - "colored-line-number", - "checkstyle:report.json,colored-line-number", - "line-number:golangci-lint.out,colored-line-number:stdout" - ] + "formats": { + "description": "Output formats to use.", + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "path": { + "default": "stdout", + "anyOf": [ + { + "enum": [ "stdout", "stderr" ] + }, + { + "type": "string" + } + ] + }, + "format": { + "default": "colored-line-number", + "enum": [ + "colored-line-number", + "line-number", + "json", + "colored-tab", + "tab", + "checkstyle", + "code-climate", + "junit-xml", + "github-actions", + "teamcity" + ] + } + }, + "required": ["format"] + } }, "print-issued-lines": { "description": "Print lines of code with issue.", @@ -513,17 +508,28 @@ "type": "string", "default": "" }, + "show-stats": { + "description": "Show statistics per linter.", + "type": "boolean", + "default": false + }, + "sort-order": { + "type": "array", + "items": { + "enum": ["linter", "severity", "file"] + } + }, "sort-results": { "description": "Sort results by: filepath, line and column.", "type": "boolean", "default": true } - }, - "additionalProperties": false + } }, "linters-settings": { "description": "All available settings of specific linters.", "type": "object", + "additionalProperties": false, "properties": { "dupword": { "type": "object", @@ -707,8 +713,8 @@ "patternProperties": { "^[^.]+$": { "description": "Name of a rule.", - "additionalProperties": false, "type": "object", + "additionalProperties": false, "properties": { "list-mode": { "description": "Used to determine the package matching priority.", @@ -733,11 +739,10 @@ }, "deny": { "description": "Packages that are not allowed where the value is a suggestion.", - "additionalProperties": false, "type": "array", "items": { - "additionalProperties": false, "type": "object", + "additionalProperties": false, "properties": { "desc": { "description": "Description", @@ -913,20 +918,6 @@ } } }, - "exhaustivestruct": { - "type": "object", - "additionalProperties": false, - "properties": { - "struct-patterns": { - "description": "Struct Patterns is list of expressions to match struct packages (written using `path` matching syntax)", - "type": "array", - "examples": ["^print.*$"], - "items": { - "type": "string" - } - } - } - }, "exhaustruct": { "type": "object", "additionalProperties": false, @@ -974,6 +965,7 @@ }, { "type": "object", + "additionalProperties": false, "properties": { "p": { "description": "Pattern", @@ -987,8 +979,7 @@ "description": "Message", "type": "string" } - }, - "additionalProperties": false + } } ] } @@ -1088,6 +1079,21 @@ "description": "Don't trigger warnings for HaveLen(0).", "type": "boolean", "default": false + }, + "force-expect-to": { + "description": "Force using `Expect` with `To`, `ToNot` or `NotTo`", + "type": "boolean", + "default": false + }, + "validate-async-intervals": { + "description": "Best effort validation of async intervals (timeout and polling).", + "type": "boolean", + "default": false + }, + "forbid-spec-pollution": { + "description": "Trigger a warning for variable assignments in ginkgo containers like `Describe`, `Context` and `When`, instead of in `BeforeEach()`.", + "type": "boolean", + "default": false } } }, @@ -1154,6 +1160,7 @@ }, "gocritic": { "type": "object", + "additionalProperties": false, "properties": { "enabled-checks": { "description": "Which checks should be enabled. By default, a list of stable checks is used. To see it, run `GL_DEBUG=gocritic golangci-lint run`.", @@ -1190,6 +1197,14 @@ "propertyNames": { "$ref": "#/definitions/gocritic-checks" } + }, + "disable-all": { + "type": "boolean", + "default": false + }, + "enable-all": { + "type": "boolean", + "default": false } } }, @@ -1265,6 +1280,7 @@ "type": "array", "items": { "type": "object", + "additionalProperties": false, "properties": { "pattern": { "type": "string" @@ -1272,8 +1288,7 @@ "replacement": { "type": "string" } - }, - "additionalProperties": false + } } } } @@ -1310,74 +1325,62 @@ }, "goheader": { "type": "object", - "allOf": [ - { + "additionalProperties": false, + "properties": { + "values": { + "type": "object", + "additionalProperties": false, "properties": { - "values": { + "const": { + "description": "Constants to use in the template.", "type": "object", - "properties": { - "const": { - "description": "Constants to use in the template.", - "type": "object", - "patternProperties": { - "^.+$": { - "description": "Value for the constant.", - "type": "string" - } - }, - "additionalProperties": false, - "examples": [ - { - "YEAR": "2030", - "COMPANY": "MY FUTURISTIC COMPANY" - } - ] - }, - "regexp": { - "description": "Regular expressions to use in your template.", - "type": "object", - "patternProperties": { - "^.+$": { - "type": "string" - } - }, - "additionalProperties": false, - "examples": [ - { - "AUTHOR": ".*@mycompany\\.com" - } - ] - } - } - } - } - }, - { - "oneOf": [ - { - "properties": { - "template": { - "description": "Template to put on top of every file.", - "type": "string", - "examples": [ - "{{ MY COMPANY }}\nSPDX-License-Identifier: Apache-2.0\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at:\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License." - ] + "patternProperties": { + "^.+$": { + "description": "Value for the constant.", + "type": "string" } }, - "required": ["template"] + "additionalProperties": false, + "examples": [ + { + "YEAR": "2030", + "COMPANY": "MY FUTURISTIC COMPANY" + } + ] }, - { - "properties": { - "template-path": { - "description": "Path to the file containing the template source.", - "type": "string", - "examples": ["my_header_template.txt"] + "regexp": { + "description": "Regular expressions to use in your template.", + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^.+$": { + "type": "string" } }, - "required": ["template-path"] + "examples": [ + { + "AUTHOR": ".*@mycompany\\.com" + } + ] } + } + }, + "template": { + "description": "Template to put on top of every file.", + "type": "string", + "examples": [ + "{{ MY COMPANY }}\nSPDX-License-Identifier: Apache-2.0\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at:\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License." ] + }, + "template-path": { + "description": "Path to the file containing the template source.", + "type": "string", + "examples": ["my_header_template.txt"] } + }, + "oneOf": [ + { "required": ["template"] }, + { "required": ["template-path"] } ] }, "goimports": { @@ -1391,61 +1394,10 @@ } } }, - "golint": { - "type": "object", - "additionalProperties": false, - "properties": { - "min-confidence": { - "description": "Minimum confidence for issues.", - "type": "number", - "minimum": 0, - "exclusiveMaximum": 1 - } - } - }, "gomnd": { "type": "object", "additionalProperties": false, "properties": { - "settings": { - "type": "object", - "properties": { - "mnd": { - "type": "object", - "properties": { - "ignored-files": { - "description": "Comma-separated list of file patterns to exclude from the analysis.", - "examples": ["magic1_.*.go"], - "type": "string" - }, - "ignored-functions": { - "description": "Comma-separated list of function patterns to exclude from the analysis.", - "examples": ["math.*,http.StatusText,make"], - "type": "string" - }, - "ignored-numbers": { - "description": "Comma-separated list of numbers to exclude from the analysis.", - "examples": ["1000,1234_567_890,3.14159264"], - "type": "string" - }, - "checks": { - "description": "The list of enabled checks.", - "type": "array", - "items": { - "enum": [ - "argument", - "case", - "condition", - "operation", - "return", - "assign" - ] - } - } - } - } - } - }, "ignored-files": { "description": "List of file patterns to exclude from analysis.", "examples": [["magic1_.*.go"]], @@ -1520,6 +1472,7 @@ "properties": { "allowed": { "type": "object", + "additionalProperties": false, "properties": { "modules": { "description": "List of allowed modules.", @@ -1541,6 +1494,7 @@ }, "blocked": { "type": "object", + "additionalProperties": false, "properties": { "modules": { "description": "List of blocked modules.", @@ -1550,6 +1504,7 @@ "patternProperties": { "^.+$": { "type": "object", + "additionalProperties": false, "properties": { "recommendations": { "description": "Recommended modules that should be used instead.", @@ -1576,6 +1531,7 @@ "patternProperties": { "^.*$": { "type": "object", + "additionalProperties": false, "properties": { "version": { "description": "Version constraint.", @@ -1705,11 +1661,6 @@ "type": "object", "additionalProperties": false, "properties": { - "check-shadowing": { - "description": "Report shadowed variables.", - "type": "boolean", - "default": true - }, "settings": { "description": "Settings per analyzer. Map of analyzer name to specific settings.\nRun `go tool vet help` to find out more.", "type": "object", @@ -1787,24 +1738,6 @@ } } }, - "ifshort": { - "type": "object", - "additionalProperties": false, - "properties": { - "max-decl-lines": { - "description": "maximum length of variable declaration measured in numbers of lines, after which the linter won't suggest using short syntax. Has precedence over max-decl-chars", - "type": "integer", - "minimum": 1, - "default": 1 - }, - "max-decl-chars": { - "description": "maximum length of variable declaration measured in number of characters, after which the linter won't suggest using short syntax.", - "type": "integer", - "minimum": 1, - "default": 30 - } - } - }, "importas": { "type": "object", "additionalProperties": false, @@ -1824,6 +1757,7 @@ "type": "array", "items": { "type": "object", + "additionalProperties": false, "properties": { "pkg": { "description": "Package path e.g. knative.dev/serving/pkg/apis/autoscaling/v1alpha1", @@ -1982,17 +1916,6 @@ } } }, - "maligned": { - "type": "object", - "additionalProperties": false, - "properties": { - "suggest-new": { - "description": "Whether to print struct with more effective memory layout.", - "type": "boolean", - "default": false - } - } - }, "misspell": { "description": "Correct spellings using locale preferences for US or UK. Default is to use a neutral variety of English.", "type": "object", @@ -2012,6 +1935,22 @@ "description": "Mode of the analysis.", "enum": ["restricted", "", "default"], "default": "" + }, + "extra-words": { + "description": "Extra word corrections.", + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "correction": { + "type": "string" + }, + "typo": { + "type": "string" + } + } + } } } }, @@ -2023,6 +1962,7 @@ "type": "array", "items": { "type": "object", + "additionalProperties": false, "properties": { "name": { "type": "string" @@ -2033,8 +1973,7 @@ "arg-pos": { "type": "integer" } - }, - "additionalProperties": false + } } } } @@ -2179,6 +2118,11 @@ "description": "Optimizes `fmt.Sprintf` with only one argument.", "type": "boolean", "default": true + }, + "strconcat": { + "description": "Optimizes into strings concatenation.", + "type": "boolean", + "default": true } } }, @@ -2320,6 +2264,7 @@ "type": "array", "items": { "type": "object", + "additionalProperties": false, "required": ["name"], "properties": { "name": { @@ -2333,6 +2278,12 @@ "type": "string", "enum": ["warning", "error"] }, + "exclude": { + "type": "array", + "items": { + "type": "string" + } + }, "arguments": { "type": "array" } @@ -2364,6 +2315,11 @@ "type": "boolean", "default": false }, + "no-global": { + "description": "Enforce not using global loggers.", + "enum": ["all", "default"], + "default": "default" + }, "no-mixed-args": { "description": "Enforce not mixing key-value pairs and attributes.", "type": "boolean", @@ -2653,6 +2609,7 @@ "properties": { "case": { "type": "object", + "additionalProperties": false, "properties": { "use-field-name": { "description": "Use the struct field name to check the name of the struct tag.", @@ -2699,6 +2656,16 @@ "type": "object", "additionalProperties": false, "properties": { + "bool-compare": { + "type": "object", + "additionalProperties": false, + "properties": { + "ignore-custom-types": { + "type": "boolean", + "default": false + } + } + }, "enable-all": { "description": "Enable all checkers.", "type": "boolean", @@ -2837,6 +2804,7 @@ }, "benchmark": { "type": "object", + "additionalProperties": false, "properties": { "begin": { "description": "Check if `b.Helper()` begins helper function.", @@ -2857,6 +2825,7 @@ }, "tb": { "type": "object", + "additionalProperties": false, "properties": { "begin": { "description": "Check if `tb.Helper()` begins helper function.", @@ -2877,6 +2846,7 @@ }, "fuzz": { "type": "object", + "additionalProperties": false, "properties": { "begin": { "description": "Check if `f.Helper()` begins helper function.", @@ -2963,6 +2933,20 @@ } } }, + "unconvert": { + "type": "object", + "additionalProperties": false, + "properties": { + "fast-math": { + "type": "boolean", + "default": false + }, + "safe": { + "type": "boolean", + "default": false + } + } + }, "unparam": { "type": "object", "additionalProperties": false, @@ -3015,17 +2999,6 @@ } } }, - "varcheck": { - "type": "object", - "additionalProperties": false, - "properties": { - "exported-fields": { - "description": "Check usage of exported variables", - "type": "boolean", - "default": false - } - } - }, "varnamelen": { "type": "object", "additionalProperties": false, @@ -3231,13 +3204,29 @@ } } }, + "copyloopvar": { + "type": "object", + "additionalProperties": false, + "properties": { + "ignore-alias": { + "type": "boolean", + "default": false + } + } + }, "custom": { "description": "The custom section can be used to define linter plugins to be loaded at runtime. See README of golangci-lint for more information.\nEach custom linter should have a unique name.", "type": "object", "patternProperties": { "^.*$": { "type": "object", + "additionalProperties": false, "properties": { + "type": { + "description": "The plugin type.", + "enum": ["module", "goplugin"], + "default": "goplugin" + }, "path": { "description": "The path to the plugin *.so. Can be absolute or local.", "type": "string", @@ -3250,17 +3239,30 @@ "original-url": { "description": "Intended to point to the repo location of the linter, for documentation purposes only.", "type": "string" + }, + "settings": { + "description": "Plugins settings/configuration. Only work with plugin based on `linterdb.PluginConstructor`.", + "type": "object" } }, - "required": ["path"] + "oneOf": [ + { + "properties": { + "type": {"enum": ["module"] } + } + }, + { + "required": ["path"] + } + ] } } } - }, - "additionalProperties": false + } }, "linters": { "type": "object", + "additionalProperties": false, "properties": { "enable": { "description": "List of enabled linters.", @@ -3312,11 +3314,11 @@ "type": "boolean", "default": false } - }, - "additionalProperties": false + } }, "issues": { "type": "object", + "additionalProperties": false, "properties": { "exclude": { "description": "List of regular expressions of issue texts to exclude.\nBut independently from this option we use default exclude patterns. Their usage can be controlled through `exclude-use-default`.", @@ -3330,6 +3332,7 @@ "type": "array", "items": { "type": "object", + "additionalProperties": false, "properties": { "path": { "type": "string" @@ -3362,6 +3365,38 @@ "type": "boolean", "default": false }, + "exclude-generated-strict": { + "description": "To follow strict Go generated file convention", + "type": "boolean", + "default": false + }, + "exclude-dirs": { + "description": "Which directories to exclude: issues from them won't be reported.", + "type": "array", + "items": { + "description": "You can use regexp here. The regexp is applied on the full path.\n\"/\" will be replaced by current OS file path separator to properly work on Windows.", + "type": "string", + "examples": ["generated.*"] + }, + "default": [], + "examples": [["src/external_libs", "autogenerated_by_my_lib"]] + }, + "exclude-dirs-use-default": { + "description": "Enable exclusion of directories \"vendor\", \"third_party\", \"testdata\", \"examples\", \"Godeps\", and \"builtin\".", + "type": "boolean", + "default": true + }, + "exclude-files": { + "description": "Which files to exclude: they will be analyzed, but issues from them will not be reported.", + "type": "array", + "items": { + "description": "You can use regexp here. There is no need to include all autogenerated files, we confidently recognize them. If that is not the case, please let us know.\n\"/\" will be replaced by current OS file path separator to properly work on Windows.", + "type": "string", + "examples": [".*\\.my\\.go$"] + }, + "default": [], + "examples": [[".*\\.my\\.go$", "lib/bad.go"]] + }, "include": { "description": "The list of ids of default excludes to include or disable.", "type": "array", @@ -3406,11 +3441,11 @@ "type": "boolean", "default": false } - }, - "additionalProperties": false + } }, "severity": { "type": "object", + "additionalProperties": false, "properties": { "default-severity": { "description": "Set the default severity for issues. If severity rules are defined and the issues do not match or no severity is provided to the rule this will be the default severity applied. Severities should match the supported severity names of the selected out format.", @@ -3450,13 +3485,13 @@ } } } - ] + ], + "required": ["severity"] }, "default": [] } }, - "additionalProperties": false + "required": ["default-severity"] } - }, - "type": "object" + } }