diff --git a/.golangci.reference.yml b/.golangci.reference.yml index e08464bdd6b8..4d5d5c88aad3 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -70,6 +70,7 @@ output: # - `checkstyle` # - `code-climate` # - `junit-xml` + # - `junit-xml-extended` # - `github-actions` # - `teamcity` # - `sarif` @@ -464,6 +465,10 @@ linters-settings: # Default: false custom-order: true + # Drops lexical ordering for custom sections. + # Default: false + no-lex-order: true + ginkgolinter: # Suppress the wrong length assertion warning. # Default: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ca15e9bf402..b06f959deff7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ Follow the news and releases on [Mastodon](https://fosstodon.org/@golangcilint) and on [Twitter](https://twitter.com/golangci). +### v1.61.0 + +1. Enhancements + * Add `junit-xml-extended` format + * Exclude Swagger Codegen files by default +2. Updated linters + * `dupword`: from 0.0.14 to 0.1.1 + * `fatcontext`: from 0.4.0 to 0.5.2 + * `gci`: from 0.13.4 to 0.13.5 (new option `no-lex-order`) + * `go-ruleguard`: from 0.4.2 to 0fe6f58b47b1 (fix panic with custom linters) + * `godot`: from 1.4.16 to 1.4.17 + * `gomodguard`: from 1.3.3 to 1.3.5 + * `gosec`: disable temporarily `G407` + * `gosec`: from ab3f6c1c83a0 to 2.21.2 (partially fix `G115`) + * `intrange`: from 0.1.2 to 0.2.0 + * `nolintlint`: remove the empty line in the directive replacement +3. Misc. + * Improve runtime version parsing +4. Documentation + * Add additional info about `typecheck` + ### v1.60.3 1. Updated linters diff --git a/assets/cli-help.json b/assets/cli-help.json index d9c277765094..882d9cc10254 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 [fast: false, auto-fix: false]\ngosimple: Linter for Go source code that specializes in simplifying code [fast: false, auto-fix: false]\ngovet: Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes. [fast: false, auto-fix: false]\nineffassign: Detects when assignments to existing variables are not used [fast: true, auto-fix: false]\nstaticcheck: It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint. [fast: false, auto-fix: false]\nunused: Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]", - "help": "Usage:\n golangci-lint run [flags]\n\nFlags:\n -c, --config PATH Read config from file path PATH\n --no-config Don't read config file\n -D, --disable strings Disable specific linter\n --disable-all Disable all linters\n -E, --enable strings Enable specific linter\n --enable-all Enable all linters\n --fast Enable only fast linters from enabled linters set (first run won't be fast)\n -p, --presets strings Enable presets (bugs|comment|complexity|error|format|import|metalinter|module|performance|sql|style|test|unused) of linters.\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 (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 --out-format string Formats of output: json|line-number|colored-line-number|tab|colored-tab|checkstyle|code-climate|html|junit-xml|github-actions|teamcity|sarif (default \"colored-line-number\")\n --print-issued-lines Print lines of code with issue (default true)\n --print-linter-name Print linter name in issue line (default true)\n --uniq-by-line Make issues output unique by line (default true)\n --sort-results Sort linter results\n --sort-order strings Sort order of linter results\n --path-prefix string Path prefix to add to output\n --show-stats Show statistics per linter\n -e, --exclude strings Exclude issue by regexp\n --exclude-use-default Use or not use default excludes:\n - EXC0001 (errcheck): Almost all programs ignore errors on these functions and in most cases it's ok.\n Pattern: 'Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked'\n - EXC0002 (golint): Annoying issue about not having a comment. The rare codebase has such comments.\n Pattern: '(comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)'\n - EXC0003 (golint): False positive when tests are defined in package 'test'.\n Pattern: 'func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this'\n - EXC0004 (govet): Common false positives.\n Pattern: '(possible misuse of unsafe.Pointer|should have signature)'\n - EXC0005 (staticcheck): Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore.\n Pattern: 'SA4011'\n - EXC0006 (gosec): Too many false-positives on 'unsafe' usage.\n Pattern: 'G103: Use of unsafe calls should be audited'\n - EXC0007 (gosec): Too many false-positives for parametrized shell calls.\n Pattern: 'G204: Subprocess launched with variable'\n - EXC0008 (gosec): Duplicated errcheck checks.\n Pattern: 'G104'\n - EXC0009 (gosec): Too many issues in popular repos.\n Pattern: '(G301|G302|G307): Expect (directory permissions to be 0750|file permissions to be 0600) or less'\n - EXC0010 (gosec): False positive is triggered by 'src, err := ioutil.ReadFile(filename)'.\n Pattern: 'G304: Potential file inclusion via variable'\n - EXC0011 (stylecheck): Annoying issue about not having a comment. The rare codebase has such comments.\n Pattern: '(ST1000|ST1020|ST1021|ST1022)'\n - EXC0012 (revive): Annoying issue about not having a comment. The rare codebase has such comments.\n Pattern: 'exported (.+) should have comment( \\(or a comment on this block\\))? or be unexported'\n - EXC0013 (revive): Annoying issue about not having a comment. The rare codebase has such comments.\n Pattern: 'package comment should be of the form \"(.+)...\"'\n - EXC0014 (revive): Annoying issue about not having a comment. The rare codebase has such comments.\n Pattern: 'comment on exported (.+) should be of the form \"(.+)...\"'\n - EXC0015 (revive): Annoying issue about not having a comment. The rare codebase has such comments.\n Pattern: 'should have a package comment' (default true)\n --exclude-case-sensitive If set to true exclude and exclude rules regular expressions are case-sensitive\n --max-issues-per-linter int Maximum issues count per one linter. Set to 0 to disable (default 50)\n --max-same-issues int Maximum count of issues with the same text. Set to 0 to disable (default 3)\n --exclude-files strings Regexps of files to exclude\n --exclude-dirs strings Regexps of directories to exclude\n --exclude-dirs-use-default Use or not use default excluded directories:\n - (^|/)vendor($|/)\n - (^|/)third_party($|/)\n - (^|/)testdata($|/)\n - (^|/)examples($|/)\n - (^|/)Godeps($|/)\n - (^|/)builtin($|/)\n (default true)\n --exclude-generated string Mode of the generated files analysis (default \"lax\")\n -n, --new Show only new issues: if there are unstaged changes or untracked files, only those changes are analyzed, else only changes in HEAD~ are analyzed.\n It's a super-useful option for integration of golangci-lint into existing large codebase.\n It's not practical to fix all existing issues at the moment of integration: much better to not allow issues in new code.\n For CI setups, prefer --new-from-rev=HEAD~, as --new can skip linting the current patch if any scripts generate unstaged files before golangci-lint runs.\n --new-from-rev REV Show only new issues created after git revision REV\n --new-from-patch PATH Show only new issues created in git patch with file path PATH\n --whole-files Show issues in any part of update files (requires new-from-rev or new-from-patch)\n --fix Fix found issues (if it's supported by the linter)\n --cpu-profile-path string Path to CPU profile output file\n --mem-profile-path string Path to memory profile output file\n --print-resources-usage Print avg and max memory usage of golangci-lint and total time\n --trace-path string Path to trace output file\n\nGlobal Flags:\n --color string Use color when printing; can be 'always', 'auto', or 'never' (default \"auto\")\n -h, --help Help for a command\n -v, --verbose Verbose output\n" + "help": "Usage:\n golangci-lint run [flags]\n\nFlags:\n -c, --config PATH Read config from file path PATH\n --no-config Don't read config file\n -D, --disable strings Disable specific linter\n --disable-all Disable all linters\n -E, --enable strings Enable specific linter\n --enable-all Enable all linters\n --fast Enable only fast linters from enabled linters set (first run won't be fast)\n -p, --presets strings Enable presets (bugs|comment|complexity|error|format|import|metalinter|module|performance|sql|style|test|unused) of linters.\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 (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 --out-format string Formats of output: json|line-number|colored-line-number|tab|colored-tab|checkstyle|code-climate|html|junit-xml|junit-xml-extended|github-actions|teamcity|sarif (default \"colored-line-number\")\n --print-issued-lines Print lines of code with issue (default true)\n --print-linter-name Print linter name in issue line (default true)\n --uniq-by-line Make issues output unique by line (default true)\n --sort-results Sort linter results\n --sort-order strings Sort order of linter results\n --path-prefix string Path prefix to add to output\n --show-stats Show statistics per linter\n -e, --exclude strings Exclude issue by regexp\n --exclude-use-default Use or not use default excludes:\n - EXC0001 (errcheck): Almost all programs ignore errors on these functions and in most cases it's ok.\n Pattern: 'Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked'\n - EXC0002 (golint): Annoying issue about not having a comment. The rare codebase has such comments.\n Pattern: '(comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)'\n - EXC0003 (golint): False positive when tests are defined in package 'test'.\n Pattern: 'func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this'\n - EXC0004 (govet): Common false positives.\n Pattern: '(possible misuse of unsafe.Pointer|should have signature)'\n - EXC0005 (staticcheck): Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore.\n Pattern: 'SA4011'\n - EXC0006 (gosec): Too many false-positives on 'unsafe' usage.\n Pattern: 'G103: Use of unsafe calls should be audited'\n - EXC0007 (gosec): Too many false-positives for parametrized shell calls.\n Pattern: 'G204: Subprocess launched with variable'\n - EXC0008 (gosec): Duplicated errcheck checks.\n Pattern: 'G104'\n - EXC0009 (gosec): Too many issues in popular repos.\n Pattern: '(G301|G302|G307): Expect (directory permissions to be 0750|file permissions to be 0600) or less'\n - EXC0010 (gosec): False positive is triggered by 'src, err := ioutil.ReadFile(filename)'.\n Pattern: 'G304: Potential file inclusion via variable'\n - EXC0011 (stylecheck): Annoying issue about not having a comment. The rare codebase has such comments.\n Pattern: '(ST1000|ST1020|ST1021|ST1022)'\n - EXC0012 (revive): Annoying issue about not having a comment. The rare codebase has such comments.\n Pattern: 'exported (.+) should have comment( \\(or a comment on this block\\))? or be unexported'\n - EXC0013 (revive): Annoying issue about not having a comment. The rare codebase has such comments.\n Pattern: 'package comment should be of the form \"(.+)...\"'\n - EXC0014 (revive): Annoying issue about not having a comment. The rare codebase has such comments.\n Pattern: 'comment on exported (.+) should be of the form \"(.+)...\"'\n - EXC0015 (revive): Annoying issue about not having a comment. The rare codebase has such comments.\n Pattern: 'should have a package comment' (default true)\n --exclude-case-sensitive If set to true exclude and exclude rules regular expressions are case-sensitive\n --max-issues-per-linter int Maximum issues count per one linter. Set to 0 to disable (default 50)\n --max-same-issues int Maximum count of issues with the same text. Set to 0 to disable (default 3)\n --exclude-files strings Regexps of files to exclude\n --exclude-dirs strings Regexps of directories to exclude\n --exclude-dirs-use-default Use or not use default excluded directories:\n - (^|/)vendor($|/)\n - (^|/)third_party($|/)\n - (^|/)testdata($|/)\n - (^|/)examples($|/)\n - (^|/)Godeps($|/)\n - (^|/)builtin($|/)\n (default true)\n --exclude-generated string Mode of the generated files analysis (default \"lax\")\n -n, --new Show only new issues: if there are unstaged changes or untracked files, only those changes are analyzed, else only changes in HEAD~ are analyzed.\n It's a super-useful option for integration of golangci-lint into existing large codebase.\n It's not practical to fix all existing issues at the moment of integration: much better to not allow issues in new code.\n For CI setups, prefer --new-from-rev=HEAD~, as --new can skip linting the current patch if any scripts generate unstaged files before golangci-lint runs.\n --new-from-rev REV Show only new issues created after git revision REV\n --new-from-patch PATH Show only new issues created in git patch with file path PATH\n --whole-files Show issues in any part of update files (requires new-from-rev or new-from-patch)\n --fix Fix found issues (if it's supported by the linter)\n --cpu-profile-path string Path to CPU profile output file\n --mem-profile-path string Path to memory profile output file\n --print-resources-usage Print avg and max memory usage of golangci-lint and total time\n --trace-path string Path to trace output file\n\nGlobal Flags:\n --color string Use color when printing; can be 'always', 'auto', or 'never' (default \"auto\")\n -h, --help Help for a command\n -v, --verbose Verbose output\n" } diff --git a/assets/linters-info.json b/assets/linters-info.json index 614ee977a5d5..0f7d41fb0f63 100644 --- a/assets/linters-info.json +++ b/assets/linters-info.json @@ -319,7 +319,7 @@ }, { "name": "fatcontext", - "desc": "detects nested contexts in loops", + "desc": "detects nested contexts in loops and function literals", "loadMode": 575, "inPresets": [ "performance" @@ -759,7 +759,7 @@ ], "originalURL": "https://github.com/ckaznocha/intrange", "internal": false, - "isSlow": false, + "isSlow": true, "since": "v1.57.0" }, { diff --git a/jsonschema/golangci.jsonschema.json b/jsonschema/golangci.jsonschema.json index f8233a77759d..e137b14c6d39 100644 --- a/jsonschema/golangci.jsonschema.json +++ b/jsonschema/golangci.jsonschema.json @@ -520,6 +520,7 @@ "checkstyle", "code-climate", "junit-xml", + "junit-xml-extended", "github-actions", "teamcity", "sarif" @@ -1103,6 +1104,11 @@ "description": "Enable custom order of sections.", "type": "boolean", "default": false + }, + "no-lex-order": { + "description": "Drops lexical ordering for custom sections.", + "type": "boolean", + "default": false } } },