From 2a97350ee20c431d54e9b79041374e948b660c51 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 25 Feb 2025 16:16:23 +0100 Subject: [PATCH 1/9] docs: add formatters exclusions reference --- .golangci.next.reference.yml | 21 +++++++++++++++++++-- jsonschema/golangci.next.jsonschema.json | 4 ++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.golangci.next.reference.yml b/.golangci.next.reference.yml index c4376c516399..0cbd4dbd7d39 100644 --- a/.golangci.next.reference.yml +++ b/.golangci.next.reference.yml @@ -1372,7 +1372,7 @@ linters: - G504 # Import blocklist: net/http/cgi - G505 # Import blocklist: crypto/sha1 - G506 # Import blocklist: golang.org/x/crypto/md4 - - G507 #Import blocklist: golang.org/x/crypto/ripemd160 + - G507 # Import blocklist: golang.org/x/crypto/ripemd160 - G601 # Implicit memory aliasing of items from a range statement - G602 # Slice access out of bounds @@ -1417,7 +1417,7 @@ linters: - G504 # Import blocklist: net/http/cgi - G505 # Import blocklist: crypto/sha1 - G506 # Import blocklist: golang.org/x/crypto/md4 - - G507 #Import blocklist: golang.org/x/crypto/ripemd160 + - G507 # Import blocklist: golang.org/x/crypto/ripemd160 - G601 # Implicit memory aliasing of items from a range statement - G602 # Slice access out of bounds @@ -3983,6 +3983,23 @@ formatters: # Default: true chain-split-dots: false + exclusions: + # Mode of the generated files analysis. + # + # - `strict`: sources are excluded by strictly following the Go generated file convention. + # 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 + # - `lax`: sources are excluded if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc. + # - `disable`: disable the generated files exclusion. + # + # Default: lax + generated: strict + # Which file paths to exclude. + # Default: [] + paths: + - ".*\\.my\\.go$" + - lib/bad.go issues: # Maximum issues count per one linter. diff --git a/jsonschema/golangci.next.jsonschema.json b/jsonschema/golangci.next.jsonschema.json index f1293f3d3481..d668392987cd 100644 --- a/jsonschema/golangci.next.jsonschema.json +++ b/jsonschema/golangci.next.jsonschema.json @@ -4584,8 +4584,8 @@ "additionalProperties": false, "properties": { "generated": { - "type": "boolean", - "default": true + "enum": ["strict", "lax", "disable"], + "default": "strict" }, "paths": { "type": "array", From 1b9e35794a421b9da9a96423a7c7b46f8ea9af56 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 25 Feb 2025 15:56:19 +0100 Subject: [PATCH 2/9] feat: formatters dump --- .custom-gcl.reference.yml | 2 +- assets/cli-help.json | 4 +- assets/exclusion-presets.json | 4 +- assets/formatters-info.json | 57 +++++++++ assets/linters-info.json | 193 ++++++++++++++++++------------ scripts/website/dump_info/main.go | 51 ++++++++ 6 files changed, 228 insertions(+), 83 deletions(-) create mode 100644 assets/formatters-info.json diff --git a/.custom-gcl.reference.yml b/.custom-gcl.reference.yml index 08d7dfc681ec..8f8b26e5c590 100644 --- a/.custom-gcl.reference.yml +++ b/.custom-gcl.reference.yml @@ -1,6 +1,6 @@ # The golangci-lint version used to build the custom binary. # Require. -version: v1.56.2 +version: v2.0.0 # The name of the custom binary. # Optional. diff --git a/assets/cli-help.json b/assets/cli-help.json index 3549e07a8b2f..0a32cb993cfd 100644 --- a/assets/cli-help.json +++ b/assets/cli-help.json @@ -1,4 +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.\ngosimple: Linter for Go source code that specializes in simplifying code. [auto-fix]\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 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. [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 -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 of linters:\n - bugs\n - comment\n - complexity\n - error\n - format\n - import\n - metalinter\n - module\n - performance\n - sql\n - style\n - test\n - unused\n Run 'golangci-lint help linters' to see them.\n 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. If \u003c= 0, the timeout is disabled (default 1m0s)\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 --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 --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. (default true)\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" + "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. 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. [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 --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" } diff --git a/assets/exclusion-presets.json b/assets/exclusion-presets.json index 2c1e0740b8c1..8c9f521e29c9 100644 --- a/assets/exclusion-presets.json +++ b/assets/exclusion-presets.json @@ -2,7 +2,7 @@ "comments": [ { "linters": [ - "stylecheck" + "staticcheck" ], "text": "(ST1000|ST1020|ST1021|ST1022)" }, @@ -82,7 +82,7 @@ "linters": [ "errcheck" ], - "text": "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked" + "text": "(?i)Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked" } ] } diff --git a/assets/formatters-info.json b/assets/formatters-info.json new file mode 100644 index 000000000000..8d8c7caf1819 --- /dev/null +++ b/assets/formatters-info.json @@ -0,0 +1,57 @@ +[ + { + "name": "gci", + "desc": "Checks if code and import statements are formatted, with additional rules.", + "Groups": null, + "loadMode": 8199, + "originalURL": "https://github.com/daixiang0/gci", + "internal": false, + "canAutoFix": true, + "isSlow": false, + "since": "v1.30.0" + }, + { + "name": "gofmt", + "desc": "Checks if the code is formatted according to 'gofmt' command.", + "Groups": null, + "loadMode": 8199, + "originalURL": "https://pkg.go.dev/cmd/gofmt", + "internal": false, + "canAutoFix": true, + "isSlow": false, + "since": "v1.0.0" + }, + { + "name": "gofumpt", + "desc": "Checks if code and import statements are formatted, with additional rules.", + "Groups": null, + "loadMode": 8199, + "originalURL": "https://github.com/mvdan/gofumpt", + "internal": false, + "canAutoFix": true, + "isSlow": false, + "since": "v1.28.0" + }, + { + "name": "golines", + "desc": "Checks if code is formatted, and fixes long lines", + "Groups": null, + "loadMode": 8199, + "originalURL": "https://github.com/segmentio/golines", + "internal": false, + "canAutoFix": true, + "isSlow": false, + "since": "v2.0.0" + }, + { + "name": "goimports", + "desc": "Checks if the code and import statements are formatted according to the 'goimports' command.", + "Groups": null, + "loadMode": 8199, + "originalURL": "https://pkg.go.dev/golang.org/x/tools/cmd/goimports", + "internal": false, + "canAutoFix": true, + "isSlow": false, + "since": "v1.20.0" + } +] diff --git a/assets/linters-info.json b/assets/linters-info.json index d00191939a47..1fc46b35114e 100644 --- a/assets/linters-info.json +++ b/assets/linters-info.json @@ -2,6 +2,7 @@ { "name": "asasalint", "desc": "check for pass []any as any in variadic func(...any)", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/alingse/asasalint", "internal": false, @@ -11,6 +12,7 @@ { "name": "asciicheck", "desc": "checks that all code identifiers does not have non-ASCII symbols in the name", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/tdakkota/asciicheck", "internal": false, @@ -20,6 +22,7 @@ { "name": "bidichk", "desc": "Checks for dangerous unicode character sequences", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/breml/bidichk", "internal": false, @@ -29,6 +32,7 @@ { "name": "bodyclose", "desc": "checks whether HTTP response body is closed successfully", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/timakin/bodyclose", "internal": false, @@ -38,6 +42,7 @@ { "name": "canonicalheader", "desc": "canonicalheader checks whether net/http.Header uses canonical header", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/lasiar/canonicalheader", "internal": false, @@ -48,6 +53,7 @@ { "name": "containedctx", "desc": "containedctx is a linter that detects struct contained context.Context field", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/sivchari/containedctx", "internal": false, @@ -57,6 +63,7 @@ { "name": "contextcheck", "desc": "check whether the function uses a non-inherited context", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/kkHAIKE/contextcheck", "internal": false, @@ -66,6 +73,7 @@ { "name": "copyloopvar", "desc": "a linter detects places where loop variables are copied", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/karamaru-alpha/copyloopvar", "internal": false, @@ -76,6 +84,7 @@ { "name": "cyclop", "desc": "checks function and package cyclomatic complexity", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/bkielbasa/cyclop", "internal": false, @@ -85,6 +94,7 @@ { "name": "decorder", "desc": "check declaration order and count of types, constants, variables and functions", + "Groups": null, "loadMode": 8199, "originalURL": "https://gitlab.com/bosi/decorder", "internal": false, @@ -94,6 +104,7 @@ { "name": "depguard", "desc": "Go linter that checks if package imports are in a list of acceptable packages", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/OpenPeeDeeP/depguard", "internal": false, @@ -103,6 +114,7 @@ { "name": "dogsled", "desc": "Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/alexkohler/dogsled", "internal": false, @@ -112,6 +124,7 @@ { "name": "dupl", "desc": "Tool for code clone detection", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/mibk/dupl", "internal": false, @@ -121,6 +134,7 @@ { "name": "dupword", "desc": "checks for duplicate words in the source code", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/Abirdcfly/dupword", "internal": false, @@ -131,6 +145,7 @@ { "name": "durationcheck", "desc": "check for two durations multiplied together", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/charithe/durationcheck", "internal": false, @@ -140,7 +155,9 @@ { "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, + "Groups": { + "standard": {} + }, "loadMode": 8767, "originalURL": "https://github.com/kisielk/errcheck", "internal": false, @@ -150,6 +167,7 @@ { "name": "errchkjson", "desc": "Checks types passed to the json encoding functions. Reports unsupported types and reports occurrences where the check for the returned error can be omitted.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/breml/errchkjson", "internal": false, @@ -159,6 +177,7 @@ { "name": "errname", "desc": "Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/Antonboom/errname", "internal": false, @@ -168,6 +187,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.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/polyfloyd/go-errorlint", "internal": false, @@ -178,6 +198,7 @@ { "name": "exhaustive", "desc": "check exhaustiveness of enum switch statements", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/nishanths/exhaustive", "internal": false, @@ -187,6 +208,7 @@ { "name": "exhaustruct", "desc": "Checks if all structure fields are initialized", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/GaijinEntertainment/go-exhaustruct", "internal": false, @@ -196,6 +218,7 @@ { "name": "exptostd", "desc": "Detects functions from golang.org/x/exp/ that can be replaced by std functions.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/ldez/exptostd", "internal": false, @@ -206,6 +229,7 @@ { "name": "forbidigo", "desc": "Forbids identifiers", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/ashanbrown/forbidigo", "internal": false, @@ -215,6 +239,7 @@ { "name": "forcetypeassert", "desc": "finds forced type assertions", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/gostaticanalysis/forcetypeassert", "internal": false, @@ -224,6 +249,7 @@ { "name": "fatcontext", "desc": "detects nested contexts in loops and function literals", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/Crocmagnon/fatcontext", "internal": false, @@ -234,25 +260,17 @@ { "name": "funlen", "desc": "Checks for long functions.", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/ultraware/funlen", "internal": false, "isSlow": false, "since": "v1.18.0" }, - { - "name": "gci", - "desc": "Checks if code and import statements are formatted, with additional rules.", - "loadMode": 8199, - "originalURL": "https://github.com/daixiang0/gci", - "internal": false, - "canAutoFix": true, - "isSlow": false, - "since": "v1.30.0" - }, { "name": "ginkgolinter", "desc": "enforces standards of using ginkgo and gomega", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/nunnatsa/ginkgolinter", "internal": false, @@ -263,6 +281,7 @@ { "name": "gocheckcompilerdirectives", "desc": "Checks that go compiler directive comments (//go:) are valid.", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/leighmcculloch/gocheckcompilerdirectives", "internal": false, @@ -272,6 +291,7 @@ { "name": "gochecknoglobals", "desc": "Check that no global variables exist.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/leighmcculloch/gochecknoglobals", "internal": false, @@ -281,6 +301,7 @@ { "name": "gochecknoinits", "desc": "Checks that no init functions are present in Go code", + "Groups": null, "loadMode": 8199, "internal": false, "isSlow": false, @@ -289,6 +310,7 @@ { "name": "gochecksumtype", "desc": "Run exhaustiveness checks on Go \"sum types\"", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/alecthomas/go-check-sumtype", "internal": false, @@ -298,6 +320,7 @@ { "name": "gocognit", "desc": "Computes and checks the cognitive complexity of functions", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/uudashr/gocognit", "internal": false, @@ -307,6 +330,7 @@ { "name": "goconst", "desc": "Finds repeated strings that could be replaced by a constant", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/jgautheron/goconst", "internal": false, @@ -316,6 +340,7 @@ { "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.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/go-critic/go-critic", "internal": false, @@ -326,6 +351,7 @@ { "name": "gocyclo", "desc": "Computes and checks the cyclomatic complexity of functions", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/fzipp/gocyclo", "internal": false, @@ -335,6 +361,7 @@ { "name": "godot", "desc": "Check if comments end in a period", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/tetafro/godot", "internal": false, @@ -345,6 +372,7 @@ { "name": "godox", "desc": "Detects usage of FIXME, TODO and other keywords inside comments", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/matoous/godox", "internal": false, @@ -354,6 +382,7 @@ { "name": "err113", "desc": "Go linter to check the errors handling expressions", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/Djarvur/go-err113", "internal": false, @@ -361,39 +390,10 @@ "isSlow": true, "since": "v1.26.0" }, - { - "name": "gofmt", - "desc": "Checks if the code is formatted according to 'gofmt' command.", - "loadMode": 8199, - "originalURL": "https://pkg.go.dev/cmd/gofmt", - "internal": false, - "canAutoFix": true, - "isSlow": false, - "since": "v1.0.0" - }, - { - "name": "gofumpt", - "desc": "Checks if code and import statements are formatted, with additional rules.", - "loadMode": 8199, - "originalURL": "https://github.com/mvdan/gofumpt", - "internal": false, - "canAutoFix": true, - "isSlow": false, - "since": "v1.28.0" - }, - { - "name": "golines", - "desc": "Checks if code is formatted, and fixes long lines", - "loadMode": 8199, - "originalURL": "https://github.com/segmentio/golines", - "internal": false, - "canAutoFix": true, - "isSlow": false, - "since": "v2.0.0" - }, { "name": "goheader", "desc": "Checks if file header matches to pattern", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/denis-tingaikin/go-header", "internal": false, @@ -401,19 +401,10 @@ "isSlow": false, "since": "v1.28.0" }, - { - "name": "goimports", - "desc": "Checks if the code and import statements are formatted according to the 'goimports' command.", - "loadMode": 8199, - "originalURL": "https://pkg.go.dev/golang.org/x/tools/cmd/goimports", - "internal": false, - "canAutoFix": true, - "isSlow": false, - "since": "v1.20.0" - }, { "name": "mnd", "desc": "An analyzer to detect magic numbers.", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/tommy-muehle/go-mnd", "internal": false, @@ -423,6 +414,7 @@ { "name": "gomoddirectives", "desc": "Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/ldez/gomoddirectives", "internal": false, @@ -432,6 +424,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.", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/ryancurrah/gomodguard", "internal": false, @@ -441,6 +434,7 @@ { "name": "goprintffuncname", "desc": "Checks that printf-like functions are named with `f` at the end.", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/golangci/go-printf-func-name", "internal": false, @@ -450,26 +444,17 @@ { "name": "gosec", "desc": "Inspects source code for security problems", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/securego/gosec", "internal": false, "isSlow": true, "since": "v1.0.0" }, - { - "name": "gosimple", - "desc": "Linter for Go source code that specializes in simplifying code", - "enabledByDefault": true, - "loadMode": 8767, - "originalURL": "https://github.com/dominikh/go-tools/tree/HEAD/simple", - "internal": false, - "canAutoFix": true, - "isSlow": true, - "since": "v1.20.0" - }, { "name": "gosmopolitan", "desc": "Report certain i18n/l10n anti-patterns in your Go codebase", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/xen0n/gosmopolitan", "internal": false, @@ -479,7 +464,9 @@ { "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, + "Groups": { + "standard": {} + }, "loadMode": 8767, "originalURL": "https://pkg.go.dev/cmd/vet", "internal": false, @@ -490,6 +477,7 @@ { "name": "grouper", "desc": "Analyze expression groups.", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/leonklingele/grouper", "internal": false, @@ -499,6 +487,7 @@ { "name": "iface", "desc": "Detect the incorrect use of interfaces, helping developers avoid interface pollution.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/uudashr/iface", "internal": false, @@ -509,6 +498,7 @@ { "name": "importas", "desc": "Enforces consistent import aliases", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/julz/importas", "internal": false, @@ -519,6 +509,7 @@ { "name": "inamedparam", "desc": "reports interfaces with unnamed method parameters", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/macabu/inamedparam", "internal": false, @@ -528,7 +519,9 @@ { "name": "ineffassign", "desc": "Detects when assignments to existing variables are not used", - "enabledByDefault": true, + "Groups": { + "standard": {} + }, "loadMode": 8199, "originalURL": "https://github.com/gordonklaus/ineffassign", "internal": false, @@ -538,6 +531,7 @@ { "name": "interfacebloat", "desc": "A linter that checks the number of methods inside an interface.", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/sashamelentyev/interfacebloat", "internal": false, @@ -547,6 +541,7 @@ { "name": "intrange", "desc": "intrange is a linter to find places where for loops could make use of an integer range.", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/ckaznocha/intrange", "internal": false, @@ -557,6 +552,7 @@ { "name": "ireturn", "desc": "Accept Interfaces, Return Concrete Types", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/butuzov/ireturn", "internal": false, @@ -566,6 +562,7 @@ { "name": "lll", "desc": "Reports long lines", + "Groups": null, "loadMode": 8199, "internal": false, "isSlow": false, @@ -574,6 +571,7 @@ { "name": "loggercheck", "desc": "Checks key value pairs for common logger libraries (kitlog,klog,logr,zap).", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/timonwong/loggercheck", "internal": false, @@ -583,6 +581,7 @@ { "name": "maintidx", "desc": "maintidx measures the maintainability index of each function.", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/yagipy/maintidx", "internal": false, @@ -592,6 +591,7 @@ { "name": "makezero", "desc": "Finds slice declarations with non-zero initial length", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/ashanbrown/makezero", "internal": false, @@ -601,6 +601,7 @@ { "name": "mirror", "desc": "reports wrong mirror patterns of bytes/strings usage", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/butuzov/mirror", "internal": false, @@ -611,6 +612,7 @@ { "name": "misspell", "desc": "Finds commonly misspelled English words", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/client9/misspell", "internal": false, @@ -621,6 +623,7 @@ { "name": "musttag", "desc": "enforce field tags in (un)marshaled structs", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/go-simpler/musttag", "internal": false, @@ -630,6 +633,7 @@ { "name": "nakedret", "desc": "Checks that functions with naked returns are not longer than a maximum size (can be zero).", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/alexkohler/nakedret", "internal": false, @@ -640,6 +644,7 @@ { "name": "nestif", "desc": "Reports deeply nested if statements", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/nakabonne/nestif", "internal": false, @@ -649,6 +654,7 @@ { "name": "nilerr", "desc": "Finds 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", "internal": false, @@ -658,6 +664,7 @@ { "name": "nilnesserr", "desc": "Reports constructs that checks for err != nil, but returns a different nil value error.\nPowered by nilness and nilerr.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/alingse/nilnesserr", "internal": false, @@ -667,6 +674,7 @@ { "name": "nilnil", "desc": "Checks that there is no simultaneous return of `nil` error and an invalid value.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/Antonboom/nilnil", "internal": false, @@ -676,6 +684,7 @@ { "name": "nlreturn", "desc": "nlreturn checks for a new line before return and branch statements to increase code clarity", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/ssgreg/nlreturn", "internal": false, @@ -686,6 +695,7 @@ { "name": "noctx", "desc": "Finds sending http request without context.Context", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/sonatard/noctx", "internal": false, @@ -695,6 +705,7 @@ { "name": "nonamedreturns", "desc": "Reports all named returns", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/firefart/nonamedreturns", "internal": false, @@ -704,6 +715,7 @@ { "name": "nosprintfhostport", "desc": "Checks for misuse of Sprintf to construct a host with port in a URL.", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/stbenjam/no-sprintf-host-port", "internal": false, @@ -713,6 +725,7 @@ { "name": "paralleltest", "desc": "Detects missing usage of t.Parallel() method in your Go test", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/kunwardeep/paralleltest", "internal": false, @@ -722,6 +735,7 @@ { "name": "perfsprint", "desc": "Checks that fmt.Sprintf can be replaced with a faster alternative.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/catenacyber/perfsprint", "internal": false, @@ -732,6 +746,7 @@ { "name": "prealloc", "desc": "Finds slice declarations that could potentially be pre-allocated", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/alexkohler/prealloc", "internal": false, @@ -741,6 +756,7 @@ { "name": "predeclared", "desc": "find code that shadows one of Go's predeclared identifiers", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/nishanths/predeclared", "internal": false, @@ -750,6 +766,7 @@ { "name": "promlinter", "desc": "Check Prometheus metrics naming via promlint", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/yeya24/promlinter", "internal": false, @@ -759,6 +776,7 @@ { "name": "protogetter", "desc": "Reports direct reads from proto message fields when getters should be used", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/ghostiam/protogetter", "internal": false, @@ -769,6 +787,7 @@ { "name": "reassign", "desc": "Checks that package variables are not reassigned", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/curioswitch/go-reassign", "internal": false, @@ -778,6 +797,7 @@ { "name": "recvcheck", "desc": "checks for receiver type consistency", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/raeperd/recvcheck", "internal": false, @@ -787,6 +807,7 @@ { "name": "revive", "desc": "Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/mgechev/revive", "internal": false, @@ -797,6 +818,7 @@ { "name": "rowserrcheck", "desc": "checks whether Rows.Err of rows is checked successfully", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/jingyugao/rowserrcheck", "internal": false, @@ -806,6 +828,7 @@ { "name": "sloglint", "desc": "ensure consistent code style when using log/slog", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/go-simpler/sloglint", "internal": false, @@ -815,6 +838,7 @@ { "name": "sqlclosecheck", "desc": "Checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/ryanrolds/sqlclosecheck", "internal": false, @@ -824,6 +848,7 @@ { "name": "spancheck", "desc": "Checks for mistakes with OpenTelemetry/Census spans.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/jjti/go-spancheck", "internal": false, @@ -832,8 +857,10 @@ }, { "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, + "desc": "It's the 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.", + "Groups": { + "standard": {} + }, "loadMode": 8767, "originalURL": "https://staticcheck.dev/", "internal": false, @@ -841,19 +868,10 @@ "isSlow": true, "since": "v1.0.0" }, - { - "name": "stylecheck", - "desc": "Stylecheck is a replacement for golint", - "loadMode": 8767, - "originalURL": "https://github.com/dominikh/go-tools/tree/HEAD/stylecheck", - "internal": false, - "canAutoFix": true, - "isSlow": true, - "since": "v1.20.0" - }, { "name": "tagalign", "desc": "check that struct tags are well aligned", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/4meepo/tagalign", "internal": false, @@ -864,6 +882,7 @@ { "name": "tagliatelle", "desc": "Checks the struct tags.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/ldez/tagliatelle", "internal": false, @@ -873,6 +892,7 @@ { "name": "testableexamples", "desc": "linter checks if examples are testable (have an expected output)", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/maratori/testableexamples", "internal": false, @@ -882,6 +902,7 @@ { "name": "testifylint", "desc": "Checks usage of github.com/stretchr/testify.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/Antonboom/testifylint", "internal": false, @@ -892,6 +913,7 @@ { "name": "testpackage", "desc": "linter that makes you use a separate _test package", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/maratori/testpackage", "internal": false, @@ -901,6 +923,7 @@ { "name": "thelper", "desc": "thelper detects tests helpers which is not start with t.Helper() method.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/kulti/thelper", "internal": false, @@ -910,6 +933,7 @@ { "name": "tparallel", "desc": "tparallel detects inappropriate usage of t.Parallel() method in your Go test codes.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/moricho/tparallel", "internal": false, @@ -919,7 +943,7 @@ { "name": "typecheck", "desc": "Like the front-end of a Go compiler, parses and type-checks Go code", - "enabledByDefault": true, + "Groups": null, "loadMode": 8199, "internal": true, "isSlow": false, @@ -928,6 +952,7 @@ { "name": "unconvert", "desc": "Remove unnecessary type conversions", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/mdempsky/unconvert", "internal": false, @@ -937,6 +962,7 @@ { "name": "unparam", "desc": "Reports unused function parameters", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/mvdan/unparam", "internal": false, @@ -946,7 +972,9 @@ { "name": "unused", "desc": "Checks Go code for unused constants, variables, functions and types", - "enabledByDefault": true, + "Groups": { + "standard": {} + }, "loadMode": 8767, "originalURL": "https://github.com/dominikh/go-tools/tree/HEAD/unused", "internal": false, @@ -957,6 +985,7 @@ { "name": "usestdlibvars", "desc": "A linter that detect the possibility to use variables/constants from the Go standard library.", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/sashamelentyev/usestdlibvars", "internal": false, @@ -967,6 +996,7 @@ { "name": "usetesting", "desc": "Reports uses of functions with replacement inside the testing package.", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/ldez/usetesting", "internal": false, @@ -977,6 +1007,7 @@ { "name": "varnamelen", "desc": "checks that the length of a variable's name matches its scope", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/blizzy78/varnamelen", "internal": false, @@ -986,6 +1017,7 @@ { "name": "wastedassign", "desc": "Finds wasted assignment statements", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/sanposhiho/wastedassign", "internal": false, @@ -995,6 +1027,7 @@ { "name": "whitespace", "desc": "Whitespace is a linter that checks for unnecessary newlines at the start and end of functions, if, for, etc.", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/ultraware/whitespace", "internal": false, @@ -1005,6 +1038,7 @@ { "name": "wrapcheck", "desc": "Checks that errors returned from external packages are wrapped", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/tomarrell/wrapcheck", "internal": false, @@ -1014,6 +1048,7 @@ { "name": "wsl", "desc": "add or remove empty lines", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/bombsimon/wsl", "internal": false, @@ -1024,6 +1059,7 @@ { "name": "zerologlint", "desc": "Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg`", + "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/ykadowak/zerologlint", "internal": false, @@ -1033,6 +1069,7 @@ { "name": "nolintlint", "desc": "Reports ill-formed or insufficient nolint directives", + "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/golangci/golangci-lint/tree/HEAD/pkg/golinters/nolintlint/internal", "internal": false, diff --git a/scripts/website/dump_info/main.go b/scripts/website/dump_info/main.go index 16aaf5bdaa3d..e9e86f2adabc 100644 --- a/scripts/website/dump_info/main.go +++ b/scripts/website/dump_info/main.go @@ -10,6 +10,7 @@ import ( "path/filepath" "github.com/golangci/golangci-lint/pkg/config" + "github.com/golangci/golangci-lint/pkg/goformatters" "github.com/golangci/golangci-lint/pkg/lint/linter" "github.com/golangci/golangci-lint/pkg/lint/lintersdb" "github.com/golangci/golangci-lint/pkg/result/processors" @@ -22,6 +23,11 @@ func main() { log.Fatalf("Save linters: %v", err) } + err = saveFormatters() + if err != nil { + log.Fatalf("Save formatters: %v", err) + } + err = saveDefaultExclusions() if err != nil { log.Fatalf("Save default exclusions: %v", err) @@ -33,6 +39,47 @@ func main() { } } +func saveFormatters() error { + linters, _ := lintersdb.NewLinterBuilder().Build(config.NewDefault()) + + var wraps []types.LinterWrapper + for _, l := range linters { + if l.IsDeprecated() && l.Deprecation.Level > linter.DeprecationWarning { + continue + } + + if !goformatters.IsFormatter(l.Name()) { + continue + } + + wrapper := types.LinterWrapper{ + Name: l.Linter.Name(), + Desc: l.Linter.Desc(), + Groups: l.Groups, + LoadMode: l.LoadMode, + AlternativeNames: l.AlternativeNames, + OriginalURL: l.OriginalURL, + Internal: l.Internal, + CanAutoFix: l.CanAutoFix, + IsSlow: l.IsSlow, + DoesChangeTypes: l.DoesChangeTypes, + Since: l.Since, + } + + if l.Deprecation != nil { + wrapper.Deprecation = &types.Deprecation{ + Since: l.Deprecation.Since, + Message: l.Deprecation.Message, + Replacement: l.Deprecation.Replacement, + } + } + + wraps = append(wraps, wrapper) + } + + return saveToJSONFile(filepath.Join("assets", "formatters-info.json"), wraps) +} + func saveLinters() error { linters, _ := lintersdb.NewLinterBuilder().Build(config.NewDefault()) @@ -42,6 +89,10 @@ func saveLinters() error { continue } + if goformatters.IsFormatter(l.Name()) { + continue + } + wrapper := types.LinterWrapper{ Name: l.Linter.Name(), Desc: l.Linter.Desc(), From c6d35eb507fd4a9e300cd023bdc0373fecf7db1b Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 25 Feb 2025 16:30:29 +0100 Subject: [PATCH 3/9] chore: new generator --- .golangci.yml | 5 + scripts/website/expand_templates/.gitignore | 3 + scripts/website/expand_templates/linters.go | 158 +++++++++++------- .../website/expand_templates/linters_test.go | 32 ++++ scripts/website/expand_templates/main.go | 8 +- scripts/website/expand_templates/main_test.go | 20 --- 6 files changed, 145 insertions(+), 81 deletions(-) create mode 100644 scripts/website/expand_templates/.gitignore create mode 100644 scripts/website/expand_templates/linters_test.go delete mode 100644 scripts/website/expand_templates/main_test.go diff --git a/.golangci.yml b/.golangci.yml index eaba71e80319..dd401e0f26f4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -166,6 +166,11 @@ linters: linters: [gosec] text: "G115: integer overflow conversion uint64 -> int" + # The files created during the tests don't need to be secured. + - path: scripts/website/expand_templates/linters_test.go + linters: [gosec] + text: "G306: Expect WriteFile permissions to be 0600 or less" + formatters: enable: - gofmt diff --git a/scripts/website/expand_templates/.gitignore b/scripts/website/expand_templates/.gitignore new file mode 100644 index 000000000000..20377ad7139b --- /dev/null +++ b/scripts/website/expand_templates/.gitignore @@ -0,0 +1,3 @@ +ConfigurationFile.md +FormattersSettings.md +LintersSettings.md diff --git a/scripts/website/expand_templates/linters.go b/scripts/website/expand_templates/linters.go index a0ee27eaf979..0fc2d2e4db78 100644 --- a/scripts/website/expand_templates/linters.go +++ b/scripts/website/expand_templates/linters.go @@ -20,22 +20,14 @@ import ( const listItemPrefix = "list-item-" -func getExampleSnippets() (*SettingSnippets, error) { - reference, err := os.ReadFile(".golangci.reference.yml") - if err != nil { - return nil, fmt.Errorf("can't read .golangci.reference.yml: %w", err) - } - - snippets, err := extractExampleSnippets(reference) - if err != nil { - return nil, fmt.Errorf("can't extract example snippets from .golangci.reference.yml: %w", err) - } - - return snippets, nil -} +const ( + keyLinters = "linters" + keyFormatters = "formatters" + keySettings = "settings" +) -func getLintersListMarkdown(enabled bool) string { - linters, err := readJSONFile[[]*types.LinterWrapper](filepath.Join("assets", "linters-info.json")) +func getLintersListMarkdown(enabled bool, src string) string { + linters, err := readJSONFile[[]*types.LinterWrapper](src) if err != nil { panic(err) } @@ -172,14 +164,63 @@ func spanWithID(id, title, icon string) string { } type SettingSnippets struct { - ConfigurationFile string - LintersSettings string + ConfigurationFile string + LintersSettings string + FormattersSettings string } -func extractExampleSnippets(example []byte) (*SettingSnippets, error) { - var data yaml.Node - err := yaml.Unmarshal(example, &data) +func marshallSnippet(node *yaml.Node) (string, error) { + builder := &strings.Builder{} + + if node.Value != "" { + _, _ = fmt.Fprintf(builder, "### %s\n\n", node.Value) + } + _, _ = fmt.Fprintln(builder, "```yaml") + + encoder := yaml.NewEncoder(builder) + encoder.SetIndent(2) + + err := encoder.Encode(node) + if err != nil { + return "", err + } + + _, _ = fmt.Fprintln(builder, "```") + _, _ = fmt.Fprintln(builder) + + return builder.String(), nil +} + +type ExampleSnippetsExtractor struct { + referencePath string + assetsPath string +} + +func NewExampleSnippetsExtractor() *ExampleSnippetsExtractor { + return &ExampleSnippetsExtractor{ + // TODO(ldez) replace .golangci.next.reference.yml by .golangci.reference.yml + referencePath: ".golangci.next.reference.yml", + assetsPath: "assets", + } +} + +func (e *ExampleSnippetsExtractor) GetExampleSnippets() (*SettingSnippets, error) { + reference, err := os.ReadFile(e.referencePath) + if err != nil { + return nil, fmt.Errorf("can't read .golangci.reference.yml: %w", err) + } + + snippets, err := e.extractExampleSnippets(reference) if err != nil { + return nil, fmt.Errorf("can't extract example snippets from .golangci.reference.yml: %w", err) + } + + return snippets, nil +} + +func (e *ExampleSnippetsExtractor) extractExampleSnippets(example []byte) (*SettingSnippets, error) { + var data yaml.Node + if err := yaml.Unmarshal(example, &data); err != nil { return nil, err } @@ -205,7 +246,7 @@ func extractExampleSnippets(example []byte) (*SettingSnippets, error) { for j, node := range root.Content { switch node.Value { - case "run", "output", "linters", "linters-settings", "issues", "severity": // TODO(ldez) documentation + case "run", "output", keyLinters, keyFormatters, "issues", "severity": default: continue } @@ -233,20 +274,43 @@ func extractExampleSnippets(example []byte) (*SettingSnippets, error) { globalNode.Content = append(globalNode.Content, node, newNode) - if node.Value == "linters-settings" { // TODO(ldez) documentation - snippets.LintersSettings, err = getLintersSettingSections(node, nextNode) - if err != nil { - return nil, err + if node.Value == keyLinters || node.Value == keyFormatters { + for i := 0; i < len(nextNode.Content); i++ { + if nextNode.Content[i].Value != keySettings { + continue + } + + settingSections, err := e.getSettingSections(node, nextNode.Content[i+1]) + if err != nil { + return nil, err + } + + switch node.Value { + case keyLinters: + snippets.LintersSettings = settingSections + + case keyFormatters: + snippets.FormattersSettings = settingSections + } + + nextNode.Content[i+1].Content = []*yaml.Node{ + { + HeadComment: fmt.Sprintf(`See the dedicated "%s.%s" documentation section.`, node.Value, nextNode.Content[i].Value), + Kind: node.Kind, + Style: node.Style, + Tag: node.Tag, + Value: "option", + }, + { + Kind: node.Kind, + Style: node.Style, + Tag: node.Tag, + Value: "value", + }, + } + + i++ } - - _, _ = builder.WriteString( - // TODO(ldez) documentation - fmt.Sprintf( - "### `%s` configuration\n\nSee the dedicated [linters-settings](/usage/linters) documentation section.\n\n", - node.Value, - ), - ) - continue } nodeSection := &yaml.Node{ @@ -275,8 +339,8 @@ func extractExampleSnippets(example []byte) (*SettingSnippets, error) { return &snippets, nil } -func getLintersSettingSections(node, nextNode *yaml.Node) (string, error) { - linters, err := readJSONFile[[]*types.LinterWrapper](filepath.Join("assets", "linters-info.json")) +func (e *ExampleSnippetsExtractor) getSettingSections(node, nextNode *yaml.Node) (string, error) { + linters, err := readJSONFile[[]*types.LinterWrapper](filepath.Join(e.assetsPath, fmt.Sprintf("%s-info.json", node.Value))) if err != nil { return "", err } @@ -331,25 +395,3 @@ func getLintersSettingSections(node, nextNode *yaml.Node) (string, error) { return builder.String(), nil } - -func marshallSnippet(node *yaml.Node) (string, error) { - builder := &strings.Builder{} - - if node.Value != "" { - _, _ = fmt.Fprintf(builder, "### %s\n\n", node.Value) - } - _, _ = fmt.Fprintln(builder, "```yaml") - - encoder := yaml.NewEncoder(builder) - encoder.SetIndent(2) - - err := encoder.Encode(node) - if err != nil { - return "", err - } - - _, _ = fmt.Fprintln(builder, "```") - _, _ = fmt.Fprintln(builder) - - return builder.String(), nil -} diff --git a/scripts/website/expand_templates/linters_test.go b/scripts/website/expand_templates/linters_test.go new file mode 100644 index 000000000000..478faa4e58ed --- /dev/null +++ b/scripts/website/expand_templates/linters_test.go @@ -0,0 +1,32 @@ +package main + +import ( + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_ExampleSnippetsExtractor_GetExampleSnippets(t *testing.T) { + t.Skip("only for debugging purpose") + + e := &ExampleSnippetsExtractor{ + referencePath: "../../../.golangci.next.reference.yml", + assetsPath: filepath.Join("..", "..", "..", "assets"), + } + + m, err := e.GetExampleSnippets() + require.NoError(t, err) + + t.Log(m) + + err = os.WriteFile("./ConfigurationFile.md", []byte(m.ConfigurationFile), 0644) + require.NoError(t, err) + + err = os.WriteFile("./LintersSettings.md", []byte(m.LintersSettings), 0644) + require.NoError(t, err) + + err = os.WriteFile("./FormattersSettings.md", []byte(m.FormattersSettings), 0644) + require.NoError(t, err) +} diff --git a/scripts/website/expand_templates/main.go b/scripts/website/expand_templates/main.go index c7dd8dfe2835..8a517f331443 100644 --- a/scripts/website/expand_templates/main.go +++ b/scripts/website/expand_templates/main.go @@ -90,7 +90,7 @@ func processDoc(path string, replacements map[string]string, madeReplacements ma } func buildTemplateContext() (map[string]string, error) { - snippets, err := getExampleSnippets() + snippets, err := NewExampleSnippetsExtractor().GetExampleSnippets() if err != nil { return nil, err } @@ -123,10 +123,12 @@ func buildTemplateContext() (map[string]string, error) { return map[string]string{ "CustomGCLReference": pluginReference, "LintersExample": snippets.LintersSettings, + "FormattersExample": snippets.FormattersSettings, "ConfigurationExample": snippets.ConfigurationFile, "LintersCommandOutputEnabledOnly": helps.Enable, - "EnabledByDefaultLinters": getLintersListMarkdown(true), - "DisabledByDefaultLinters": getLintersListMarkdown(false), + "EnabledByDefaultLinters": getLintersListMarkdown(true, filepath.Join("assets", "linters-info.json")), + "DisabledByDefaultLinters": getLintersListMarkdown(false, filepath.Join("assets", "linters-info.json")), + "Formatters": getLintersListMarkdown(false, filepath.Join("assets", "formatters-info.json")), "ExclusionPresets": exclusions, "ThanksList": getThanksList(), "RunHelpText": helps.Help, diff --git a/scripts/website/expand_templates/main_test.go b/scripts/website/expand_templates/main_test.go deleted file mode 100644 index c6e36e1ba3f9..000000000000 --- a/scripts/website/expand_templates/main_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package main - -import ( - "os" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_extractExampleSnippets(t *testing.T) { - t.Skip("only for debugging purpose") - - example, err := os.ReadFile("../../../golangci-lint/.golangci.reference.yml") - require.NoError(t, err) - - m, err := extractExampleSnippets(example) - require.NoError(t, err) - - t.Log(m) -} From eaf48c875f590667a85b38710b98a87d9038dfb7 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 25 Feb 2025 16:35:57 +0100 Subject: [PATCH 4/9] docs: add formatters page --- docs/src/config/sidebar.yml | 2 ++ docs/src/docs/usage/formatters.mdx | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 docs/src/docs/usage/formatters.mdx diff --git a/docs/src/config/sidebar.yml b/docs/src/config/sidebar.yml index af27e37d9bd5..dfd243cd7751 100644 --- a/docs/src/config/sidebar.yml +++ b/docs/src/config/sidebar.yml @@ -20,6 +20,8 @@ link: "/usage/linters/" - label: "False Positives" link: "/usage/false-positives/" + - label: "Formatters" + link: "/usage/formatters/" - label: Product items: - label: "Thanks" diff --git a/docs/src/docs/usage/formatters.mdx b/docs/src/docs/usage/formatters.mdx new file mode 100644 index 000000000000..1281af245f0a --- /dev/null +++ b/docs/src/docs/usage/formatters.mdx @@ -0,0 +1,13 @@ +--- +title: Formatters +--- + +import { FaGithub, FaGitlab, FaArrowUp, FaCog } from "react-icons/fa"; + +## All Formatters + +{.Formatters} + +## Formatters Configuration + +{ .FormattersExample } From 6215334d58f1d69035a5894e2592c769cc8ff073 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 25 Feb 2025 20:07:47 +0100 Subject: [PATCH 5/9] docs: update pages --- docs/src/docs/contributing/architecture.mdx | 84 ++++++++------------- docs/src/docs/welcome/faq.mdx | 5 +- docs/src/docs/welcome/install.mdx | 4 +- docs/src/docs/welcome/integrations.mdx | 4 +- docs/src/docs/welcome/quick-start.mdx | 21 +++++- 5 files changed, 59 insertions(+), 59 deletions(-) diff --git a/docs/src/docs/contributing/architecture.mdx b/docs/src/docs/contributing/architecture.mdx index ad4dc3fd2481..a3d40c95f160 100644 --- a/docs/src/docs/contributing/architecture.mdx +++ b/docs/src/docs/contributing/architecture.mdx @@ -2,6 +2,7 @@ title: Architecture --- + import ResponsiveContainer from "components/ResponsiveContainer"; There are the following `golangci-lint` execution steps: @@ -94,15 +95,12 @@ func (b LinterBuilder) Build(cfg *config.Config) []*linter.Config { linter.NewConfig(golinters.NewBodyclose()). WithSince("v1.18.0"). WithLoadForGoAnalysis(). - WithPresets(linter.PresetPerformance, linter.PresetBugs). WithURL("https://github.com/timakin/bodyclose"), // ... linter.NewConfig(golinters.NewGovet(govetCfg)). - WithEnabledByDefault(). + WithGroups(config.GroupStandard). WithSince("v1.0.0"). WithLoadForGoAnalysis(). - WithPresets(linter.PresetBugs, linter.PresetMetaLinter). - WithAlternativeNames("vet", "vetshadow"). WithURL("https://pkg.go.dev/cmd/vet"), // ... } @@ -160,22 +158,24 @@ type Issue struct { // Source lines of a code with the issue to show SourceLines []string - // If we know how to fix the issue we can provide replacement lines - Replacement *Replacement - // Pkg is needed for proper caching of linting results Pkg *packages.Package `json:"-"` - LineRange *Range `json:",omitempty"` - Pos token.Position + LineRange *Range `json:",omitempty"` + // HunkPos is used only when golangci-lint is run over a diff HunkPos int `json:",omitempty"` + // If we know how to fix the issue we can provide replacement lines + SuggestedFixes []analysis.SuggestedFix `json:",omitempty"` + // If we are expecting a nolint (because this is from nolintlint), record the expected linter ExpectNoLint bool ExpectedNoLintLinter string + + // ... } ``` @@ -183,49 +183,39 @@ type Issue struct { We have an abstraction of `result.Processor` to postprocess found issues: -```sh + + +```sh ./pkg/result/processors/ -./pkg/result/processors/ -├── autogenerated_exclude.go -├── autogenerated_exclude_test.go -├── base_rule.go ├── cgo.go ├── diff.go -├── exclude.go -├── exclude_rules.go -├── exclude_rules_test.go -├── exclude_test.go +├── exclusion_generated_file_filter.go +├── exclusion_generated_file_matcher.go +├── exclusion_paths.go +├── exclusion_presets.go +├── exclusion_rules.go ├── filename_unadjuster.go ├── fixer.go ├── identifier_marker.go -├── identifier_marker_test.go +├── invalid_issue.go ├── issues.go ├── max_from_linter.go -├── max_from_linter_test.go ├── max_per_file_from_linter.go -├── max_per_file_from_linter_test.go ├── max_same_issues.go -├── max_same_issues_test.go -├── nolint.go -├── nolint_test.go -├── path_prefixer.go -├── path_prefixer_test.go +├── nolint_filter.go +├── path_absoluter.go ├── path_prettifier.go +├── path_relativity.go ├── path_shortener.go ├── processor.go -├── processor_test.go -├── severity_rules.go -├── severity_rules_test.go -├── skip_dirs.go -├── skip_files.go -├── skip_files_test.go +├── severity.go ├── sort_results.go -├── sort_results_test.go ├── source_code.go -├── testdata -├── uniq_by_line.go -└── uniq_by_line_test.go +└── uniq_by_line.go + + ``` The abstraction is simple: @@ -238,34 +228,26 @@ type Processor interface { } ``` -A processor can hide issues (`nolint`, `exclude`) or change issues (`path_shortener`). +A processor can hide issues (`nolint`, `exclude`) or change issues (`path_prettifier`). ## Print Issues We have an abstraction for printing found issues. -```sh + + +```sh ./pkg/printers/ ├── checkstyle.go -├── checkstyle_test.go ├── codeclimate.go -├── codeclimate_test.go -├── github.go -├── github_test.go ├── html.go -├── html_test.go ├── json.go -├── json_test.go ├── junitxml.go -├── junitxml_test.go ├── printer.go +├── sarif.go ├── tab.go -├── tab_test.go ├── teamcity.go -├── teamcity_test.go -├── text.go -└── text_test.go +└── text.go ``` - -Needed printer is selected by command line option `--out-format`. diff --git a/docs/src/docs/welcome/faq.mdx b/docs/src/docs/welcome/faq.mdx index a8372a774759..cfa18fdc7929 100644 --- a/docs/src/docs/welcome/faq.mdx +++ b/docs/src/docs/welcome/faq.mdx @@ -62,9 +62,10 @@ most linters are not able to perform the analysis, and they simply do not produce any reports, so it's not possible to skip/ignore `typecheck` errors. -## Why running with `--fast` is slow on the first run? +## Why running with `--fast-only` can be slow on the first run? -Because the first run caches type information. All subsequent runs will be fast. +Because the first run caches type information. +All subsequent runs will be faster. Usually this options is used during development on local machine and compilation was already performed. ## How do you add a custom linter? diff --git a/docs/src/docs/welcome/install.mdx b/docs/src/docs/welcome/install.mdx index 628c05d058fe..a86f8147e58b 100644 --- a/docs/src/docs/welcome/install.mdx +++ b/docs/src/docs/welcome/install.mdx @@ -7,8 +7,8 @@ title: "Install" Most installations of `golangci-lint` are performed for CI. It's important to have reproducible CI: don't start to fail all builds at the same time. -With golangci-lint this can happen if you use option `--enable-all` and a new linter is added -or even without `--enable-all` when one upstream linter is upgraded. +With golangci-lint this can happen if you use option `linters.default: all` and a new linter is added +or even without `linters.default: all` when one upstream linter is upgraded. **IMPORTANT**: It's highly recommended installing a specific version of golangci-lint available on the [releases page](https://github.com/golangci/golangci-lint/releases). diff --git a/docs/src/docs/welcome/integrations.mdx b/docs/src/docs/welcome/integrations.mdx index bdbab863eb90..1c53c303f0d1 100644 --- a/docs/src/docs/welcome/integrations.mdx +++ b/docs/src/docs/welcome/integrations.mdx @@ -11,11 +11,11 @@ Recommended settings for VS Code are: ```json "go.lintTool": "golangci-lint", "go.lintFlags": [ - "--fast" + "--fast-only" ] ``` -Using it in an editor without `--fast` can freeze your editor. +Using it in an editor without `--fast-only` can freeze your editor. Golangci-lint automatically discovers `.golangci.yml` config for edited file: you don't need to configure it in VS Code settings. ### Sublime Text diff --git a/docs/src/docs/welcome/quick-start.mdx b/docs/src/docs/welcome/quick-start.mdx index 3a2397959000..99bd50f9fb70 100644 --- a/docs/src/docs/welcome/quick-start.mdx +++ b/docs/src/docs/welcome/quick-start.mdx @@ -2,13 +2,15 @@ title: Quick Start --- -To run golangci-lint execute: +## Linting + +To run golangci-lint: ```sh golangci-lint run ``` -It's an equivalent of executing: +It's an equivalent of: ```sh golangci-lint run ./... @@ -39,3 +41,18 @@ golangci-lint run --disable-all -E errcheck ``` More information about available linters can be found in the [linters page](/usage/linters/). + +## Formatting + +To format your code: + +```sh +golangci-lint fmt +``` + +You can choose which directories or files to analyze: + +```sh +golangci-lint fmt dir1 dir2/... +golangci-lint fmt file1.go +``` From fcd619abfbb649d0cb8c01dada040a564c14dae7 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Tue, 4 Mar 2025 21:27:12 +0100 Subject: [PATCH 6/9] review Co-authored-by: Oleksandr Redko --- docs/src/docs/contributing/architecture.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/docs/contributing/architecture.mdx b/docs/src/docs/contributing/architecture.mdx index a3d40c95f160..54f6c7481667 100644 --- a/docs/src/docs/contributing/architecture.mdx +++ b/docs/src/docs/contributing/architecture.mdx @@ -184,7 +184,7 @@ type Issue struct { We have an abstraction of `result.Processor` to postprocess found issues: ```sh @@ -235,7 +235,7 @@ A processor can hide issues (`nolint`, `exclude`) or change issues (`path_pretti We have an abstraction for printing found issues. ```sh From f61f19863190bc0c41373a6c36374d8c3871e160 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 4 Mar 2025 21:27:57 +0100 Subject: [PATCH 7/9] review --- .custom-gcl.reference.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.custom-gcl.reference.yml b/.custom-gcl.reference.yml index 8f8b26e5c590..c9382c24b88a 100644 --- a/.custom-gcl.reference.yml +++ b/.custom-gcl.reference.yml @@ -1,5 +1,5 @@ # The golangci-lint version used to build the custom binary. -# Require. +# Required. version: v2.0.0 # The name of the custom binary. From 4f9063222f2a9a5ffd3ffd3092c10d729a595196 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Wed, 5 Mar 2025 17:23:15 +0100 Subject: [PATCH 8/9] fix: formatter settings --- scripts/website/expand_templates/linters.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/website/expand_templates/linters.go b/scripts/website/expand_templates/linters.go index 0fc2d2e4db78..326e009242c7 100644 --- a/scripts/website/expand_templates/linters.go +++ b/scripts/website/expand_templates/linters.go @@ -152,6 +152,14 @@ func hasSettings(name string) bool { } } + tp = reflect.TypeOf(config.FormatterSettings{}) + + for i := range tp.NumField() { + if strings.EqualFold(name, tp.Field(i).Name) { + return true + } + } + return false } From f3b997fd68d7e6d678909c3f536e55b01c7796cf Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Wed, 5 Mar 2025 17:33:21 +0100 Subject: [PATCH 9/9] fix: table --- scripts/website/expand_templates/linters.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/website/expand_templates/linters.go b/scripts/website/expand_templates/linters.go index 326e009242c7..c9f62d410e6f 100644 --- a/scripts/website/expand_templates/linters.go +++ b/scripts/website/expand_templates/linters.go @@ -65,7 +65,7 @@ func getLintersListMarkdown(enabled bool, src string) string { lines := []string{ "|Name|Description|AutoFix|Since|", - "|---|---|---|---|---|", + "|----|-----------|-------|-----|", } for _, lc := range neededLcs {