diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 38b1d26ed729..632605787381 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -20,6 +20,7 @@ linters: # Enable specific linter. enable: + - arangolint - asasalint - asciicheck - bidichk @@ -35,6 +36,7 @@ linters: - dupl - dupword - durationcheck + - embeddedstructfieldcheck - err113 - errcheck - errchkjson @@ -89,6 +91,7 @@ linters: - nilnil - nlreturn - noctx + - noinlineerr - nolintlint - nonamedreturns - nosprintfhostport @@ -123,10 +126,12 @@ linters: - whitespace - wrapcheck - wsl + - wsl_v5 - zerologlint - # Disable specific linter. + # Disable specific linters. disable: + - arangolint - asasalint - asciicheck - bidichk @@ -142,6 +147,7 @@ linters: - dupl - dupword - durationcheck + - embeddedstructfieldcheck - err113 - errcheck - errchkjson @@ -196,6 +202,7 @@ linters: - nilnil - nlreturn - noctx + - noinlineerr - nolintlint - nonamedreturns - nosprintfhostport @@ -230,6 +237,7 @@ linters: - whitespace - wrapcheck - wsl + - wsl_v5 - zerologlint # All available settings of specific linters. @@ -383,6 +391,11 @@ linters: ignore: - "0C0C" + embeddedstructfieldcheck: + # Checks that sync.Mutex and sync.RWMutex are not used as embedded fields. + # Default: false + forbid-mutex: true + errcheck: # Report about not checking of errors in type assertions: `a := b.(MyStruct)`. # Such cases aren't reported by default. @@ -406,6 +419,10 @@ linters: - io.Copy(*bytes.Buffer) - io.Copy(os.Stdout) + # Display function signature instead of selector. + # Default: false + verbose: true + errchkjson: # With check-error-free-encoding set to true, errchkjson does warn about errors # from json encoding functions that are safe to be ignored, @@ -541,6 +558,9 @@ linters: # Checks if the exported methods of a structure are placed before the non-exported ones. # Default: true struct-method: false + # Checks if the constructors and/or structure methods are sorted alphabetically. + # Default: false + alphabetical: true funlen: # Checks the number of lines in a function. @@ -1295,6 +1315,9 @@ linters: # Forbid the use of the `exclude` directives. # Default: false exclude-forbidden: true + # Forbid the use of the `ignore` directives (>= go1.25). + # Default: false + ignore-forbidden: true # Forbid the use of the `toolchain` directive. # Default: false toolchain-forbidden: true @@ -1599,6 +1622,8 @@ linters: - findcall # Report assembly that clobbers the frame pointer before saving it. - framepointer + # Check format of addresses passed to net.Dial. + - hostport # Report using Go 1.22 enhanced ServeMux patterns in older Go versions. - httpmux # Check for mistakes using HTTP responses. @@ -1682,6 +1707,7 @@ linters: - fieldalignment - findcall - framepointer + - hostport - httpmux - httpresponse - ifaceassert @@ -1776,6 +1802,7 @@ linters: - identical # Identifies interfaces in the same package that have identical method sets. - unused # Identifies interfaces that are not used anywhere in the same package where the interface is defined. - opaque # Identifies functions that return interfaces, but the actual returned value is always a single concrete implementation. + - unexported # Identifies interfaces that are not exported but are used in exported functions or methods. settings: unused: # List of packages path to exclude from the check. @@ -2302,11 +2329,12 @@ linters: disabled: false exclude: [""] arguments: - - - "call-chain" - - "loop" - - "method-call" - - "recover" - - "return" + - "call-chain" + - "loop" + - "method-call" + - "recover" + - "immediate-recover" + - "return" # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#dot-imports - name: dot-imports severity: warning @@ -2568,7 +2596,7 @@ linters: severity: warning disabled: false exclude: [""] - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redundant-test-main-exit + # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#redundant-test-main-exit - name: redundant-test-main-exit severity: warning disabled: false @@ -2608,6 +2636,11 @@ linters: exclude: [""] arguments: - "preserve-scope" + # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#time-date + - name: time-date + severity: warning + disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#time-equal - name: time-equal severity: warning @@ -2648,6 +2681,11 @@ linters: arguments: - "fmt.Printf" - "myFunction" + # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unnecessary-format + - name: unnecessary-format + severity: warning + disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unnecessary-stmt - name: unnecessary-stmt severity: warning @@ -2682,6 +2720,11 @@ linters: severity: warning disabled: false exclude: [""] + # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#use-fmt-print + - name: use-fmt-print + severity: warning + disabled: false + exclude: [""] # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#useless-break - name: useless-break severity: warning @@ -2812,6 +2855,7 @@ linters: http-status-code-whitelist: [ "200", "400", "404", "500" ] # SAxxxx checks in https://staticcheck.dev/docs/configuration/options/#checks # Example (to disable some checks): [ "all", "-SA1000", "-SA1001"] + # Run `GL_DEBUG=staticcheck golangci-lint run --enable=staticcheck` to see all available checks and enabled by config checks. # Default: ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022"] checks: # Invalid regular expression. @@ -3595,6 +3639,9 @@ linters: # Suggest the use of http.StatusXX. # Default: true http-status-code: false + # Suggest the use of time.Month in time.Date. + # Default: false + time-date-month: true # Suggest the use of time.Weekday.String(). # Default: true time-weekday: true @@ -3644,13 +3691,13 @@ linters: # Enable/disable `context.Background()` detections. # Disabled if Go < 1.24. - # Default: true - context-background: false + # Default: false + context-background: true # Enable/disable `context.TODO()` detections. # Disabled if Go < 1.24. - # Default: true - context-todo: false + # Default: false + context-todo: true unconvert: # Remove conversions that force intermediate rounding. @@ -3867,6 +3914,93 @@ linters: # Default: false force-short-decl-cuddling: true + wsl_v5: + # Allow cuddling a variable if it's used first in the immediate following block, + # even if the statement with the block doesn't use the variable. + # https://github.com/bombsimon/wsl/tree/main?tab=readme-ov-file#configuration + # Default: true + allow-first-in-block: false + + # Same as above, + # but allows cuddling if the variable is used anywhere in the following (or nested) block. + # https://github.com/bombsimon/wsl/tree/main?tab=readme-ov-file#configuration + # Default: false + allow-whole-block: true + + # If a block contains more than this number of lines, + # the branch statement needs to be separated by whitespace. + # https://github.com/bombsimon/wsl/tree/main?tab=readme-ov-file#configuration + # Default: 2 + branch-max-lines: 4 + + # If set to a non-negative number, + # case blocks need to end with whitespace if exceeding this number + # https://github.com/bombsimon/wsl/tree/main?tab=readme-ov-file#configuration + # Default: 0 + case-max-lines: 2 + + # Default checks to use. + # Can be `all`, `none`, `default` or empty. + # https://github.com/bombsimon/wsl/tree/main?tab=readme-ov-file#checks-and-configuration + # Default: "" + default: all + + # Enabled checks. + # Will be additive to any presets. + # https://github.com/bombsimon/wsl/tree/main?tab=readme-ov-file#checks-and-configuration + # Default: [] + enable: + - assign + - branch + - decl + - defer + - expr + - for + - go + - if + - inc-dec + - label + - range + - return + - select + - send + - switch + - type-switch + - append + - assign-exclusive + - assign-expr + - err + - leading-whitespace + - trailing-whitespace + + # Disable checks. + # Will be subtractive to any preset. + # https://github.com/bombsimon/wsl/tree/main?tab=readme-ov-file#checks-and-configuration + # Default: [] + disable: + - assign + - branch + - decl + - defer + - expr + - for + - go + - if + - inc-dec + - label + - range + - return + - select + - send + - switch + - type-switch + - append + - assign-exclusive + - assign-expr + - err + - leading-whitespace + - trailing-whitespace + # The custom section can be used to define linter plugins to be loaded at runtime. # See README documentation for more info. custom: @@ -3970,6 +4104,7 @@ formatters: - gofumpt - goimports - golines + - swaggo # Formatters settings. settings: @@ -4066,6 +4201,7 @@ formatters: # Default: lax generated: strict # Which file paths to exclude. + # This option is ignored when using `--stdin` as the path is unknown. # Default: [] paths: - ".*\\.my\\.go$" diff --git a/assets/cli-help.json b/assets/cli-help.json index 407240d603e0..b6baf18eaee8 100644 --- a/assets/cli-help.json +++ b/assets/cli-help.json @@ -1,5 +1,5 @@ { "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.\ngovet: Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes. [auto-fix]\nineffassign: Detects when assignments to existing variables are not used. [fast]\nstaticcheck: It's the set of rules from staticcheck. [auto-fix]\nunused: Checks Go code for unused constants, variables, functions and types.", - "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 --default string Default set of linters to enable (default \"standard\")\n -D, --disable strings Disable specific linter\n -E, --enable strings Enable specific linter\n --enable-only strings Override linters configuration section to only run the specific linter(s)\n --fast-only Filter enabled linters to run only fast linters\n -j, --concurrency int Number of CPUs to use (Default: Automatically set to match Linux container CPU quota and fall back to the number of logical CPUs in the machine)\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 --build-tags strings Build tags\n --timeout duration Timeout for total work. Disabled by default\n --tests Analyze tests (*_test.go) (default true)\n --allow-parallel-runners Allow multiple parallel golangci-lint instances running.\n 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.\n If false (default) - golangci-lint exits with an error if it fails to acquire file lock on start.\n --path-prefix string Path prefix to add to output\n --path-mode string Path mode to use (empty, or 'abs')\n --show-stats Show statistics per linter (default true)\n --output.text.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.text.print-linter-name Print linter name in the end of issue text. (default true)\n --output.text.print-issued-lines Print lines of code with issue. (default true)\n --output.text.colors Use colors. (default true)\n --output.json.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.tab.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.tab.print-linter-name Print linter name in the end of issue text. (default true)\n --output.tab.colors Use colors. (default true)\n --output.html.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.checkstyle.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.code-climate.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.junit-xml.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.junit-xml.extended Support extra JUnit XML fields.\n --output.teamcity.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.sarif.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\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 --uniq-by-line Make issues output unique by line (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 --new-from-merge-base string Show only new issues created after the best common ancestor (merge-base against HEAD)\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", + "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 --default string Default set of linters to enable (default \"standard\")\n -D, --disable strings Disable specific linter\n -E, --enable strings Enable specific linter\n --enable-only strings Override linters configuration section to only run the specific linter(s)\n --fast-only Filter enabled linters to run only fast linters\n -j, --concurrency int Number of CPUs to use (Default: Automatically set to match Linux container CPU quota and fall back to the number of logical CPUs in the machine)\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 --build-tags strings Build tags\n --timeout duration Timeout for total work. Disabled by default\n --tests Analyze tests (*_test.go) (default true)\n --allow-parallel-runners Allow multiple parallel golangci-lint instances running.\n 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.\n If false (default) - golangci-lint exits with an error if it fails to acquire file lock on start.\n --path-prefix string Path prefix to add to output\n --path-mode string Path mode to use (empty, or 'abs')\n --show-stats Show statistics per linter (default true)\n --output.text.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.text.print-linter-name Print linter name in the end of issue text. (default true)\n --output.text.print-issued-lines Print lines of code with issue. (default true)\n --output.text.colors Use colors. (default true)\n --output.json.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.tab.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.tab.print-linter-name Print linter name in the end of issue text. (default true)\n --output.tab.colors Use colors. (default true)\n --output.html.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.checkstyle.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.code-climate.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.junit-xml.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.junit-xml.extended Support extra JUnit XML fields.\n --output.teamcity.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\n --output.sarif.path stdout Output path can be either stdout, `stderr` or path to the file to write to.\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 --uniq-by-line Make issues output unique by line (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 --new-from-merge-base string Show only new issues created after the best common ancestor (merge-base against HEAD)\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 --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", "fmtHelp": "Usage:\n golangci-lint fmt [flags]\n\nFlags:\n -c, --config PATH Read config from file path PATH\n --no-config Don't read config file\n -E, --enable strings Enable specific formatter\n -d, --diff Display diffs instead of rewriting files\n --diff-colored Display diffs instead of rewriting files (with colors)\n --stdin Use standard input for piping source files\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/formatters-info.json b/assets/formatters-info.json index 8d8c7caf1819..e25c10e2f7f7 100644 --- a/assets/formatters-info.json +++ b/assets/formatters-info.json @@ -1,7 +1,7 @@ [ { "name": "gci", - "desc": "Checks if code and import statements are formatted, with additional rules.", + "desc": "Check if code and import statements are formatted, with additional rules.", "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/daixiang0/gci", @@ -12,7 +12,7 @@ }, { "name": "gofmt", - "desc": "Checks if the code is formatted according to 'gofmt' command.", + "desc": "Check if the code is formatted according to 'gofmt' command.", "Groups": null, "loadMode": 8199, "originalURL": "https://pkg.go.dev/cmd/gofmt", @@ -23,7 +23,7 @@ }, { "name": "gofumpt", - "desc": "Checks if code and import statements are formatted, with additional rules.", + "desc": "Check if code and import statements are formatted, with additional rules.", "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/mvdan/gofumpt", @@ -53,5 +53,16 @@ "canAutoFix": true, "isSlow": false, "since": "v1.20.0" + }, + { + "name": "swaggo", + "desc": "Check if swaggo comments are formatted", + "Groups": null, + "loadMode": 8199, + "originalURL": "https://github.com/swaggo/swaggo", + "internal": false, + "canAutoFix": true, + "isSlow": false, + "since": "v2.2.0" } ] diff --git a/assets/github-action-config-v1.json b/assets/github-action-config-v1.json index 28c21d7b0786..f5cfae5a16a5 100644 --- a/assets/github-action-config-v1.json +++ b/assets/github-action-config-v1.json @@ -194,6 +194,9 @@ }, "v2.1": { "Error": "golangci-lint version 'v2.1' isn't supported: only v1 versions are supported" + }, + "v2.2": { + "Error": "golangci-lint version 'v2.1' isn't supported: only v1 versions are supported" } } } diff --git a/assets/github-action-config-v2.json b/assets/github-action-config-v2.json index 2a099a8ff534..c0f5a8b27af7 100644 --- a/assets/github-action-config-v2.json +++ b/assets/github-action-config-v2.json @@ -194,6 +194,9 @@ }, "v2.1": { "TargetVersion": "v2.1.6" + }, + "v2.2": { + "TargetVersion": "v2.2.0" } } } diff --git a/assets/github-action-config.json b/assets/github-action-config.json index 28c21d7b0786..f5cfae5a16a5 100644 --- a/assets/github-action-config.json +++ b/assets/github-action-config.json @@ -194,6 +194,9 @@ }, "v2.1": { "Error": "golangci-lint version 'v2.1' isn't supported: only v1 versions are supported" + }, + "v2.2": { + "Error": "golangci-lint version 'v2.1' isn't supported: only v1 versions are supported" } } } diff --git a/assets/linters-info.json b/assets/linters-info.json index 99ffd81b0865..10bd6eb4b5c4 100644 --- a/assets/linters-info.json +++ b/assets/linters-info.json @@ -1,4 +1,14 @@ [ + { + "name": "arangolint", + "desc": "opinionated best practices for arangodb client", + "Groups": null, + "loadMode": 8767, + "originalURL": "https://github.com/Crocmagnon/arangolint", + "internal": false, + "isSlow": true, + "since": "v2.2.0" + }, { "name": "asasalint", "desc": "check for pass []any as any in variadic func(...any)", @@ -133,7 +143,7 @@ }, { "name": "dupword", - "desc": "checks for duplicate words in the source code", + "desc": "Checks for duplicate words in the source code", "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/Abirdcfly/dupword", @@ -152,6 +162,16 @@ "isSlow": true, "since": "v1.37.0" }, + { + "name": "embeddedstructfieldcheck", + "desc": "Embedded types should be at the top of the field list of a struct, and there must be an empty line separating embedded fields from regular fields.", + "Groups": null, + "loadMode": 8199, + "originalURL": "https://github.com/manuelarte/embeddedstructfieldcheck", + "internal": false, + "isSlow": false, + "since": "v2.2.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", @@ -186,7 +206,7 @@ }, { "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.", + "desc": "Find code that can cause problems with the error wrapping scheme introduced in Go 1.13.", "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/polyfloyd/go-errorlint", @@ -238,7 +258,7 @@ }, { "name": "forcetypeassert", - "desc": "finds forced type assertions", + "desc": "Find forced type assertions", "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/gostaticanalysis/forcetypeassert", @@ -391,7 +411,7 @@ }, { "name": "err113", - "desc": "Go linter to check the errors handling expressions", + "desc": "Check errors handling expressions", "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/Djarvur/go-err113", @@ -402,7 +422,7 @@ }, { "name": "goheader", - "desc": "Checks if file header matches to pattern", + "desc": "Check if file header matches to pattern", "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/denis-tingaikin/go-header", @@ -433,7 +453,7 @@ }, { "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.", + "desc": "Allow and blocklist linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations.", "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/ryancurrah/gomodguard", @@ -600,7 +620,7 @@ }, { "name": "makezero", - "desc": "Finds slice declarations with non-zero initial length", + "desc": "Find slice declarations with non-zero initial length", "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/ashanbrown/makezero", @@ -663,7 +683,7 @@ }, { "name": "nilerr", - "desc": "Finds the code that returns nil even if it checks that the error is not nil.", + "desc": "Find the code that returns nil even if it checks that the error is not nil.", "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/gostaticanalysis/nilerr", @@ -693,7 +713,7 @@ }, { "name": "nlreturn", - "desc": "nlreturn checks for a new line before return and branch statements to increase code clarity", + "desc": "Checks for a new line before return and branch statements to increase code clarity", "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/ssgreg/nlreturn", @@ -704,7 +724,7 @@ }, { "name": "noctx", - "desc": "Finds sending http request without context.Context", + "desc": "Detects function and method with missing usage of context.Context", "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/sonatard/noctx", @@ -712,6 +732,16 @@ "isSlow": true, "since": "v1.28.0" }, + { + "name": "noinlineerr", + "desc": "Disallows inline error handling (`if err := ...; err != nil {`)", + "Groups": null, + "loadMode": 8767, + "originalURL": "https://github.com/AlwxSin/noinlineerr", + "internal": false, + "isSlow": true, + "since": "v2.2.0" + }, { "name": "nonamedreturns", "desc": "Reports all named returns", @@ -755,7 +785,7 @@ }, { "name": "prealloc", - "desc": "Finds slice declarations that could potentially be pre-allocated", + "desc": "Find slice declarations that could potentially be pre-allocated", "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/alexkohler/prealloc", @@ -1065,7 +1095,23 @@ "internal": false, "canAutoFix": true, "isSlow": false, - "since": "v1.20.0" + "since": "v1.20.0", + "deprecation": { + "since": "v2.2.0", + "message": "new major version.", + "replacement": "wsl_v5" + } + }, + { + "name": "wsl_v5", + "desc": "add or remove empty lines", + "Groups": null, + "loadMode": 8767, + "originalURL": "https://github.com/bombsimon/wsl", + "internal": false, + "canAutoFix": true, + "isSlow": true, + "since": "v2.2.0" }, { "name": "zerologlint", diff --git a/jsonschema/golangci.jsonschema.json b/jsonschema/golangci.jsonschema.json index 0f2ef5fcc50b..5c867a4d8415 100644 --- a/jsonschema/golangci.jsonschema.json +++ b/jsonschema/golangci.jsonschema.json @@ -539,6 +539,7 @@ "fieldalignment", "findcall", "framepointer", + "hostport", "httpmux", "httpresponse", "ifaceassert", @@ -637,6 +638,7 @@ "string-of-int", "struct-tag", "superfluous-else", + "time-date", "time-equal", "time-naming", "unchecked-type-assertion", @@ -644,12 +646,14 @@ "unexported-naming", "unexported-return", "unhandled-error", + "unnecessary-format", "unnecessary-stmt", "unreachable-code", "unused-parameter", "unused-receiver", "use-any", "use-errors-new", + "use-fmt-print", "useless-break", "var-declaration", "var-naming", @@ -660,7 +664,8 @@ "enum": [ "identical", "unused", - "opaque" + "opaque", + "unexported" ] }, "tagliatelle-cases": { @@ -680,6 +685,32 @@ "header" ] }, + "wsl-checks": { + "enum": [ + "assign", + "branch", + "decl", + "defer", + "expr", + "for", + "go", + "if", + "inc-dec", + "label", + "range", + "return", + "select", + "send", + "switch", + "type-switch", + "append", + "assign-exclusive", + "assign-expr", + "err", + "leading-whitespace", + "trailing-whitespace" + ] + }, "relative-path-modes": { "enum": [ "gomod", @@ -717,6 +748,7 @@ "anyOf": [ { "enum": [ + "arangolint", "asasalint", "asciicheck", "bidichk", @@ -732,6 +764,7 @@ "dupl", "dupword", "durationcheck", + "embeddedstructfieldcheck", "errcheck", "errchkjson", "errname", @@ -787,6 +820,7 @@ "nilnil", "nlreturn", "noctx", + "noinlineerr", "nolintlint", "nonamedreturns", "nosprintfhostport", @@ -821,6 +855,7 @@ "whitespace", "wrapcheck", "wsl", + "wsl_v5", "zerologlint" ] }, @@ -836,7 +871,8 @@ "gofmt", "gofumpt", "goimports", - "golines" + "golines", + "swaggo" ] }, "settings": { @@ -1085,6 +1121,17 @@ } } }, + "embeddedstructfieldcheckSettings": { + "type": "object", + "additionalProperties": false, + "properties": { + "forbid-mutex": { + "description": "Checks that sync.Mutex and sync.RWMutex are not used as embedded fields.", + "type": "boolean", + "default": false + } + } + }, "errcheckSettings": { "type": "object", "additionalProperties": false, @@ -1111,6 +1158,11 @@ "description": "To disable the errcheck built-in exclude list", "type": "boolean", "default": false + }, + "verbose": { + "description": "Display function signature instead of selector", + "type": "boolean", + "default": false } } }, @@ -1317,6 +1369,11 @@ "description": "Checks if the exported methods of a structure are placed before the non-exported ones.", "type": "boolean", "default": true + }, + "alphabetical": { + "description": "Checks if the constructors and/or structure methods are sorted alphabetically.", + "type": "boolean", + "default": false } } }, @@ -1974,6 +2031,11 @@ "type": "boolean", "default": false }, + "ignore-forbidden": { + "description": "Forbid the use of the `ignore` directives. (>= go1.25)", + "type": "boolean", + "default": false + }, "toolchain-forbidden": { "description": "Forbid the use of the `toolchain` directive.", "type": "boolean", @@ -3702,6 +3764,11 @@ "type": "boolean", "default": false }, + "time-date-month": { + "description": "Suggest the use of time.Month in time.Date.", + "type": "boolean", + "default": false + }, "crypto-hash": { "description": "Suggest the use of crypto.Hash.String().", "type": "boolean", @@ -3735,11 +3802,11 @@ "properties": { "context-background": { "type": "boolean", - "default": true + "default": false }, "context-todo": { "type": "boolean", - "default": true + "default": false }, "os-chdir": { "type": "boolean", @@ -4050,6 +4117,44 @@ } } }, + "wslSettingsV5": { + "type": "object", + "additionalProperties": false, + "properties": { + "allow-first-in-block": { + "type": "boolean", + "default": true + }, + "allow-whole-block": { + "type": "boolean", + "default": false + }, + "branch-max-lines": { + "type": "integer", + "default": 2 + }, + "case-max-lines": { + "type": "integer", + "default": 0 + }, + "default": { + "enum": ["all", "none", "default", ""], + "default": "default" + }, + "enable": { + "type": "array", + "items": { + "$ref": "#/definitions/wsl-checks" + } + }, + "disable": { + "type": "array", + "items": { + "$ref": "#/definitions/wsl-checks" + } + } + } + }, "copyloopvarSettings": { "type": "object", "additionalProperties": false, @@ -4342,6 +4447,9 @@ "dupl": { "$ref": "#/definitions/settings/definitions/duplSettings" }, + "embeddedstructfieldcheck": { + "$ref": "#/definitions/settings/definitions/embeddedstructfieldcheckSettings" + }, "errcheck": { "$ref": "#/definitions/settings/definitions/errcheckSettings" }, @@ -4549,6 +4657,9 @@ "wsl": { "$ref": "#/definitions/settings/definitions/wslSettings" }, + "wsl_v5": { + "$ref": "#/definitions/settings/definitions/wslSettingsV5" + }, "copyloopvar": { "$ref": "#/definitions/settings/definitions/copyloopvarSettings" },