diff --git a/.github/workflows/deploy-documentation.yml b/.github/workflows/deploy-documentation.yml index a280e171e459..64ff5e82bd88 100644 --- a/.github/workflows/deploy-documentation.yml +++ b/.github/workflows/deploy-documentation.yml @@ -31,19 +31,8 @@ jobs: wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ && sudo dpkg -i ${{ runner.temp }}/hugo.deb - - name: Build Documentation assets - run: make website_copy_jsonschema website_expand_templates - - name: Build Documentation - env: - # For maximum backward compatibility with Hugo modules - HUGO_ENVIRONMENT: production - HUGO_ENV: production - working-directory: ./docs - run: | - hugo \ - --gc --minify \ - --baseURL "https://golangci-lint.run/" + run: make docs_build - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v4 diff --git a/.github/workflows/pr-documentation.yml b/.github/workflows/pr-documentation.yml index 8aea9b12d1a0..cd2446c9d5ab 100644 --- a/.github/workflows/pr-documentation.yml +++ b/.github/workflows/pr-documentation.yml @@ -31,12 +31,4 @@ jobs: && sudo dpkg -i ${{ runner.temp }}/hugo.deb - name: Build Documentation - env: - # For maximum backward compatibility with Hugo modules - HUGO_ENVIRONMENT: production - HUGO_ENV: production - working-directory: ./docs - run: | - hugo \ - --gc --minify \ - --baseURL "https://golangci-lint.run/" + run: make docs_build diff --git a/CHANGELOG.md b/CHANGELOG.md index 105f83d892c2..a90b380ba006 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ If you value it, consider supporting us, we appreciate it! [![Donate](https://img.shields.io/badge/Donate-❤️-blue?style=for-the-badge)](https://donate.golangci.org) + + ### v2.3.1 1. Linters bug fixes diff --git a/Makefile b/Makefile index 3977317aff7f..0b445cab5f02 100644 --- a/Makefile +++ b/Makefile @@ -101,18 +101,18 @@ go.sum: go.mod # Documentation -docs_serve: +docs_serve: website_expand_templates @make -C ./docs serve .PHONY: docs_serve -docs_reset: - @make -C ./docs reset -.PHONY: docs_reset - docs_clean: @make -C ./docs clean .PHONY: docs_clean +docs_build: website_copy_jsonschema website_expand_templates + @make -C ./docs build +.PHONY: docs_build + docs/static/demo.gif: FORCE vhs docs/golangci-lint.tape diff --git a/README.md b/README.md index 7dceb2d3a88d..1c1467214615 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Documentation is hosted at https://golangci-lint.run. [![Follow on Bluesky](https://img.shields.io/badge/Bluesky-0a7aff?logo=bluesky&logoColor=white)](https://bsky.app/profile/golangci-lint.run) [![Follow on Twitter](https://img.shields.io/badge/Twitter-1DA1F2?logo=x&logoColor=white)](https://twitter.com/golangci) -## Supporting Us +## Support Us [![Open Collective backers and sponsors](https://img.shields.io/badge/OpenCollective-Donate-blue?logo=opencollective&style=for-the-badge)](https://opencollective.com/golangci-lint) [![GitHub Sponsors](https://img.shields.io/badge/GitHub-Donate-blue?logo=github&style=for-the-badge)](https://github.com/sponsors/golangci) diff --git a/assets/cli-help.json b/assets/cli-help.json deleted file mode 100644 index 046ccb0d77d9..000000000000 --- a/assets/cli-help.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "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.", - "rootHelp": "Usage:\n golangci-lint [flags]\n golangci-lint [command]\n\nAvailable Commands:\n cache Cache control and information\n completion Generate the autocompletion script for the specified shell\n config Config file information\n custom Build a version of golangci-lint with custom linters\n fmt Format Go source files\n formatters List current formatters configuration\n help Help\n linters List current linters configuration\n migrate Migrate configuration file from v1 to v2\n run Run the linters\n version Version\n\nFlags:\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 --version Print version\n\nUse \"golangci-lint [command] --help\" for more information about a command.\n", - "runHelp": "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", - "lintersHelp": "Usage:\n golangci-lint linters [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 --json Display as JSON\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", - "formattersHelp": "Usage:\n golangci-lint formatters [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 --json Display as JSON\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 help [flags]\n golangci-lint help [command]\n\nAvailable Commands:\n formatters Help about formatters\n linters Help about linters\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\nUse \"golangci-lint help [command] --help\" for more information about a command.\n", - "migrateHelp": "Usage:\n golangci-lint migrate [flags]\n\nFlags:\n -c, --config PATH Read config from file path PATH\n --no-config Don't read config file\n --format string Output file format.\n By default, the format of the input configuration file is used.\n It can be 'yml', 'yaml', 'toml', or 'json'.\n --skip-validation Skip validation of the configuration file against the JSON Schema for v1.\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", - "configHelp": "Usage:\n golangci-lint config [flags]\n golangci-lint config [command]\n\nAvailable Commands:\n path Print used config path\n verify Verify configuration against JSON schema\n\nFlags:\n -c, --config PATH Read config from file path PATH\n --no-config Don't read config 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\nUse \"golangci-lint config [command] --help\" for more information about a command.\n", - "customHelp": "Usage:\n golangci-lint custom [flags]\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", - "cacheHelp": "Usage:\n golangci-lint cache [flags]\n golangci-lint cache [command]\n\nAvailable Commands:\n clean Clean cache\n status Show cache status\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\nUse \"golangci-lint cache [command] --help\" for more information about a command.\n", - "versionHelp": "Usage:\n golangci-lint version [flags]\n\nFlags:\n --debug Add build information\n --json Display as JSON\n --short Display only the version number\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", - "completionHelp": "\nUsage:\n golangci-lint completion [command]\n\nAvailable Commands:\n bash Generate the autocompletion script for bash\n fish Generate the autocompletion script for fish\n powershell Generate the autocompletion script for powershell\n zsh Generate the autocompletion script for zsh\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\nUse \"golangci-lint completion [command] --help\" for more information about a command.\n" -} diff --git a/docs/.gitignore b/docs/.gitignore index 4264a5049a92..c92be3dc739b 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,4 +1,9 @@ +# Hugo files .hugo_build.lock public/ -/static/jsonschema/ resources/ + +# Generated files +/static/jsonschema/ +data/version.json +.tmp/ diff --git a/docs/Makefile b/docs/Makefile index c7478e51bb23..3c7eb14a021c 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,12 +1,17 @@ -.PHONY: default clean reset serve +.PHONY: default clean serve build default: clean serve clean: rm -rf public/ -reset: - git checkout HEAD content/ - serve: clean - hugo server --disableFastRender --buildDrafts --enableGitInfo --watch --source . + hugo server --disableFastRender --buildDrafts --enableGitInfo + +# IMPORTANT used by the CI to deploy documentation +build: clean + HUGO_ENVIRONMENT=production \ + HUGO_ENV=production \ + hugo \ + --gc --minify \ + --baseURL "https://golangci-lint.run/" diff --git a/docs/assets/css/custom.css b/docs/assets/css/custom.css index a6339e802d5f..2b5c8b182d54 100644 --- a/docs/assets/css/custom.css +++ b/docs/assets/css/custom.css @@ -8,3 +8,11 @@ .hx-line-clamp-3.hextra-card-subtitle { -webkit-line-clamp: 30; } + +.author-cards { + grid-template-columns: repeat(auto-fill, minmax(max(150px, calc((100% - 1rem * 4) / var(--hextra-cards-grid-cols))), 1fr)); +} + +.gl-hidden { + display: none; +} diff --git a/docs/content/docs/_index.md b/docs/content/docs/_index.md index d5181b0cc132..899b62396f37 100644 --- a/docs/content/docs/_index.md +++ b/docs/content/docs/_index.md @@ -26,15 +26,13 @@ title: 'Golangci-lint Documentation' icon="arrow-circle-right" >}} {{< /cards >}} - -## Supporting Us +## Support Us Golangci-lint is a free and open-source project built by volunteers. If you value it, consider supporting us, we appreciate it! -
-
+
{{< hextra/hero-button text="Donate ❤️" link="https://donate.golangci.org" >}}
diff --git a/docs/content/docs/configuration/cli.md b/docs/content/docs/configuration/cli.md index 613d25332ede..abedcfabc04e 100644 --- a/docs/content/docs/configuration/cli.md +++ b/docs/content/docs/configuration/cli.md @@ -3,10 +3,7 @@ title: Command-Line weight: 1 --- -```console -$ golangci-lint -h -{.CmdRootHelpText} -``` +{{% cli-output %}} ## `run` @@ -16,10 +13,7 @@ $ golangci-lint -h {{< card link="/docs/linters/configuration/" title="Linter Settings" icon="adjustments" >}} {{< /cards >}} -```console -$ golangci-lint run -h -{.CmdRunHelpText} -``` +{{% cli-output cmd="run" %}} When the `--cpu-profile-path` or `--mem-profile-path` arguments are specified, golangci-lint writes runtime profiling data in the format expected by the [pprof](https://github.com/google/pprof) visualization tool. @@ -35,38 +29,23 @@ the `go tool trace` command and visualization tool. {{< card link="/docs/formatters/configuration/" title="Formatter Settings" icon="adjustments" >}} {{< /cards >}} -```console -$ golangci-lint fmt -h -{.CmdFmtHelpText} -``` +{{% cli-output cmd="fmt" %}} ## `migrate` -```console -$ golangci-lint migrate -h -{.CmdMigrateHelpText} -``` +{{% cli-output cmd="migrate" %}} ## `formatters` -```console -$ golangci-lint formatters -h -{.CmdFormattersHelpText} -``` +{{% cli-output cmd="formatters" %}} ## `help` -```console -$ golangci-lint help -h -{.CmdHelpText} -``` +{{% cli-output cmd="help" %}} ## `linters` -```console -$ golangci-lint linters -h -{.CmdLintersHelpText} -``` +{{% cli-output cmd="linters" %}} ## `cache` @@ -76,35 +55,20 @@ You can override the default cache directory with the environment variable `GOLA The cache is only used by `golangci-lint run` (linters). -```console -$ golangci-lint cache -h -{.CmdCacheHelpText} -``` +{{% cli-output cmd="cache" %}} ## `config` -```console -$ golangci-lint config -h -{.CmdConfigHelpText} -``` +{{% cli-output cmd="config" %}} ## `custom` -```console -$ golangci-lint custom -h -{.CmdCustomHelpText} -``` +{{% cli-output cmd="custom" %}} ## `version` -```console -$ golangci-lint version -h -{.CmdVersionHelpText} -``` +{{% cli-output cmd="version" %}} ## `completion` -```console -$ golangci-lint completion -h -{.CmdCompletionHelpText} -``` +{{% cli-output cmd="completion" %}} diff --git a/docs/content/docs/configuration/file.md b/docs/content/docs/configuration/file.md index 0d01f45935be..2fe13752be1e 100644 --- a/docs/content/docs/configuration/file.md +++ b/docs/content/docs/configuration/file.md @@ -18,8 +18,47 @@ Config options inside the file are identical to command-line options. You can configure specific linters' options only within the config file (not the command-line). There is a [`.golangci.reference.yml`](https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.reference.yml) file with all supported options, their descriptions, and default values. -This file is neither a working example nor a recommended configuration, it's just a reference to display all the configuration options. +This file is neither a working example nor a recommended configuration, +it's just a reference to display all the configuration options used to generate the documentation. The configuration file can be validated with the JSON Schema: [golangci.jsonschema.json](https://golangci-lint.run/jsonschema/golangci.jsonschema.json) -{ .ConfigurationExample } +{{% configuration-file-snippet section="root" %}} + +## `version` configuration + +{{% configuration-file-snippet section="version" %}} + +## `linters` configuration + +{{< cards cols=2 >}} +{{< card link="/docs/linters" title="Linters Overview" icon="collection" >}} +{{< card link="/docs/linters/configuration" title="Linters Settings" icon="adjustments" >}} +{{< /cards >}} + +{{% configuration-file-snippet section="linters" %}} + +## `formatters` configuration + +{{< cards cols=2 >}} +{{< card link="/docs/formatters" title="Formatters Overview" icon="collection" >}} +{{< card link="/docs/formatters/configuration" title="Formatters Settings" icon="adjustments" >}} +{{< /cards >}} + +{{% configuration-file-snippet section="formatters" %}} + +## `issues` configuration + +{{% configuration-file-snippet section="issues" %}} + +## `output` configuration + +{{% configuration-file-snippet section="output" %}} + +## `run` configuration + +{{% configuration-file-snippet section="run" %}} + +## `severity` configuration + +{{% configuration-file-snippet section="severity" %}} diff --git a/docs/content/docs/contributing/website.md b/docs/content/docs/contributing/website.md index 8ce0dcf8b164..f2eaf54c72f2 100644 --- a/docs/content/docs/contributing/website.md +++ b/docs/content/docs/contributing/website.md @@ -17,10 +17,29 @@ The site is based on [hextra](https://github.com/imfing/hextra) theme. ## Templating -We use templates like `{.SomeField}` inside our `md` files. +We use [shortcodes](https://gohugo.io/templates/types/#shortcode) and [partials](https://gohugo.io/templates/types/#partial) based on files from `./docs/.tmp/` and `./docs/data/`. -These templates are expanded by running `make website_expand_templates` in the root of the repository. -It runs script `scripts/website/expand_templates/` that rewrites `md` files with replaced templates. +- The files in `./docs/.tmp/` are used to be embedded with the shortcode `{{%/* embed file="filename.ext" */%}}`. +- The files in `./docs/data/` are used as [data sources](https://gohugo.io/content-management/data-sources/). + +These files are created by running: + +- `make website_expand_templates` in the root of the repository. +- `make website_dump_info` in the root of the repository. (only during a release) + +### Some Notes + +[shortcodes](https://gohugo.io/templates/types/#shortcode): +- cannot be used inside another shortcode +- can only be used inside a page +- can contain Markdown or HTML, but the tag is different: `{{%/* shortcode */%}}` vs `{{}}` + +[partials](https://gohugo.io/templates/types/#partial): +- are reusable HTML blocks or "functions" +- cannot be used inside a page +- can be used inside another partial +- can be used inside a shortcode +- can be used inside a layout ## Hosting @@ -30,14 +49,24 @@ GitHub deploys the website to production after merging anything to a `main` bran ## Local Testing -Install Hugo (v0.148.1 or newer). +Install Hugo Extended (v0.148.1 or newer). Run: ```bash -# (if in the root of the repository) +# (in the root of the repository) make docs_serve -# OR (if inside the docs/ folder) +``` + +or + +```bash +# (in the root of the repository) +make website_expand_templates + +cd docs/ + +# (inside the docs/ folder) make serve ``` @@ -51,6 +80,17 @@ Also, there is no need to refresh a webpage: hot reload updates changed content To do this, run: ```bash -# (only in the root of the repository) -make website_expand_templates +# (in the root of the repository) +make docs_build +``` +or + +```bash +# (in the root of the repository) +make website_copy_jsonschema website_expand_templates + +cd docs/ + +# (inside the docs/ folder) +make build ``` diff --git a/docs/content/docs/formatters/_index.md b/docs/content/docs/formatters/_index.md index 1d0e8e433ba7..195c08c8f58e 100644 --- a/docs/content/docs/formatters/_index.md +++ b/docs/content/docs/formatters/_index.md @@ -25,4 +25,13 @@ golangci-lint formatters ## All formatters -{.Formatters} +
+ {{< icon "filter" >}} + {{< clickable-badge icon="fire" id="new-filter" content="New" class="gl-filter hx-cursor-pointer" type="warning" border=false >}} + {{< clickable-badge icon="emoji-sad" id="deprecated-filter" content="Deprecated" class="gl-filter hx-cursor-pointer" type="info" border=false >}} + {{< clickable-badge icon="trash" id="reset-filter" content="Reset" class="gl-filter-reset gl-hidden hx-cursor-pointer" type="error" border=true >}} +
+ +{{< cards >}} + {{< item-cards path="formatters" data="formatters_info" >}} +{{< /cards >}} diff --git a/docs/content/docs/formatters/configuration.md b/docs/content/docs/formatters/configuration.md index cf9144367832..e8f17c124e79 100644 --- a/docs/content/docs/formatters/configuration.md +++ b/docs/content/docs/formatters/configuration.md @@ -3,4 +3,4 @@ title: Settings weight: 2 --- -{ .FormattersExample } +{{% item-settings info="formatters_info" settings="formatter_settings" %}} diff --git a/docs/content/docs/linters/_index.md b/docs/content/docs/linters/_index.md index d0faf5941c83..8eabc81e0186 100644 --- a/docs/content/docs/linters/_index.md +++ b/docs/content/docs/linters/_index.md @@ -23,10 +23,19 @@ golangci-lint linters {{< card link="/docs/linters/configuration/" title="Linter Settings" icon="adjustments" >}} {{< /cards >}} -## Enabled by Default - -{.EnabledByDefaultLinters} - -## Disabled by Default - -{.DisabledByDefaultLinters} +## All Linters + +
+ {{< icon "filter" >}} + {{< clickable-badge icon="inbox" id="default-filter" content="Default" class="gl-filter hx-cursor-pointer" type="info" border=false >}} + {{< clickable-badge icon="fire" id="new-filter" content="New" class="gl-filter hx-cursor-pointer" type="warning" border=false >}} + {{< clickable-badge icon="sparkles" id="autofix-filter" content="Autofix" class="gl-filter hx-cursor-pointer" type="info" border=false >}} + {{< clickable-badge icon="fast-forward" id="fast-filter" content="Fast" class="gl-filter hx-cursor-pointer" border=false >}} + {{< clickable-badge icon="play" id="slow-filter" content="Slow" class="gl-filter hx-cursor-pointer" border=false >}} + {{< clickable-badge icon="emoji-sad" id="deprecated-filter" content="Deprecated" class="gl-filter hx-cursor-pointer" type="info" border=false >}} + {{< clickable-badge icon="trash" id="reset-filter" content="Reset" class="gl-filter-reset gl-hidden hx-cursor-pointer" type="error" border=true >}} +
+ +{{< cards >}} + {{< item-cards path="linters" data="linters_info" >}} +{{< /cards >}} diff --git a/docs/content/docs/linters/configuration.md b/docs/content/docs/linters/configuration.md index 5d7afb51e806..fc11ffc31179 100644 --- a/docs/content/docs/linters/configuration.md +++ b/docs/content/docs/linters/configuration.md @@ -3,4 +3,4 @@ title: Settings weight: 2 --- -{ .LintersExample } +{{% item-settings info="linters_info" settings="linter_settings" %}} diff --git a/docs/content/docs/linters/false-positives.md b/docs/content/docs/linters/false-positives.md index 2c06604bee74..b0b10cbbab7c 100644 --- a/docs/content/docs/linters/false-positives.md +++ b/docs/content/docs/linters/false-positives.md @@ -166,4 +166,4 @@ Use `//nolint` instead of `// nolint` because directives should have no space by Some exclusions are considered common. To help golangci-lint users, those common exclusions are provided through presets. -{.ExclusionPresets} +{{% exclusion-presets %}} diff --git a/docs/content/docs/plugins/module-plugins.md b/docs/content/docs/plugins/module-plugins.md index 7be8eb0f87fa..1b1dbcef93e4 100644 --- a/docs/content/docs/plugins/module-plugins.md +++ b/docs/content/docs/plugins/module-plugins.md @@ -20,7 +20,7 @@ Requirements: ### Configuration Example ```yaml {filename=".custom-gcl.yml"} -version: {.LatestVersion} +version: {{< latest-version >}} plugins: # a plugin from a Go proxy - module: 'github.com/golangci/plugin1' @@ -79,5 +79,5 @@ linters: The configuration file can be validated with the JSON Schema: [custom-gcl.jsonschema.json](https://golangci-lint.run/jsonschema/custom-gcl.jsonschema.json) ```yml {filename=".custom-gcl.yml"} -{ .CustomGCLReference } +{{% embed file=".tmp/.custom-gcl.reference.yml" %}} ``` diff --git a/docs/content/docs/product/changelog.md b/docs/content/docs/product/changelog.md index f492b020c86f..c66aa345c5ac 100644 --- a/docs/content/docs/product/changelog.md +++ b/docs/content/docs/product/changelog.md @@ -4,6 +4,14 @@ weight: 2 excludeSearch: true --- -## Changelog +Follow the news and releases on [Mastodon](https://fosstodon.org/@golangcilint) and on [Bluesky](https://bsky.app/profile/golangci-lint.run). -{.ChangeLog} +`golangci-lint` is a free and open-source project built by volunteers. + +If you value it, consider supporting us, we appreciate it! + +
+{{< hextra/hero-button text="Donate ❤️" link="https://donate.golangci.org" >}} +
+ +{{% embed file=".tmp/raw_changelog.tmp" %}} diff --git a/docs/content/docs/product/migration-guide.md b/docs/content/docs/product/migration-guide.md index 6fcb80bae96b..fa2cf2ca5057 100644 --- a/docs/content/docs/product/migration-guide.md +++ b/docs/content/docs/product/migration-guide.md @@ -46,24 +46,7 @@ Other fields explicitly defined in the configuration file are migrated even if t The `migrate` command automatically migrates `linters.presets` in individual linters to `linters.enable`. -```txt -Migrate configuration file from v1 to v2 - -Usage: - golangci-lint migrate [flags] - -Flags: - -c, --config PATH Read config from file path PATH - --no-config Don't read config file - --format string Output file format. - By default, the format of the input configuration file is used. - It can be 'yml', 'yaml', 'toml', or 'json'. - --skip-validation Skip validation of the configuration file against the JSON Schema for v1. - -Global Flags: - -h, --help Help for a command - -``` +{{% cli-output cmd="migrate" %}} ## Changes diff --git a/docs/content/docs/product/thanks.md b/docs/content/docs/product/thanks.md index 68f74061aa35..6409e2a5b267 100644 --- a/docs/content/docs/product/thanks.md +++ b/docs/content/docs/product/thanks.md @@ -5,11 +5,17 @@ weight: 1 ## ❤️ -Thanks to all [contributors](https://github.com/golangci/golangci-lint/graphs/contributors)! +### Thanks to developers and authors of used linters -Thanks to developers and authors of used linters: +{{< author-cards cols=7 >}} +{{< authors >}} +{{< /author-cards >}} -{.ThanksList} +### Thanks to all contributors + +[![golangci-lint contributors](https://opencollective.com/golangci-lint/contributors.svg?width=890&button=false&skip=golangcidev,CLAassistant,renovate,fossabot,golangcibot,kortschak,golangci-releaser,dependabot%5Bbot%5D)](https://github.com/golangci/golangci-lint/graphs/contributors) + +### Special thanks Thanks to [alecthomas/gometalinter](https://github.com/alecthomas/gometalinter) for inspiration and amazing work. diff --git a/docs/content/docs/welcome/install.md b/docs/content/docs/welcome/install.md index 00110d33638c..c2768419116b 100644 --- a/docs/content/docs/welcome/install.md +++ b/docs/content/docs/welcome/install.md @@ -21,11 +21,13 @@ We recommend using [our GitHub Action](https://github.com/golangci/golangci-lint It's [fast and uses smart caching](https://github.com/golangci/golangci-lint-action#performance) inside, and it can be much faster than the simple binary installation. -![Log output of the action](/images/colored-line-number.png "Console Output") +Also, the action creates GitHub annotations for found issues (you don't need to dig into build log to see found by golangci-lint issues). -Also, the action creates GitHub annotations for found issues (you don't need to dig into build log to see found by golangci-lint issues): +{{< cards cols=2 >}} + {{< card subtitle="Console Output" image="/images/colored-line-number.png" >}} + {{< card subtitle="Annotations" image="/images/annotations.png" >}} +{{< /cards >}} -![GitHub annotations of the action](/images/annotations.png "Annotations") ### GitLab CI @@ -45,13 +47,13 @@ Here is the other way to install golangci-lint: ```bash # binary will be $(go env GOPATH)/bin/golangci-lint -curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin {.LatestVersion} +curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin {{< latest-version >}} # or install it into ./bin/ -curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s {.LatestVersion} +curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s {{< latest-version >}} # In Alpine Linux (as it does not come with curl by default) -wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s {.LatestVersion} +wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s {{< latest-version >}} golangci-lint --version ``` @@ -67,7 +69,7 @@ For any problems with golangci-lint, check out recent [GitHub issues](https://gi ```bash # binary will be $(go env GOPATH)/bin/golangci-lint -curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin {.LatestVersion} +curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin {{< latest-version >}} golangci-lint --version ``` @@ -135,12 +137,12 @@ The scoop package is not officially maintained by golangci team. ### Docker ```bash -docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:{.LatestVersion} golangci-lint run +docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:{{< latest-version >}} golangci-lint run ``` Colored output: ```bash -docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint:{.LatestVersion} golangci-lint run +docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint:{{< latest-version >}} golangci-lint run ``` Preserving caches between consecutive runs: @@ -150,7 +152,7 @@ docker run --rm -t -v $(pwd):/app -w /app \ -v $(go env GOCACHE):/.cache/go-build -e GOCACHE=/.cache/go-build \ -v $(go env GOMODCACHE):/.cache/mod -e GOMODCACHE=/.cache/mod \ -v ~/.cache/golangci-lint:/.cache/golangci-lint -e GOLANGCI_LINT_CACHE=/.cache/golangci-lint \ -golangci/golangci-lint:{.LatestVersion} golangci-lint run +golangci/golangci-lint:{{< latest-version >}} golangci-lint run ``` ### Install from Sources @@ -170,7 +172,7 @@ These installations aren't recommended because of the following points: 7. It's slower than binary installation. ```bash -go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@{.LatestVersion} +go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@{{< latest-version >}} ``` {{% details title="`go tool` usage recommendations" closed="true" %}} @@ -196,7 +198,7 @@ go mod init -modfile=golangci-lint.mod /golangci-lint ```sh # Add golangci-lint as a tool -go get -tool -modfile=golangci-lint.mod github.com/golangci/golangci-lint/v2/cmd/golangci-lint@{.LatestVersion} +go get -tool -modfile=golangci-lint.mod github.com/golangci/golangci-lint/v2/cmd/golangci-lint@{{< latest-version >}} ``` ```sh diff --git a/docs/content/docs/welcome/quick-start.md b/docs/content/docs/welcome/quick-start.md index 503aa1119f4f..5715b0c73daa 100644 --- a/docs/content/docs/welcome/quick-start.md +++ b/docs/content/docs/welcome/quick-start.md @@ -30,10 +30,7 @@ It's not possible to mix files and packages/directories, and files must come fro Golangci-lint can be used with zero configuration. By default, the following linters are enabled: -```console -$ golangci-lint help linters -{.LintersCommandOutputEnabledOnly} -``` +{{% cli-output section="defaultEnabledLinters" cmd="help linters" %}} Pass `-E/--enable` to enable linter and `-D/--disable` to disable: diff --git a/docs/data/cli_help.json b/docs/data/cli_help.json new file mode 100644 index 000000000000..faf36c47ad29 --- /dev/null +++ b/docs/data/cli_help.json @@ -0,0 +1,15 @@ +{ + "defaultEnabledLinters": "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.", + "rootOutput": "Smart, fast linters runner.\n\nUsage:\n golangci-lint [flags]\n golangci-lint [command]\n\nAvailable Commands:\n cache Cache control and information.\n completion Generate the autocompletion script for the specified shell\n config Configuration file information and verification.\n custom Build a version of golangci-lint with custom linters.\n fmt Format Go source files.\n formatters List current formatters configuration.\n help Display extra help\n linters List current linters configuration.\n migrate Migrate configuration file from v1 to v2.\n run Lint the code.\n version Display the golangci-lint version.\n\nFlags:\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 --version Print version\n\nUse \"golangci-lint [command] --help\" for more information about a command.\n", + "runOutput": "Lint the code.\n\nUsage:\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", + "lintersOutput": "List current linters configuration.\n\nUsage:\n golangci-lint linters [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 --json Display as JSON\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", + "fmtOutput": "Format Go source files.\n\nUsage:\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", + "formattersOutput": "List current formatters configuration.\n\nUsage:\n golangci-lint formatters [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 --json Display as JSON\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", + "helpOutput": "Display extra help\n\nUsage:\n golangci-lint help [flags]\n golangci-lint help [command]\n\nAvailable Commands:\n formatters Display help for formatters.\n linters Display help for linters.\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\nUse \"golangci-lint help [command] --help\" for more information about a command.\n", + "migrateOutput": "Migrate configuration file from v1 to v2.\n\nUsage:\n golangci-lint migrate [flags]\n\nFlags:\n -c, --config PATH Read config from file path PATH\n --no-config Don't read config file\n --format string Output file format.\n By default, the format of the input configuration file is used.\n It can be 'yml', 'yaml', 'toml', or 'json'.\n --skip-validation Skip validation of the configuration file against the JSON Schema for v1.\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", + "configOutput": "Configuration file information and verification.\n\nUsage:\n golangci-lint config [flags]\n golangci-lint config [command]\n\nAvailable Commands:\n path Print used configuration path.\n verify Verify configuration against JSON schema.\n\nFlags:\n -c, --config PATH Read config from file path PATH\n --no-config Don't read config 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\nUse \"golangci-lint config [command] --help\" for more information about a command.\n", + "customOutput": "Build a version of golangci-lint with custom linters.\n\nUsage:\n golangci-lint custom [flags]\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", + "cacheOutput": "Cache control and information.\n\nUsage:\n golangci-lint cache [flags]\n golangci-lint cache [command]\n\nAvailable Commands:\n clean Clean cache\n status Show cache status\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\nUse \"golangci-lint cache [command] --help\" for more information about a command.\n", + "versionOutput": "Display the golangci-lint version.\n\nUsage:\n golangci-lint version [flags]\n\nFlags:\n --debug Add build information\n --json Display as JSON\n --short Display only the version number\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", + "completionOutput": "Generate the autocompletion script for golangci-lint for the specified shell.\nSee each sub-command's help for details on how to use the generated script.\n\nUsage:\n golangci-lint completion [command]\n\nAvailable Commands:\n bash Generate the autocompletion script for bash\n fish Generate the autocompletion script for fish\n powershell Generate the autocompletion script for powershell\n zsh Generate the autocompletion script for zsh\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\nUse \"golangci-lint completion [command] --help\" for more information about a command.\n" +} diff --git a/docs/data/configuration_file.json b/docs/data/configuration_file.json new file mode 100644 index 000000000000..90de70627432 --- /dev/null +++ b/docs/data/configuration_file.json @@ -0,0 +1,10 @@ +{ + "formatters": "formatters:\n # Enable specific formatter.\n # Default: [] (uses standard Go formatting)\n enable:\n - gci\n - gofmt\n - gofumpt\n - goimports\n - golines\n - swaggo\n # Formatters settings.\n settings:\n # See the dedicated \"formatters.settings\" documentation section.\n option: value\n exclusions:\n # Log a warning if an exclusion path is unused.\n # Default: false\n warn-unused: true\n # Mode of the generated files analysis.\n #\n # - `strict`: sources are excluded by strictly following the Go generated file convention.\n # Source files that have lines matching only the following regular expression will be excluded: `^// Code generated .* DO NOT EDIT\\.$`\n # This line must appear before the first non-comment, non-blank text in the file.\n # https://go.dev/s/generatedcode\n # - `lax`: sources are excluded if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc.\n # - `disable`: disable the generated files exclusion.\n #\n # Default: lax\n generated: strict\n # Which file paths to exclude.\n # This option is ignored when using `--stdin` as the path is unknown.\n # Default: []\n paths:\n - \".*\\\\.my\\\\.go$\"\n - lib/bad.go\n", + "issues": "issues:\n # Maximum issues count per one linter.\n # Set to 0 to disable.\n # Default: 50\n max-issues-per-linter: 0\n # Maximum count of issues with the same text.\n # Set to 0 to disable.\n # Default: 3\n max-same-issues: 0\n # Make issues output unique by line.\n # Default: true\n uniq-by-line: false\n # Show only new issues: if there are unstaged changes or untracked files,\n # 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:\n # much better don't allow issues in new code.\n #\n # Default: false\n new: true\n # Show only new issues created after the best common ancestor (merge-base against HEAD).\n # Default: \"\"\n new-from-merge-base: main\n # Show only new issues created after git revision `REV`.\n # Default: \"\"\n new-from-rev: HEAD\n # Show only new issues created in git patch with set file path.\n # Default: \"\"\n new-from-patch: path/to/patch/file\n # Show issues in any part of update files (requires new-from-rev or new-from-patch).\n # Default: false\n whole-files: true\n # Fix found issues (if it's supported by the linter).\n # Default: false\n fix: true\n", + "linters": "linters:\n # Default set of linters.\n # The value can be:\n # - `standard`: https://golangci-lint.run/docs/linters/#enabled-by-default\n # - `all`: enables all linters by default.\n # - `none`: disables all linters by default.\n # - `fast`: enables only linters considered as \"fast\" (`golangci-lint help linters --json | jq '[ .[] | select(.fast==true) ] | map(.name)'`).\n # Default: standard\n default: all\n # Enable specific linter.\n enable:\n - arangolint\n - asasalint\n - asciicheck\n - bidichk\n - bodyclose\n - canonicalheader\n - containedctx\n - contextcheck\n - copyloopvar\n - cyclop\n - decorder\n - depguard\n - dogsled\n - dupl\n - dupword\n - durationcheck\n - embeddedstructfieldcheck\n - err113\n - errcheck\n - errchkjson\n - errname\n - errorlint\n - exhaustive\n - exhaustruct\n - exptostd\n - fatcontext\n - forbidigo\n - forcetypeassert\n - funcorder\n - funlen\n - ginkgolinter\n - gocheckcompilerdirectives\n - gochecknoglobals\n - gochecknoinits\n - gochecksumtype\n - gocognit\n - goconst\n - gocritic\n - gocyclo\n - godot\n - godox\n - goheader\n - gomoddirectives\n - gomodguard\n - goprintffuncname\n - gosec\n - gosmopolitan\n - govet\n - grouper\n - iface\n - importas\n - inamedparam\n - ineffassign\n - interfacebloat\n - intrange\n - ireturn\n - lll\n - loggercheck\n - maintidx\n - makezero\n - mirror\n - misspell\n - mnd\n - musttag\n - nakedret\n - nestif\n - nilerr\n - nilnesserr\n - nilnil\n - nlreturn\n - noctx\n - noinlineerr\n - nolintlint\n - nonamedreturns\n - nosprintfhostport\n - paralleltest\n - perfsprint\n - prealloc\n - predeclared\n - promlinter\n - protogetter\n - reassign\n - recvcheck\n - revive\n - rowserrcheck\n - sloglint\n - spancheck\n - sqlclosecheck\n - staticcheck\n - tagalign\n - tagliatelle\n - testableexamples\n - testifylint\n - testpackage\n - thelper\n - tparallel\n - unconvert\n - unparam\n - unused\n - usestdlibvars\n - usetesting\n - varnamelen\n - wastedassign\n - whitespace\n - wrapcheck\n - wsl\n - wsl_v5\n - zerologlint\n # Disable specific linters.\n disable:\n - arangolint\n - asasalint\n - asciicheck\n - bidichk\n - bodyclose\n - canonicalheader\n - containedctx\n - contextcheck\n - copyloopvar\n - cyclop\n - decorder\n - depguard\n - dogsled\n - dupl\n - dupword\n - durationcheck\n - embeddedstructfieldcheck\n - err113\n - errcheck\n - errchkjson\n - errname\n - errorlint\n - exhaustive\n - exhaustruct\n - exptostd\n - fatcontext\n - forbidigo\n - forcetypeassert\n - funcorder\n - funlen\n - ginkgolinter\n - gocheckcompilerdirectives\n - gochecknoglobals\n - gochecknoinits\n - gochecksumtype\n - gocognit\n - goconst\n - gocritic\n - gocyclo\n - godot\n - godox\n - goheader\n - gomoddirectives\n - gomodguard\n - goprintffuncname\n - gosec\n - gosmopolitan\n - govet\n - grouper\n - iface\n - importas\n - inamedparam\n - ineffassign\n - interfacebloat\n - intrange\n - ireturn\n - lll\n - loggercheck\n - maintidx\n - makezero\n - mirror\n - misspell\n - mnd\n - musttag\n - nakedret\n - nestif\n - nilerr\n - nilnesserr\n - nilnil\n - nlreturn\n - noctx\n - noinlineerr\n - nolintlint\n - nonamedreturns\n - nosprintfhostport\n - paralleltest\n - perfsprint\n - prealloc\n - predeclared\n - promlinter\n - protogetter\n - reassign\n - recvcheck\n - revive\n - rowserrcheck\n - sloglint\n - spancheck\n - sqlclosecheck\n - staticcheck\n - tagalign\n - tagliatelle\n - testableexamples\n - testifylint\n - testpackage\n - thelper\n - tparallel\n - unconvert\n - unparam\n - unused\n - usestdlibvars\n - usetesting\n - varnamelen\n - wastedassign\n - whitespace\n - wrapcheck\n - wsl\n - wsl_v5\n - zerologlint\n # All available settings of specific linters.\n settings:\n # See the dedicated \"linters.settings\" documentation section.\n option: value\n # Defines a set of rules to ignore issues.\n # It does not skip the analysis, and so does not ignore \"typecheck\" errors.\n exclusions:\n # Mode of the generated files analysis.\n #\n # - `strict`: sources are excluded by strictly following the Go generated file convention.\n # Source files that have lines matching only the following regular expression will be excluded: `^// Code generated .* DO NOT EDIT\\.$`\n # This line must appear before the first non-comment, non-blank text in the file.\n # https://go.dev/s/generatedcode\n # - `lax`: sources are excluded if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc.\n # - `disable`: disable the generated files exclusion.\n #\n # Default: strict\n generated: lax\n # Log a warning if an exclusion rule is unused.\n # Default: false\n warn-unused: true\n # Predefined exclusion rules.\n # Default: []\n presets:\n - comments\n - std-error-handling\n - common-false-positives\n - legacy\n # Excluding configuration per-path, per-linter, per-text and per-source.\n rules:\n # Exclude some linters from running on tests files.\n - path: _test\\.go\n linters:\n - gocyclo\n - errcheck\n - dupl\n - gosec\n # Run some linter only for test files by excluding its issues for everything else.\n - path-except: _test\\.go\n linters:\n - forbidigo\n # Exclude known linters from partially hard-vendored code,\n # which is impossible to exclude via `nolint` comments.\n # `/` will be replaced by the current OS file path separator to properly work on Windows.\n - path: internal/hmac/\n text: \"weak cryptographic primitive\"\n linters:\n - gosec\n # Exclude some `staticcheck` messages.\n - linters:\n - staticcheck\n text: \"SA9003:\"\n # Exclude `lll` issues for long lines with `go:generate`.\n - linters:\n - lll\n source: \"^//go:generate \"\n # Which file paths to exclude: they will be analyzed, but issues from them won't be reported.\n # \"/\" will be replaced by the current OS file path separator to properly work on Windows.\n # Default: []\n paths:\n - \".*\\\\.my\\\\.go$\"\n - lib/bad.go\n # Which file paths to not exclude.\n # Default: []\n paths-except:\n - \".*\\\\.my\\\\.go$\"\n - lib/bad.go\n", + "output": "# Output configuration options.\noutput:\n # The formats used to render issues.\n formats:\n # Prints issues in a text format with colors, line number, and linter name.\n # This format is the default format.\n text:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.txt\n # Print linter name in the end of issue text.\n # Default: true\n print-linter-name: false\n # Print lines of code with issue.\n # Default: true\n print-issued-lines: false\n # Use colors.\n # Default: true\n colors: false\n # Prints issues in a JSON representation.\n json:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.json\n # Prints issues in columns representation separated by tabulations.\n tab:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.txt\n # Print linter name in the end of issue text.\n # Default: true\n print-linter-name: true\n # Use colors.\n # Default: true\n colors: false\n # Prints issues in an HTML page.\n # It uses the Cloudflare CDN (cdnjs) and React.\n html:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.html\n # Prints issues in the Checkstyle format.\n checkstyle:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.xml\n # Prints issues in the Code Climate format.\n code-climate:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.json\n # Prints issues in the JUnit XML format.\n junit-xml:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.xml\n # Support extra JUnit XML fields.\n # Default: false\n extended: true\n # Prints issues in the TeamCity format.\n teamcity:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.txt\n # Prints issues in the SARIF format.\n sarif:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.json\n # Add a prefix to the output file references.\n # This option is ignored when using `output.path-mode: abs` mode.\n # Default: \"\"\n path-prefix: \"\"\n # By default, the report are related to the path obtained by `run.relative-path-mode`.\n # The mode `abs` allows to show absolute file paths instead of relative file paths.\n # The option `output.path-prefix` is ignored when using `abs` mode.\n # Default: \"\"\n path-mode: \"abs\"\n # Order to use when sorting results.\n # Possible values: `file`, `linter`, and `severity`.\n #\n # If the severity values are inside the following list, they are ordered in this order:\n # 1. error\n # 2. warning\n # 3. high\n # 4. medium\n # 5. low\n # Either they are sorted alphabetically.\n #\n # Default: [\"linter\", \"file\"]\n sort-order:\n - linter\n - severity\n - file # filepath, line, and column.\n # Show statistics per linter.\n # Default: true\n show-stats: false\n", + "root": "# See the dedicated \"version\" documentation section.\nversion: \"2\"\nlinters:\n # See the dedicated \"linters\" documentation section.\n option: value\nformatters:\n # See the dedicated \"formatters\" documentation section.\n option: value\nissues:\n # See the dedicated \"issues\" documentation section.\n option: value\n# Output configuration options.\noutput:\n # See the dedicated \"output\" documentation section.\n option: value\n# Options for analysis running.\nrun:\n # See the dedicated \"run\" documentation section.\n option: value\nseverity:\n # See the dedicated \"severity\" documentation section.\n option: value\n", + "run": "# Options for analysis running.\nrun:\n # Timeout for total work, e.g. 30s, 5m, 5m30s.\n # If the value is lower or equal to 0, the timeout is disabled.\n # Default: 0 (disabled)\n timeout: 5m\n # The mode used to evaluate relative paths.\n # It's used by exclusions, Go plugins, and some linters.\n # The value can be:\n # - `gomod`: the paths will be relative to the directory of the `go.mod` file.\n # - `gitroot`: the paths will be relative to the git root (the parent directory of `.git`).\n # - `cfg`: the paths will be relative to the configuration file.\n # - `wd` (NOT recommended): the paths will be relative to the place where golangci-lint is run.\n # Default: cfg\n relative-path-mode: gomod\n # Exit code when at least one issue was found.\n # Default: 1\n issues-exit-code: 2\n # Include test files or not.\n # Default: true\n tests: false\n # List of build tags, all linters use it.\n # Default: []\n build-tags:\n - mytag\n # If set, we pass it to \"go list -mod={option}\". From \"go help modules\":\n # If invoked with -mod=readonly, the go command is disallowed from the implicit\n # automatic updating of go.mod described above. Instead, it fails when any changes\n # to go.mod are needed. This setting is most useful to check that go.mod does\n # not need updates, such as in a continuous integration and testing system.\n # If invoked with -mod=vendor, the go command assumes that the vendor\n # directory holds the correct copies of dependencies and ignores\n # the dependency descriptions in go.mod.\n #\n # Allowed values: readonly|vendor|mod\n # Default: \"\"\n modules-download-mode: readonly\n # Allow multiple parallel golangci-lint instances running.\n # If false, golangci-lint acquires file lock on start.\n # Default: false\n allow-parallel-runners: true\n # Allow multiple golangci-lint instances running, but serialize them around a lock.\n # If false, golangci-lint exits with an error if it fails to acquire file lock on start.\n # Default: false\n allow-serial-runners: true\n # Define the Go version limit.\n # Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.22.\n go: '1.23'\n # Number of operating system threads (`GOMAXPROCS`) that can execute golangci-lint simultaneously.\n # Default: 0 (automatically set to match Linux container CPU quota and\n # fall back to the number of logical CPUs in the machine)\n concurrency: 4\n", + "severity": "severity:\n # Set the default severity for issues.\n #\n # If severity rules are defined and the issues do not match or no severity is provided to the rule\n # this will be the default severity applied.\n # Severities should match the supported severity names of the selected out format.\n # - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity\n # - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#SeverityLevel\n # - GitHub: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message\n # - TeamCity: https://www.jetbrains.com/help/teamcity/service-messages.html#Inspection+Instance\n #\n # `@linter` can be used as severity value to keep the severity from linters (e.g. revive, gosec, ...)\n #\n # Default: \"\"\n default: error\n # When a list of severity rules are provided, severity information will be added to lint issues.\n # Severity rules have the same filtering capability as exclude rules\n # except you are allowed to specify one matcher per severity rule.\n #\n # `@linter` can be used as severity value to keep the severity from linters (e.g. revive, gosec, ...)\n #\n # Only affects out formats that support setting severity information.\n #\n # Default: []\n rules:\n - linters:\n - dupl\n severity: info\n", + "version": "# Defines the configuration version.\n# The only possible value is \"2\".\nversion: \"2\"\n" +} diff --git a/assets/exclusion-presets.json b/docs/data/exclusion_presets.json similarity index 100% rename from assets/exclusion-presets.json rename to docs/data/exclusion_presets.json diff --git a/docs/data/formatter_settings.json b/docs/data/formatter_settings.json new file mode 100644 index 000000000000..04257b997dc6 --- /dev/null +++ b/docs/data/formatter_settings.json @@ -0,0 +1,7 @@ +{ + "gci": "formatters:\n settings:\n gci:\n # Section configuration to compare against.\n # Section names are case-insensitive and may contain parameters in ().\n # The default order of sections is `standard \u003e default \u003e custom \u003e blank \u003e dot \u003e alias \u003e localmodule`.\n # If `custom-order` is `true`, it follows the order of `sections` option.\n # Default: [\"standard\", \"default\"]\n sections:\n - standard # Standard section: captures all standard packages.\n - default # Default section: contains all imports that could not be matched to another section type.\n - prefix(github.com/org/project) # Custom section: groups all imports with the specified Prefix.\n - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.\n - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.\n - alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.\n - localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.\n # Checks that no inline comments are present.\n # Default: false\n no-inline-comments: true\n # Checks that no prefix comments (comment lines above an import) are present.\n # Default: false\n no-prefix-comments: true\n # Enable custom order of sections.\n # If `true`, make the section order the same as the order of `sections`.\n # Default: false\n custom-order: true\n # Drops lexical ordering for custom sections.\n # Default: false\n no-lex-order: true\n", + "gofmt": "formatters:\n settings:\n gofmt:\n # Simplify code: gofmt with `-s` option.\n # Default: true\n simplify: false\n # Apply the rewrite rules to the source before reformatting.\n # https://pkg.go.dev/cmd/gofmt\n # Default: []\n rewrite-rules:\n - pattern: 'interface{}'\n replacement: 'any'\n - pattern: 'a[b:len(a)]'\n replacement: 'a[b:]'\n", + "gofumpt": "formatters:\n settings:\n gofumpt:\n # Module path which contains the source code being formatted.\n # Default: \"\"\n module-path: github.com/org/project\n # Choose whether to use the extra rules.\n # Default: false\n extra-rules: true\n", + "goimports": "formatters:\n settings:\n goimports:\n # A list of prefixes, which, if set, checks import paths\n # with the given prefixes are grouped after 3rd-party packages.\n # Default: []\n local-prefixes:\n - github.com/org/project\n", + "golines": "formatters:\n settings:\n golines:\n # Target maximum line length.\n # Default: 100\n max-len: 200\n # Length of a tabulation.\n # Default: 4\n tab-len: 8\n # Shorten single-line comments.\n # Default: false\n shorten-comments: true\n # Default: true\n reformat-tags: false\n # Split chained methods on the dots as opposed to the arguments.\n # Default: true\n chain-split-dots: false\n" +} diff --git a/assets/formatters-info.json b/docs/data/formatters_info.json similarity index 93% rename from assets/formatters-info.json rename to docs/data/formatters_info.json index e25c10e2f7f7..77b7405edea3 100644 --- a/assets/formatters-info.json +++ b/docs/data/formatters_info.json @@ -2,7 +2,6 @@ { "name": "gci", "desc": "Check if code and import statements are formatted, with additional rules.", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/daixiang0/gci", "internal": false, @@ -13,7 +12,6 @@ { "name": "gofmt", "desc": "Check if the code is formatted according to 'gofmt' command.", - "Groups": null, "loadMode": 8199, "originalURL": "https://pkg.go.dev/cmd/gofmt", "internal": false, @@ -24,7 +22,6 @@ { "name": "gofumpt", "desc": "Check if code and import statements are formatted, with additional rules.", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/mvdan/gofumpt", "internal": false, @@ -35,7 +32,6 @@ { "name": "golines", "desc": "Checks if code is formatted, and fixes long lines", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/segmentio/golines", "internal": false, @@ -46,7 +42,6 @@ { "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, @@ -57,7 +52,6 @@ { "name": "swaggo", "desc": "Check if swaggo comments are formatted", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/swaggo/swaggo", "internal": false, diff --git a/docs/data/linter_settings.json b/docs/data/linter_settings.json new file mode 100644 index 000000000000..76159eb12a46 --- /dev/null +++ b/docs/data/linter_settings.json @@ -0,0 +1,81 @@ +{ + "asasalint": "linters:\n settings:\n asasalint:\n # To specify a set of function names to exclude.\n # The values are merged with the builtin exclusions.\n # The builtin exclusions can be disabled by setting `use-builtin-exclusions` to `false`.\n # Default: [\"^(fmt|log|logger|t|)\\.(Print|Fprint|Sprint|Fatal|Panic|Error|Warn|Warning|Info|Debug|Log)(|f|ln)$\"]\n exclude:\n - Append\n - \\.Wrapf\n # To enable/disable the asasalint builtin exclusions of function names.\n # See the default value of `exclude` to get the builtin exclusions.\n # Default: true\n use-builtin-exclusions: false\n", + "bidichk": "linters:\n settings:\n bidichk:\n # The following configurations check for all mentioned invisible Unicode runes.\n # All runes are enabled by default.\n left-to-right-embedding: false\n right-to-left-embedding: false\n pop-directional-formatting: false\n left-to-right-override: false\n right-to-left-override: false\n left-to-right-isolate: false\n right-to-left-isolate: false\n first-strong-isolate: false\n pop-directional-isolate: false\n", + "copyloopvar": "linters:\n settings:\n copyloopvar:\n # Check all assigning the loop variable to another variable.\n # Default: false\n check-alias: true\n", + "cyclop": "linters:\n settings:\n cyclop:\n # The maximal code complexity to report.\n # Default: 10\n max-complexity: 10\n # The maximal average package complexity.\n # If it's higher than 0.0 (float) the check is enabled.\n # Default: 0.0\n package-average: 0.5\n", + "decorder": "linters:\n settings:\n decorder:\n # Required order of `type`, `const`, `var` and `func` declarations inside a file.\n # Default: types before constants before variables before functions.\n dec-order:\n - type\n - const\n - var\n - func\n # If true, underscore vars (vars with \"_\" as the name) will be ignored at all checks.\n # Default: false (underscore vars are not ignored)\n ignore-underscore-vars: false\n # If true, order of declarations is not checked at all.\n # Default: true (disabled)\n disable-dec-order-check: false\n # If true, `init` func can be anywhere in file (does not have to be declared before all other functions).\n # Default: true (disabled)\n disable-init-func-first-check: false\n # If true, multiple global `type`, `const` and `var` declarations are allowed.\n # Default: true (disabled)\n disable-dec-num-check: false\n # If true, type declarations will be ignored for dec num check.\n # Default: false (type statements are not ignored)\n disable-type-dec-num-check: false\n # If true, const declarations will be ignored for dec num check.\n # Default: false (const statements are not ignored)\n disable-const-dec-num-check: false\n # If true, var declarations will be ignored for dec num check.\n # Default: false (var statements are not ignored)\n disable-var-dec-num-check: false\n", + "depguard": "linters:\n settings:\n depguard:\n # Rules to apply.\n #\n # Variables:\n # - File Variables\n # Use an exclamation mark `!` to negate a variable.\n # Example: `!$test` matches any file that is not a go test file.\n #\n # `$all` - matches all go files\n # `$test` - matches all go test files\n #\n # - Package Variables\n #\n # `$gostd` - matches all of go's standard library (Pulled from `GOROOT`)\n #\n # Default (applies if no custom rules are defined): Only allow $gostd in all files.\n rules:\n # Name of a rule.\n main:\n # Defines package matching behavior. Available modes:\n # - `original`: allowed if it doesn't match the deny list and either matches the allow list or the allow list is empty.\n # - `strict`: allowed only if it matches the allow list and either doesn't match the deny list or the allow rule is more specific (longer) than the deny rule.\n # - `lax`: allowed if it doesn't match the deny list or the allow rule is more specific (longer) than the deny rule.\n # Default: \"original\"\n list-mode: lax\n # List of file globs that will match this list of settings to compare against.\n # By default, if a path is relative, it is relative to the directory where the golangci-lint command is executed.\n # The placeholder '${base-path}' is substituted with a path relative to the mode defined with `run.relative-path-mode`.\n # The placeholder '${config-path}' is substituted with a path relative to the configuration file.\n # Default: $all\n files:\n - \"!**/*_a _file.go\"\n # List of allowed packages.\n # Entries can be a variable (starting with $), a string prefix, or an exact match (if ending with $).\n # Default: []\n allow:\n - $gostd\n - github.com/OpenPeeDeeP\n # List of packages that are not allowed.\n # Entries can be a variable (starting with $), a string prefix, or an exact match (if ending with $).\n # Default: []\n deny:\n - pkg: \"math/rand$\"\n desc: use math/rand/v2\n - pkg: \"github.com/sirupsen/logrus\"\n desc: not allowed\n - pkg: \"github.com/pkg/errors\"\n desc: Should be replaced by standard lib errors package\n", + "dogsled": "linters:\n settings:\n dogsled:\n # Checks assignments with too many blank identifiers.\n # Default: 2\n max-blank-identifiers: 3\n", + "dupl": "linters:\n settings:\n dupl:\n # Tokens count to trigger issue.\n # Default: 150\n threshold: 100\n", + "dupword": "linters:\n settings:\n dupword:\n # Keywords for detecting duplicate words.\n # If this list is not empty, only the words defined in this list will be detected.\n # Default: []\n keywords:\n - \"the\"\n - \"and\"\n - \"a\"\n # Keywords used to ignore detection.\n # Default: []\n ignore:\n - \"0C0C\"\n", + "embeddedstructfieldcheck": "linters:\n settings:\n embeddedstructfieldcheck:\n # Checks that sync.Mutex and sync.RWMutex are not used as embedded fields.\n # Default: false\n forbid-mutex: true\n", + "errcheck": "linters:\n settings:\n errcheck:\n # Report about not checking of errors in type assertions: `a := b.(MyStruct)`.\n # Such cases aren't reported by default.\n # Default: false\n check-type-assertions: true\n # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`.\n # Such cases aren't reported by default.\n # Default: false\n check-blank: true\n # To disable the errcheck built-in exclude list.\n # See `-excludeonly` option in https://github.com/kisielk/errcheck#excluding-functions for details.\n # Default: false\n disable-default-exclusions: true\n # List of functions to exclude from checking, where each entry is a single function to exclude.\n # See https://github.com/kisielk/errcheck#excluding-functions for details.\n exclude-functions:\n - io/ioutil.ReadFile\n - io.Copy(*bytes.Buffer)\n - io.Copy(os.Stdout)\n # Display function signature instead of selector.\n # Default: false\n verbose: true\n", + "errchkjson": "linters:\n settings:\n errchkjson:\n # With check-error-free-encoding set to true, errchkjson does warn about errors\n # from json encoding functions that are safe to be ignored,\n # because they are not possible to happen.\n #\n # if check-error-free-encoding is set to true and errcheck linter is enabled,\n # it is recommended to add the following exceptions to prevent from false positives:\n #\n # linters:\n # settings:\n # errcheck:\n # exclude-functions:\n # - encoding/json.Marshal\n # - encoding/json.MarshalIndent\n #\n # Default: false\n check-error-free-encoding: true\n # Issue on struct encoding that doesn't have exported fields.\n # Default: false\n report-no-exported: false\n", + "errorlint": "linters:\n settings:\n errorlint:\n # Check whether fmt.Errorf uses the %w verb for formatting errors.\n # See the https://github.com/polyfloyd/go-errorlint for caveats.\n # Default: true\n errorf: false\n # Permit more than 1 %w verb, valid per Go 1.20 (requires `errorf: true`).\n # Default: true\n errorf-multi: false\n # Check for plain type assertions and type switches.\n # Default: true\n asserts: false\n # Check for plain error comparisons.\n # Default: true\n comparison: false\n # Allowed errors.\n # Default: []\n allowed-errors:\n - err: \"io.EOF\"\n fun: \"example.com/pkg.Read\"\n # Allowed error \"wildcards\".\n # Default: []\n allowed-errors-wildcard:\n - err: \"example.com/pkg.ErrMagic\"\n fun: \"example.com/pkg.Magic\"\n", + "exhaustive": "linters:\n settings:\n exhaustive:\n # Program elements to check for exhaustiveness.\n # Default: [ switch ]\n check:\n - switch\n - map\n # Presence of \"default\" case in switch statements satisfies exhaustiveness,\n # even if all enum members are not listed.\n # Default: false\n default-signifies-exhaustive: true\n # Enum members matching the supplied regex do not have to be listed in\n # switch statements to satisfy exhaustiveness.\n # Default: \"\"\n ignore-enum-members: \"Example.+\"\n # Enum types matching the supplied regex do not have to be listed in\n # switch statements to satisfy exhaustiveness.\n # Default: \"\"\n ignore-enum-types: \"Example.+\"\n # Consider enums only in package scopes, not in inner scopes.\n # Default: false\n package-scope-only: true\n # Only run exhaustive check on switches with \"//exhaustive:enforce\" comment.\n # Default: false\n explicit-exhaustive-switch: true\n # Only run exhaustive check on map literals with \"//exhaustive:enforce\" comment.\n # Default: false\n explicit-exhaustive-map: true\n # Switch statement requires default case even if exhaustive.\n # Default: false\n default-case-required: true\n", + "exhaustruct": "linters:\n settings:\n exhaustruct:\n # List of regular expressions to match struct packages and their names.\n # Regular expressions must match complete canonical struct package/name/structname.\n # If this list is empty, all structs are tested.\n # Default: []\n include:\n - '.+\\.Test'\n - 'example\\.com/package\\.ExampleStruct[\\d]{1,2}'\n # List of regular expressions to exclude struct packages and their names from checks.\n # Regular expressions must match complete canonical struct package/name/structname.\n # Default: []\n exclude:\n - '.+/cobra\\.Command$'\n", + "fatcontext": "linters:\n settings:\n fatcontext:\n # Check for potential fat contexts in struct pointers.\n # May generate false positives.\n # Default: false\n check-struct-pointers: true\n", + "forbidigo": "linters:\n settings:\n forbidigo:\n # Forbid the following identifiers (list of regexp).\n # Default: [\"^(fmt\\\\.Print(|f|ln)|print|println)$\"]\n forbid:\n # Built-in bootstrapping functions.\n - pattern: ^print(ln)?$\n # Optional message that gets included in error reports.\n - pattern: ^fmt\\.Print.*$\n msg: Do not commit print statements.\n # Alternatively, put messages at the end of the regex, surrounded by `(# )?`.\n # Escape any special characters. Those messages get included in error reports.\n - pattern: 'fmt\\.Print.*(# Do not commit print statements\\.)?'\n # Forbid spew Dump, whether it is called as function or method.\n # Depends on analyze-types below.\n - pattern: ^spew\\.(ConfigState\\.)?Dump$\n # The package name might be ambiguous.\n # The full import path can be used as additional criteria.\n # Depends on analyze-types below.\n - pattern: ^v1.Dump$\n pkg: ^example.com/pkg/api/v1$\n # Exclude godoc examples from forbidigo checks.\n # Default: true\n exclude-godoc-examples: false\n # Instead of matching the literal source code,\n # use type information to replace expressions with strings that contain the package name\n # and (for methods and fields) the type name.\n # This makes it possible to handle import renaming and forbid struct fields and methods.\n # Default: false\n analyze-types: true\n", + "funcorder": "linters:\n settings:\n funcorder:\n # Checks that constructors are placed after the structure declaration.\n # Default: true\n constructor: false\n # Checks if the exported methods of a structure are placed before the non-exported ones.\n # Default: true\n struct-method: false\n # Checks if the constructors and/or structure methods are sorted alphabetically.\n # Default: false\n alphabetical: true\n", + "funlen": "linters:\n settings:\n funlen:\n # Checks the number of lines in a function.\n # If lower than 0, disable the check.\n # Default: 60\n lines: -1\n # Checks the number of statements in a function.\n # If lower than 0, disable the check.\n # Default: 40\n statements: -1\n # Ignore comments when counting lines.\n # Default: true\n ignore-comments: false\n", + "ginkgolinter": "linters:\n settings:\n ginkgolinter:\n # Suppress the wrong length assertion warning.\n # Default: false\n suppress-len-assertion: true\n # Suppress the wrong nil assertion warning.\n # Default: false\n suppress-nil-assertion: true\n # Suppress the wrong error assertion warning.\n # Default: false\n suppress-err-assertion: true\n # Suppress the wrong comparison assertion warning.\n # Default: false\n suppress-compare-assertion: true\n # Suppress the function all in async assertion warning.\n # Default: false\n suppress-async-assertion: true\n # Suppress warning for comparing values from different types, like `int32` and `uint32`.\n # Default: false\n suppress-type-compare-assertion: true\n # Trigger warning for ginkgo focus containers like `FDescribe`, `FContext`, `FWhen` or `FIt`.\n # Default: false\n forbid-focus-container: true\n # Don't trigger warnings for HaveLen(0)\n # Default: false\n allow-havelen-zero: true\n # Force using `Expect` with `To`, `ToNot` or `NotTo`.\n # Reject using `Expect` with `Should` or `ShouldNot`.\n # Default: false\n force-expect-to: true\n # Best effort validation of async intervals (timeout and polling).\n # Ignored the `suppress-async-assertion` is true.\n # Default: false\n validate-async-intervals: true\n # Trigger a warning for variable assignments in ginkgo containers like `Describe`, `Context` and `When`, instead of in `BeforeEach()`.\n # Default: false\n forbid-spec-pollution: true\n # Force using the Succeed matcher for error functions, and the HaveOccurred matcher for non-function error values.\n # Default: false\n force-succeed: true\n # Force adding assertion descriptions to gomega matchers.\n # Default: false\n force-assertion-description: true\n", + "gochecksumtype": "linters:\n settings:\n gochecksumtype:\n # Presence of `default` case in switch statements satisfies exhaustiveness, if all members are not listed.\n # Default: true\n default-signifies-exhaustive: false\n # Include shared interfaces in the exhaustiveness check.\n # Default: false\n include-shared-interfaces: true\n", + "gocognit": "linters:\n settings:\n gocognit:\n # Minimal code complexity to report.\n # Default: 30 (but we recommend 10-20)\n min-complexity: 10\n", + "goconst": "linters:\n settings:\n goconst:\n # Minimal length of string constant.\n # Default: 3\n min-len: 2\n # Minimum occurrences of constant string count to trigger issue.\n # Default: 3\n min-occurrences: 2\n # Look for existing constants matching the values.\n # Default: true\n match-constant: false\n # Search also for duplicated numbers.\n # Default: false\n numbers: true\n # Minimum value, only works with `goconst.numbers`.\n # Default: 3\n min: 2\n # Maximum value, only works with `goconst.numbers`.\n # Default: 3\n max: 2\n # Ignore when constant is not used as function argument.\n # Default: true\n ignore-calls: false\n # Exclude strings matching the given regular expression.\n # Default: \"\"\n ignore-string-values:\n - 'foo.+'\n # Detects constants with identical values.\n # Default: false\n find-duplicates: true\n # Evaluates of constant expressions like Prefix + \"suffix\".\n # Default: false\n eval-const-expressions: true\n", + "gocritic": "linters:\n settings:\n gocritic:\n # Disable all checks.\n # Default: false\n disable-all: true\n # Which checks should be enabled in addition to default checks; can't be combined with 'disabled-checks'.\n # By default, list of stable checks is used (https://go-critic.com/overview#checks-overview):\n # appendAssign, argOrder, assignOp, badCall, badCond, captLocal, caseOrder, codegenComment, commentFormatting,\n # defaultCaseOrder, deprecatedComment, dupArg, dupBranchBody, dupCase, dupSubExpr, elseif, exitAfterDefer,\n # flagDeref, flagName, ifElseChain, mapKey, newDeref, offBy1, regexpMust, singleCaseSwitch, sloppyLen,\n # sloppyTypeAssert, switchTrue, typeSwitchVar, underef, unlambda, unslice, valSwap, wrapperFunc\n # To see which checks are enabled run `GL_DEBUG=gocritic golangci-lint run --enable=gocritic`.\n enabled-checks:\n # Detects suspicious append result assignments.\n # https://go-critic.com/overview.html#appendassign\n - appendAssign\n # Detects `append` chains to the same slice that can be done in a single `append` call.\n # https://go-critic.com/overview.html#appendcombine\n - appendCombine\n # Detects suspicious arguments order.\n # https://go-critic.com/overview.html#argorder\n - argOrder\n # Detects assignments that can be simplified by using assignment operators.\n # https://go-critic.com/overview.html#assignop\n - assignOp\n # Detects suspicious function calls.\n # https://go-critic.com/overview.html#badcall\n - badCall\n # Detects suspicious condition expressions.\n # https://go-critic.com/overview.html#badcond\n - badCond\n # Detects suspicious mutex lock/unlock operations.\n # https://go-critic.com/overview.html#badlock\n - badLock\n # Detects suspicious regexp patterns.\n # https://go-critic.com/overview.html#badregexp\n - badRegexp\n # Detects bad usage of sort package.\n # https://go-critic.com/overview.html#badsorting\n - badSorting\n # Detects bad usage of sync.OnceFunc.\n # https://go-critic.com/overview.html#badsynconcefunc\n - badSyncOnceFunc\n # Detects bool expressions that can be simplified.\n # https://go-critic.com/overview.html#boolexprsimplify\n - boolExprSimplify\n # Detects when predeclared identifiers are shadowed in assignments.\n # https://go-critic.com/overview.html#builtinshadow\n - builtinShadow\n # Detects top-level declarations that shadow the predeclared identifiers.\n # https://go-critic.com/overview.html#builtinshadowdecl\n - builtinShadowDecl\n # Detects capitalized names for local variables.\n # https://go-critic.com/overview.html#captlocal\n - captLocal\n # Detects erroneous case order inside switch statements.\n # https://go-critic.com/overview.html#caseorder\n - caseOrder\n # Detects malformed 'code generated' file comments.\n # https://go-critic.com/overview.html#codegencomment\n - codegenComment\n # Detects comments with non-idiomatic formatting.\n # https://go-critic.com/overview.html#commentformatting\n - commentFormatting\n # Detects commented-out code inside function bodies.\n # https://go-critic.com/overview.html#commentedoutcode\n - commentedOutCode\n # Detects commented-out imports.\n # https://go-critic.com/overview.html#commentedoutimport\n - commentedOutImport\n # Detects when default case in switch isn't on 1st or last position.\n # https://go-critic.com/overview.html#defaultcaseorder\n - defaultCaseOrder\n # Detects loops inside functions that use defer.\n # https://go-critic.com/overview.html#deferinloop\n - deferInLoop\n # Detects deferred function literals that can be simplified.\n # https://go-critic.com/overview.html#deferunlambda\n - deferUnlambda\n # Detects malformed 'deprecated' doc-comments.\n # https://go-critic.com/overview.html#deprecatedcomment\n - deprecatedComment\n # Detects comments that silence go lint complaints about doc-comment.\n # https://go-critic.com/overview.html#docstub\n - docStub\n # Detects suspicious duplicated arguments.\n # https://go-critic.com/overview.html#duparg\n - dupArg\n # Detects duplicated branch bodies inside conditional statements.\n # https://go-critic.com/overview.html#dupbranchbody\n - dupBranchBody\n # Detects duplicated case clauses inside switch or select statements.\n # https://go-critic.com/overview.html#dupcase\n - dupCase\n # Detects multiple imports of the same package under different aliases.\n # https://go-critic.com/overview.html#dupimport\n - dupImport\n # Detects suspicious duplicated sub-expressions.\n # https://go-critic.com/overview.html#dupsubexpr\n - dupSubExpr\n # Detects suspicious formatting strings usage.\n # https://go-critic.com/overview.html#dynamicfmtstring\n - dynamicFmtString\n # Detects else with nested if statement that can be replaced with else-if.\n # https://go-critic.com/overview.html#elseif\n - elseif\n # Detects suspicious empty declarations blocks.\n # https://go-critic.com/overview.html#emptydecl\n - emptyDecl\n # Detects fallthrough that can be avoided by using multi case values.\n # https://go-critic.com/overview.html#emptyfallthrough\n - emptyFallthrough\n # Detects empty string checks that can be written more idiomatically.\n # https://go-critic.com/overview.html#emptystringtest\n - emptyStringTest\n # Detects unoptimal strings/bytes case-insensitive comparison.\n # https://go-critic.com/overview.html#equalfold\n - equalFold\n # Detects unwanted dependencies on the evaluation order.\n # https://go-critic.com/overview.html#evalorder\n - evalOrder\n # Detects calls to exit/fatal inside functions that use defer.\n # https://go-critic.com/overview.html#exitafterdefer\n - exitAfterDefer\n # Detects exposed methods from sync.Mutex and sync.RWMutex.\n # https://go-critic.com/overview.html#exposedsyncmutex\n - exposedSyncMutex\n # Detects suspicious reassignment of error from another package.\n # https://go-critic.com/overview.html#externalerrorreassign\n - externalErrorReassign\n # Detects problems in filepath.Join() function calls.\n # https://go-critic.com/overview.html#filepathjoin\n - filepathJoin\n # Detects immediate dereferencing of `flag` package pointers.\n # https://go-critic.com/overview.html#flagderef\n - flagDeref\n # Detects suspicious flag names.\n # https://go-critic.com/overview.html#flagname\n - flagName\n # Detects hex literals that have mixed case letter digits.\n # https://go-critic.com/overview.html#hexliteral\n - hexLiteral\n # Detects nil usages in http.NewRequest calls, suggesting http.NoBody as an alternative.\n # https://go-critic.com/overview.html#httpnobody\n - httpNoBody\n # Detects params that incur excessive amount of copying.\n # https://go-critic.com/overview.html#hugeparam\n - hugeParam\n # Detects repeated if-else statements and suggests to replace them with switch statement.\n # https://go-critic.com/overview.html#ifelsechain\n - ifElseChain\n # Detects when imported package names shadowed in the assignments.\n # https://go-critic.com/overview.html#importshadow\n - importShadow\n # Detects strings.Index calls that may cause unwanted allocs.\n # https://go-critic.com/overview.html#indexalloc\n - indexAlloc\n # Detects non-assignment statements inside if/switch init clause.\n # https://go-critic.com/overview.html#initclause\n - initClause\n # Detects suspicious map literal keys.\n # https://go-critic.com/overview.html#mapkey\n - mapKey\n # Detects method expression call that can be replaced with a method call.\n # https://go-critic.com/overview.html#methodexprcall\n - methodExprCall\n # Finds where nesting level could be reduced.\n # https://go-critic.com/overview.html#nestingreduce\n - nestingReduce\n # Detects immediate dereferencing of `new` expressions.\n # https://go-critic.com/overview.html#newderef\n - newDeref\n # Detects return statements those results evaluate to nil.\n # https://go-critic.com/overview.html#nilvalreturn\n - nilValReturn\n # Detects old-style octal literals.\n # https://go-critic.com/overview.html#octalliteral\n - octalLiteral\n # Detects various off-by-one kind of errors.\n # https://go-critic.com/overview.html#offby1\n - offBy1\n # Detects if function parameters could be combined by type and suggest the way to do it.\n # https://go-critic.com/overview.html#paramtypecombine\n - paramTypeCombine\n # Detects expressions like []rune(s)[0] that may cause unwanted rune slice allocation.\n # https://go-critic.com/overview.html#preferdecoderune\n - preferDecodeRune\n # Detects concatenation with os.PathSeparator which can be replaced with filepath.Join.\n # https://go-critic.com/overview.html#preferfilepathjoin\n - preferFilepathJoin\n # Detects fmt.Sprint(f/ln) calls which can be replaced with fmt.Fprint(f/ln).\n # https://go-critic.com/overview.html#preferfprint\n - preferFprint\n # Detects w.Write or io.WriteString calls which can be replaced with w.WriteString.\n # https://go-critic.com/overview.html#preferstringwriter\n - preferStringWriter\n # Detects WriteRune calls with rune literal argument that is single byte and reports to use WriteByte instead.\n # https://go-critic.com/overview.html#preferwritebyte\n - preferWriteByte\n # Detects input and output parameters that have a type of pointer to referential type.\n # https://go-critic.com/overview.html#ptrtorefparam\n - ptrToRefParam\n # Detects append all its data while range it.\n # https://go-critic.com/overview.html#rangeappendall\n - rangeAppendAll\n # Detects expensive copies of `for` loop range expressions.\n # https://go-critic.com/overview.html#rangeexprcopy\n - rangeExprCopy\n # Detects loops that copy big objects during each iteration.\n # https://go-critic.com/overview.html#rangevalcopy\n - rangeValCopy\n # Detects redundant fmt.Sprint calls.\n # https://go-critic.com/overview.html#redundantsprint\n - redundantSprint\n # Detects `regexp.Compile*` that can be replaced with `regexp.MustCompile*`.\n # https://go-critic.com/overview.html#regexpmust\n - regexpMust\n # Detects suspicious regexp patterns.\n # https://go-critic.com/overview.html#regexppattern\n - regexpPattern\n # Detects regexp patterns that can be simplified.\n # https://go-critic.com/overview.html#regexpsimplify\n - regexpSimplify\n # Detects suspicious http.Error call without following return.\n # https://go-critic.com/overview.html#returnafterhttperror\n - returnAfterHttpError\n # Runs user-defined rules using ruleguard linter.\n # https://go-critic.com/overview.html#ruleguard\n - ruleguard\n # Detects switch statements that could be better written as if statement.\n # https://go-critic.com/overview.html#singlecaseswitch\n - singleCaseSwitch\n # Detects slice clear loops, suggests an idiom that is recognized by the Go compiler.\n # https://go-critic.com/overview.html#sliceclear\n - sliceClear\n # Detects usage of `len` when result is obvious or doesn't make sense.\n # https://go-critic.com/overview.html#sloppylen\n - sloppyLen\n # Detects suspicious/confusing re-assignments.\n # https://go-critic.com/overview.html#sloppyreassign\n - sloppyReassign\n # Detects redundant type assertions.\n # https://go-critic.com/overview.html#sloppytypeassert\n - sloppyTypeAssert\n # Detects suspicious sort.Slice calls.\n # https://go-critic.com/overview.html#sortslice\n - sortSlice\n # Detects \"%s\" formatting directives that can be replaced with %q.\n # https://go-critic.com/overview.html#sprintfquotedstring\n - sprintfQuotedString\n # Detects issue in Query() and Exec() calls.\n # https://go-critic.com/overview.html#sqlquery\n - sqlQuery\n # Detects string concat operations that can be simplified.\n # https://go-critic.com/overview.html#stringconcatsimplify\n - stringConcatSimplify\n # Detects redundant conversions between string and []byte.\n # https://go-critic.com/overview.html#stringxbytes\n - stringXbytes\n # Detects strings.Compare usage.\n # https://go-critic.com/overview.html#stringscompare\n - stringsCompare\n # Detects switch-over-bool statements that use explicit `true` tag value.\n # https://go-critic.com/overview.html#switchtrue\n - switchTrue\n # Detects sync.Map load+delete operations that can be replaced with LoadAndDelete.\n # https://go-critic.com/overview.html#syncmaploadanddelete\n - syncMapLoadAndDelete\n # Detects manual conversion to milli- or microseconds.\n # https://go-critic.com/overview.html#timeexprsimplify\n - timeExprSimplify\n # Detects TODO comments without detail/assignee.\n # https://go-critic.com/overview.html#todocommentwithoutdetail\n - todoCommentWithoutDetail\n # Detects function with too many results.\n # https://go-critic.com/overview.html#toomanyresultschecker\n - tooManyResultsChecker\n # Detects potential truncation issues when comparing ints of different sizes.\n # https://go-critic.com/overview.html#truncatecmp\n - truncateCmp\n # Detects repeated type assertions and suggests to replace them with type switch statement.\n # https://go-critic.com/overview.html#typeassertchain\n - typeAssertChain\n # Detects method declarations preceding the type definition itself.\n # https://go-critic.com/overview.html#typedeffirst\n - typeDefFirst\n # Detects type switches that can benefit from type guard clause with variable.\n # https://go-critic.com/overview.html#typeswitchvar\n - typeSwitchVar\n # Detects unneeded parenthesis inside type expressions and suggests to remove them.\n # https://go-critic.com/overview.html#typeunparen\n - typeUnparen\n # Detects unchecked errors in if statements.\n # https://go-critic.com/overview.html#uncheckedinlineerr\n - uncheckedInlineErr\n # Detects dereference expressions that can be omitted.\n # https://go-critic.com/overview.html#underef\n - underef\n # Detects redundant statement labels.\n # https://go-critic.com/overview.html#unlabelstmt\n - unlabelStmt\n # Detects function literals that can be simplified.\n # https://go-critic.com/overview.html#unlambda\n - unlambda\n # Detects unnamed results that may benefit from names.\n # https://go-critic.com/overview.html#unnamedresult\n - unnamedResult\n # Detects unnecessary braced statement blocks.\n # https://go-critic.com/overview.html#unnecessaryblock\n - unnecessaryBlock\n # Detects redundantly deferred calls.\n # https://go-critic.com/overview.html#unnecessarydefer\n - unnecessaryDefer\n # Detects slice expressions that can be simplified to sliced expression itself.\n # https://go-critic.com/overview.html#unslice\n - unslice\n # Detects value swapping code that are not using parallel assignment.\n # https://go-critic.com/overview.html#valswap\n - valSwap\n # Detects conditions that are unsafe due to not being exhaustive.\n # https://go-critic.com/overview.html#weakcond\n - weakCond\n # Ensures that `//nolint` comments include an explanation.\n # https://go-critic.com/overview.html#whynolint\n - whyNoLint\n # Detects function calls that can be replaced with convenience wrappers.\n # https://go-critic.com/overview.html#wrapperfunc\n - wrapperFunc\n # Detects Yoda style expressions and suggests to replace them.\n # https://go-critic.com/overview.html#yodastyleexpr\n - yodaStyleExpr\n # Enable all checks.\n # Default: false\n enable-all: true\n # Which checks should be disabled; can't be combined with 'enabled-checks'.\n # Default: []\n disabled-checks:\n - appendAssign\n - appendCombine\n - argOrder\n - assignOp\n - badCall\n - badCond\n - badLock\n - badRegexp\n - badSorting\n - badSyncOnceFunc\n - boolExprSimplify\n - builtinShadow\n - builtinShadowDecl\n - captLocal\n - caseOrder\n - codegenComment\n - commentFormatting\n - commentedOutCode\n - commentedOutImport\n - defaultCaseOrder\n - deferInLoop\n - deferUnlambda\n - deprecatedComment\n - docStub\n - dupArg\n - dupBranchBody\n - dupCase\n - dupImport\n - dupSubExpr\n - dynamicFmtString\n - elseif\n - emptyDecl\n - emptyFallthrough\n - emptyStringTest\n - equalFold\n - evalOrder\n - exitAfterDefer\n - exposedSyncMutex\n - externalErrorReassign\n - filepathJoin\n - flagDeref\n - flagName\n - hexLiteral\n - httpNoBody\n - hugeParam\n - ifElseChain\n - importShadow\n - indexAlloc\n - initClause\n - mapKey\n - methodExprCall\n - nestingReduce\n - newDeref\n - nilValReturn\n - octalLiteral\n - offBy1\n - paramTypeCombine\n - preferDecodeRune\n - preferFilepathJoin\n - preferFprint\n - preferStringWriter\n - preferWriteByte\n - ptrToRefParam\n - rangeAppendAll\n - rangeExprCopy\n - rangeValCopy\n - redundantSprint\n - regexpMust\n - regexpPattern\n - regexpSimplify\n - returnAfterHttpError\n - ruleguard\n - singleCaseSwitch\n - sliceClear\n - sloppyLen\n - sloppyReassign\n - sloppyTypeAssert\n - sortSlice\n - sprintfQuotedString\n - sqlQuery\n - stringConcatSimplify\n - stringXbytes\n - stringsCompare\n - switchTrue\n - syncMapLoadAndDelete\n - timeExprSimplify\n - todoCommentWithoutDetail\n - tooManyResultsChecker\n - truncateCmp\n - typeAssertChain\n - typeDefFirst\n - typeSwitchVar\n - typeUnparen\n - uncheckedInlineErr\n - underef\n - unlabelStmt\n - unlambda\n - unnamedResult\n - unnecessaryBlock\n - unnecessaryDefer\n - unslice\n - valSwap\n - weakCond\n - whyNoLint\n - wrapperFunc\n - yodaStyleExpr\n # Enable multiple checks by tags in addition to default checks.\n # Run `GL_DEBUG=gocritic golangci-lint run --enable=gocritic` to see all tags and checks.\n # See https://github.com/go-critic/go-critic#usage -\u003e section \"Tags\".\n # Default: []\n enabled-tags:\n - diagnostic\n - style\n - performance\n - experimental\n - opinionated\n disabled-tags:\n - diagnostic\n - style\n - performance\n - experimental\n - opinionated\n # Settings passed to gocritic.\n # The settings key is the name of a supported gocritic checker.\n # The list of supported checkers can be found at https://go-critic.com/overview.\n settings:\n # Must be valid enabled check name.\n captLocal:\n # Whether to restrict checker to params only.\n # Default: true\n paramsOnly: false\n commentedOutCode:\n # Min length of the comment that triggers a warning.\n # Default: 15\n minLength: 50\n elseif:\n # Whether to skip balanced if-else pairs.\n # Default: true\n skipBalanced: false\n hugeParam:\n # Size in bytes that makes the warning trigger.\n # Default: 80\n sizeThreshold: 70\n ifElseChain:\n # Min number of if-else blocks that makes the warning trigger.\n # Default: 2\n minThreshold: 4\n nestingReduce:\n # Min number of statements inside a branch to trigger a warning.\n # Default: 5\n bodyWidth: 4\n rangeExprCopy:\n # Size in bytes that makes the warning trigger.\n # Default: 512\n sizeThreshold: 516\n # Whether to check test functions\n # Default: true\n skipTestFuncs: false\n rangeValCopy:\n # Size in bytes that makes the warning trigger.\n # Default: 128\n sizeThreshold: 32\n # Whether to check test functions.\n # Default: true\n skipTestFuncs: false\n ruleguard:\n # Enable debug to identify which 'Where' condition was rejected.\n # The value of the parameter is the name of a function in a ruleguard file.\n #\n # When a rule is evaluated:\n # If:\n # The Match() clause is accepted; and\n # One of the conditions in the Where() clause is rejected,\n # Then:\n # ruleguard prints the specific Where() condition that was rejected.\n #\n # The option is passed to the ruleguard 'debug-group' argument.\n # Default: \"\"\n debug: 'emptyDecl'\n # Determines the behavior when an error occurs while parsing ruleguard files.\n # If flag is not set, log error and skip rule files that contain an error.\n # If flag is set, the value must be a comma-separated list of error conditions.\n # - 'all': fail on all errors.\n # - 'import': ruleguard rule imports a package that cannot be found.\n # - 'dsl': gorule file does not comply with the ruleguard DSL.\n # Default: \"\"\n failOn: dsl,import\n # Comma-separated list of file paths containing ruleguard rules.\n # By default, if a path is relative, it is relative to the directory where the golangci-lint command is executed.\n # The placeholder '${base-path}' is substituted with a path relative to the mode defined with `run.relative-path-mode`.\n # The placeholder '${config-path}' is substituted with a path relative to the configuration file.\n # Glob patterns such as 'rules-*.go' may be specified.\n # Default: \"\"\n rules: '${base-path}/ruleguard/rules-*.go,${base-path}/myrule1.go'\n # Comma-separated list of enabled groups or skip empty to enable everything.\n # Tags can be defined with # character prefix.\n # Default: \"\u003call\u003e\"\n enable: \"myGroupName,#myTagName\"\n # Comma-separated list of disabled groups or skip empty to enable everything.\n # Tags can be defined with # character prefix.\n # Default: \"\"\n disable: \"myGroupName,#myTagName\"\n tooManyResultsChecker:\n # Maximum number of results.\n # Default: 5\n maxResults: 10\n truncateCmp:\n # Whether to skip int/uint/uintptr types.\n # Default: true\n skipArchDependent: false\n underef:\n # Whether to skip (*x).method() calls where x is a pointer receiver.\n # Default: true\n skipRecvDeref: false\n unnamedResult:\n # Whether to check exported functions.\n # Default: false\n checkExported: true\n", + "gocyclo": "linters:\n settings:\n gocyclo:\n # Minimal code complexity to report.\n # Default: 30 (but we recommend 10-20)\n min-complexity: 10\n", + "godot": "linters:\n settings:\n godot:\n # Comments to be checked: `declarations`, `toplevel`, `noinline` or `all`.\n # Default: declarations\n scope: toplevel\n # List of regexps for excluding particular comment lines from check.\n # Default: []\n exclude:\n # Exclude todo and fixme comments.\n - \"^fixme:\"\n - \"^todo:\"\n # Check that each sentence ends with a period.\n # Default: true\n period: false\n # Check that each sentence starts with a capital letter.\n # Default: false\n capital: true\n", + "godox": "linters:\n settings:\n godox:\n # Report any comments starting with keywords, this is useful for TODO or FIXME comments that\n # might be left in the code accidentally and should be resolved before merging.\n # Default: [\"TODO\", \"BUG\", \"FIXME\"]\n keywords:\n - NOTE\n - OPTIMIZE # marks code that should be optimized before merging\n - HACK # marks hack-around that should be removed before merging\n", + "goheader": "linters:\n settings:\n goheader:\n # Supports two types 'const` and `regexp`.\n # Values can be used recursively.\n # Default: {}\n values:\n const:\n # Define here const type values in format k:v.\n # For example:\n COMPANY: MY COMPANY\n regexp:\n # Define here regexp type values.\n # for example:\n AUTHOR: .*@mycompany\\.com\n # The template used for checking.\n # Put here copyright header template for source code files.\n # Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time.\n # Default: \"\"\n template: |-\n {{ AUTHOR }} {{ COMPANY }} {{ YEAR }}\n SPDX-License-Identifier: Apache-2.0\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at:\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n # As alternative of directive 'template', you may put the path to file with the template source.\n # Useful if you need to load the template from a specific file.\n # By default, if a path is relative, it is relative to the directory where the golangci-lint command is executed.\n # The placeholder '${base-path}' is substituted with a path relative to the mode defined with `run.relative-path-mode`.\n # The placeholder '${config-path}' is substituted with a path relative to the configuration file.\n # Default: \"\"\n template-path: /path/to/my/template.tmpl\n", + "gomoddirectives": "linters:\n settings:\n gomoddirectives:\n # Allow local `replace` directives.\n # Default: false\n replace-local: true\n # List of allowed `replace` directives.\n # Default: []\n replace-allow-list:\n - launchpad.net/gocheck\n # Allow to not explain why the version has been retracted in the `retract` directives.\n # Default: false\n retract-allow-no-explanation: true\n # Forbid the use of the `exclude` directives.\n # Default: false\n exclude-forbidden: true\n # Forbid the use of the `ignore` directives (\u003e= go1.25).\n # Default: false\n ignore-forbidden: true\n # Forbid the use of the `toolchain` directive.\n # Default: false\n toolchain-forbidden: true\n # Defines a pattern to validate `toolchain` directive.\n # Default: '' (no match)\n toolchain-pattern: 'go1\\.23\\.\\d+$'\n # Forbid the use of the `tool` directives.\n # Default: false\n tool-forbidden: true\n # Forbid the use of the `godebug` directive.\n # Default: false\n go-debug-forbidden: true\n # Defines a pattern to validate `go` minimum version directive.\n # Default: '' (no match)\n go-version-pattern: '\\d\\.\\d+(\\.0)?'\n", + "gomodguard": "linters:\n settings:\n gomodguard:\n allowed:\n # List of allowed modules.\n # Default: []\n modules:\n - gopkg.in/yaml.v2\n # List of allowed module domains.\n # Default: []\n domains:\n - golang.org\n blocked:\n # List of blocked modules.\n # Default: []\n modules:\n # Blocked module.\n - github.com/uudashr/go-module:\n # Recommended modules that should be used instead. (Optional)\n recommendations:\n - golang.org/x/mod\n # Reason why the recommended module should be used. (Optional)\n reason: \"`mod` is the official go.mod parser library.\"\n # List of blocked module version constraints.\n # Default: []\n versions:\n # Blocked module with version constraint.\n - github.com/mitchellh/go-homedir:\n # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons.\n version: \"\u003c 1.1.0\"\n # Reason why the version constraint exists. (Optional)\n reason: \"testing if blocked version constraint works.\"\n # Set to true to raise lint issues for packages that are loaded from a local path via replace directive.\n # Default: false\n local-replace-directives: false\n", + "gosec": "linters:\n settings:\n gosec:\n # To select a subset of rules to run.\n # Available rules: https://github.com/securego/gosec#available-rules\n # Default: [] - means include all rules\n includes:\n - G101 # Look for hard coded credentials\n - G102 # Bind to all interfaces\n - G103 # Audit the use of unsafe block\n - G104 # Audit errors not checked\n - G106 # Audit the use of ssh.InsecureIgnoreHostKey\n - G107 # Url provided to HTTP request as taint input\n - G108 # Profiling endpoint automatically exposed on /debug/pprof\n - G109 # Potential Integer overflow made by strconv.Atoi result conversion to int16/32\n - G110 # Potential DoS vulnerability via decompression bomb\n - G111 # Potential directory traversal\n - G112 # Potential slowloris attack\n - G114 # Use of net/http serve function that has no support for setting timeouts\n - G115 # Potential integer overflow when converting between integer types\n - G201 # SQL query construction using format string\n - G202 # SQL query construction using string concatenation\n - G203 # Use of unescaped data in HTML templates\n - G204 # Audit use of command execution\n - G301 # Poor file permissions used when creating a directory\n - G302 # Poor file permissions used with chmod\n - G303 # Creating tempfile using a predictable path\n - G304 # File path provided as taint input\n - G305 # File traversal when extracting zip/tar archive\n - G306 # Poor file permissions used when writing to a new file\n - G307 # Poor file permissions used when creating a file with os.Create\n - G401 # Detect the usage of MD5 or SHA1\n - G402 # Look for bad TLS connection settings\n - G403 # Ensure minimum RSA key length of 2048 bits\n - G404 # Insecure random number source (rand)\n - G405 # Detect the usage of DES or RC4\n - G406 # Detect the usage of MD4 or RIPEMD160\n - G501 # Import blocklist: crypto/md5\n - G502 # Import blocklist: crypto/des\n - G503 # Import blocklist: crypto/rc4\n - G504 # Import blocklist: net/http/cgi\n - G505 # Import blocklist: crypto/sha1\n - G506 # Import blocklist: golang.org/x/crypto/md4\n - G507 # Import blocklist: golang.org/x/crypto/ripemd160\n - G601 # Implicit memory aliasing of items from a range statement\n - G602 # Slice access out of bounds\n # To specify a set of rules to explicitly exclude.\n # Available rules: https://github.com/securego/gosec#available-rules\n # Default: []\n excludes:\n - G101 # Look for hard coded credentials\n - G102 # Bind to all interfaces\n - G103 # Audit the use of unsafe block\n - G104 # Audit errors not checked\n - G106 # Audit the use of ssh.InsecureIgnoreHostKey\n - G107 # Url provided to HTTP request as taint input\n - G108 # Profiling endpoint automatically exposed on /debug/pprof\n - G109 # Potential Integer overflow made by strconv.Atoi result conversion to int16/32\n - G110 # Potential DoS vulnerability via decompression bomb\n - G111 # Potential directory traversal\n - G112 # Potential slowloris attack\n - G114 # Use of net/http serve function that has no support for setting timeouts\n - G115 # Potential integer overflow when converting between integer types\n - G201 # SQL query construction using format string\n - G202 # SQL query construction using string concatenation\n - G203 # Use of unescaped data in HTML templates\n - G204 # Audit use of command execution\n - G301 # Poor file permissions used when creating a directory\n - G302 # Poor file permissions used with chmod\n - G303 # Creating tempfile using a predictable path\n - G304 # File path provided as taint input\n - G305 # File traversal when extracting zip/tar archive\n - G306 # Poor file permissions used when writing to a new file\n - G307 # Poor file permissions used when creating a file with os.Create\n - G401 # Detect the usage of MD5 or SHA1\n - G402 # Look for bad TLS connection settings\n - G403 # Ensure minimum RSA key length of 2048 bits\n - G404 # Insecure random number source (rand)\n - G405 # Detect the usage of DES or RC4\n - G406 # Detect the usage of MD4 or RIPEMD160\n - G501 # Import blocklist: crypto/md5\n - G502 # Import blocklist: crypto/des\n - G503 # Import blocklist: crypto/rc4\n - G504 # Import blocklist: net/http/cgi\n - G505 # Import blocklist: crypto/sha1\n - G506 # Import blocklist: golang.org/x/crypto/md4\n - G507 # Import blocklist: golang.org/x/crypto/ripemd160\n - G601 # Implicit memory aliasing of items from a range statement\n - G602 # Slice access out of bounds\n # Filter out the issues with a lower severity than the given value.\n # Valid options are: low, medium, high.\n # Default: low\n severity: medium\n # Filter out the issues with a lower confidence than the given value.\n # Valid options are: low, medium, high.\n # Default: low\n confidence: medium\n # Concurrency value.\n # Default: the number of logical CPUs usable by the current process.\n concurrency: 12\n # To specify the configuration of rules.\n config:\n # Globals are applicable to all rules.\n global:\n # If true, ignore #nosec in comments (and an alternative as well).\n # Default: false\n nosec: true\n # Add an alternative comment prefix to #nosec (both will work at the same time).\n # Default: \"\"\n \"#nosec\": \"#my-custom-nosec\"\n # Define whether nosec issues are counted as finding or not.\n # Default: false\n show-ignored: true\n # Audit mode enables addition checks that for normal code analysis might be too nosy.\n # Default: false\n audit: true\n G101:\n # Regexp pattern for variables and constants to find.\n # Default: \"(?i)passwd|pass|password|pwd|secret|token|pw|apiKey|bearer|cred\"\n pattern: \"(?i)example\"\n # If true, complain about all cases (even with low entropy).\n # Default: false\n ignore_entropy: false\n # Maximum allowed entropy of the string.\n # Default: \"80.0\"\n entropy_threshold: \"80.0\"\n # Maximum allowed value of entropy/string length.\n # Is taken into account if entropy \u003e= entropy_threshold/2.\n # Default: \"3.0\"\n per_char_threshold: \"3.0\"\n # Calculate entropy for first N chars of the string.\n # Default: \"16\"\n truncate: \"32\"\n # Additional functions to ignore while checking unhandled errors.\n # Following functions always ignored:\n # bytes.Buffer:\n # - Write\n # - WriteByte\n # - WriteRune\n # - WriteString\n # fmt:\n # - Print\n # - Printf\n # - Println\n # - Fprint\n # - Fprintf\n # - Fprintln\n # strings.Builder:\n # - Write\n # - WriteByte\n # - WriteRune\n # - WriteString\n # io.PipeWriter:\n # - CloseWithError\n # hash.Hash:\n # - Write\n # os:\n # - Unsetenv\n # Default: {}\n G104:\n fmt:\n - Fscanf\n G111:\n # Regexp pattern to find potential directory traversal.\n # Default: \"http\\\\.Dir\\\\(\\\"\\\\/\\\"\\\\)|http\\\\.Dir\\\\('\\\\/'\\\\)\"\n pattern: \"custom\\\\.Dir\\\\(\\\\)\"\n # Maximum allowed permissions mode for os.Mkdir and os.MkdirAll.\n # Default: \"0750\"\n G301: \"0750\"\n # Maximum allowed permissions mode for os.OpenFile and os.Chmod.\n # Default: \"0600\"\n G302: \"0600\"\n # Maximum allowed permissions mode for os.WriteFile and ioutil.WriteFile.\n # Default: \"0600\"\n G306: \"0600\"\n", + "gosmopolitan": "linters:\n settings:\n gosmopolitan:\n # Allow and ignore `time.Local` usages.\n #\n # Default: false\n allow-time-local: true\n # List of fully qualified names in the `full/pkg/path.name` form, to act as \"i18n escape hatches\".\n # String literals inside call-like expressions to, or struct literals of those names,\n # are exempt from the writing system check.\n #\n # Default: []\n escape-hatches:\n - 'github.com/nicksnyder/go-i18n/v2/i18n.Message'\n - 'example.com/your/project/i18n/markers.Raw'\n - 'example.com/your/project/i18n/markers.OK'\n - 'example.com/your/project/i18n/markers.TODO'\n - 'command-line-arguments.Simple'\n # List of Unicode scripts to watch for any usage in string literals.\n # https://pkg.go.dev/unicode#pkg-variables\n #\n # Default: [\"Han\"]\n watch-for-scripts:\n - Devanagari\n - Han\n - Hangul\n - Hiragana\n - Katakana\n", + "govet": "linters:\n settings:\n govet:\n # Disable all analyzers.\n # Default: false\n disable-all: true\n # Enable analyzers by name.\n # (In addition to default:\n # appends, asmdecl, assign, atomic, bools, buildtag, cgocall, composites, copylocks, defers, directive, errorsas,\n # framepointer, httpresponse, ifaceassert, loopclosure, lostcancel, nilfunc, printf, shift, sigchanyzer, slog,\n # stdmethods, stringintconv, structtag, testinggoroutine, tests, timeformat, unmarshal, unreachable, unsafeptr,\n # unusedresult\n # ).\n # Run `GL_DEBUG=govet golangci-lint run --enable=govet` to see default, all available analyzers, and enabled analyzers.\n # Default: []\n enable:\n # Check for missing values after append.\n - appends\n # Report mismatches between assembly files and Go declarations.\n - asmdecl\n # Check for useless assignments.\n - assign\n # Check for common mistakes using the sync/atomic package.\n - atomic\n # Check for non-64-bits-aligned arguments to sync/atomic functions.\n - atomicalign\n # Check for common mistakes involving boolean operators.\n - bools\n # Check //go:build and // +build directives.\n - buildtag\n # Detect some violations of the cgo pointer passing rules.\n - cgocall\n # Check for unkeyed composite literals.\n - composites\n # Check for locks erroneously passed by value.\n - copylocks\n # Check for calls of reflect.DeepEqual on error values.\n - deepequalerrors\n # Report common mistakes in defer statements.\n - defers\n # Check Go toolchain directives such as //go:debug.\n - directive\n # Report passing non-pointer or non-error values to errors.As.\n - errorsas\n # Find structs that would use less memory if their fields were sorted.\n - fieldalignment\n # Find calls to a particular function.\n - findcall\n # Report assembly that clobbers the frame pointer before saving it.\n - framepointer\n # Check format of addresses passed to net.Dial.\n - hostport\n # Report using Go 1.22 enhanced ServeMux patterns in older Go versions.\n - httpmux\n # Check for mistakes using HTTP responses.\n - httpresponse\n # Detect impossible interface-to-interface type assertions.\n - ifaceassert\n # Check references to loop variables from within nested functions.\n - loopclosure\n # Check cancel func returned by context.WithCancel is called.\n - lostcancel\n # Check for useless comparisons between functions and nil.\n - nilfunc\n # Check for redundant or impossible nil comparisons.\n - nilness\n # Check consistency of Printf format strings and arguments.\n - printf\n # Check for comparing reflect.Value values with == or reflect.DeepEqual.\n - reflectvaluecompare\n # Check for possible unintended shadowing of variables.\n - shadow\n # Check for shifts that equal or exceed the width of the integer.\n - shift\n # Check for unbuffered channel of os.Signal.\n - sigchanyzer\n # Check for invalid structured logging calls.\n - slog\n # Check the argument type of sort.Slice.\n - sortslice\n # Check signature of methods of well-known interfaces.\n - stdmethods\n # Report uses of too-new standard library symbols.\n - stdversion\n # Check for string(int) conversions.\n - stringintconv\n # Check that struct field tags conform to reflect.StructTag.Get.\n - structtag\n # Report calls to (*testing.T).Fatal from goroutines started by a test.\n - testinggoroutine\n # Check for common mistaken usages of tests and examples.\n - tests\n # Check for calls of (time.Time).Format or time.Parse with 2006-02-01.\n - timeformat\n # Report passing non-pointer or non-interface values to unmarshal.\n - unmarshal\n # Check for unreachable code.\n - unreachable\n # Check for invalid conversions of uintptr to unsafe.Pointer.\n - unsafeptr\n # Check for unused results of calls to some functions.\n - unusedresult\n # Checks for unused writes.\n - unusedwrite\n # Check for misuses of sync.WaitGroup.\n - waitgroup\n # Enable all analyzers.\n # Default: false\n enable-all: true\n # Disable analyzers by name.\n # (In addition to default\n # atomicalign, deepequalerrors, fieldalignment, findcall, nilness, reflectvaluecompare, shadow, sortslice,\n # timeformat, unusedwrite\n # ).\n # Run `GL_DEBUG=govet golangci-lint run --enable=govet` to see default, all available analyzers, and enabled analyzers.\n # Default: []\n disable:\n - appends\n - asmdecl\n - assign\n - atomic\n - atomicalign\n - bools\n - buildtag\n - cgocall\n - composites\n - copylocks\n - deepequalerrors\n - defers\n - directive\n - errorsas\n - fieldalignment\n - findcall\n - framepointer\n - hostport\n - httpmux\n - httpresponse\n - ifaceassert\n - loopclosure\n - lostcancel\n - nilfunc\n - nilness\n - printf\n - reflectvaluecompare\n - shadow\n - shift\n - sigchanyzer\n - slog\n - sortslice\n - stdmethods\n - stdversion\n - stringintconv\n - structtag\n - testinggoroutine\n - tests\n - timeformat\n - unmarshal\n - unreachable\n - unsafeptr\n - unusedresult\n - unusedwrite\n - waitgroup\n # Settings per analyzer.\n settings:\n # Analyzer name, run `go tool vet help` to see all analyzers.\n printf:\n # Comma-separated list of print function names to check (in addition to default, see `go tool vet help printf`).\n # Default: []\n funcs:\n - (github.com/golangci/golangci-lint/v2/pkg/logutils.Log).Infof\n - (github.com/golangci/golangci-lint/v2/pkg/logutils.Log).Warnf\n - (github.com/golangci/golangci-lint/v2/pkg/logutils.Log).Errorf\n - (github.com/golangci/golangci-lint/v2/pkg/logutils.Log).Fatalf\n shadow:\n # Whether to be strict about shadowing; can be noisy.\n # Default: false\n strict: true\n unusedresult:\n # Comma-separated list of functions whose results must be used.\n # (In addition to default:\n # context.WithCancel, context.WithDeadline, context.WithTimeout, context.WithValue, errors.New, fmt.Errorf,\n # fmt.Sprint, fmt.Sprintf, sort.Reverse\n # ).\n # Default: []\n funcs:\n - pkg.MyFunc\n # Comma-separated list of names of methods of type func() string whose results must be used.\n # (In addition to default Error,String).\n # Default: []\n stringmethods:\n - MyMethod\n", + "grouper": "linters:\n settings:\n grouper:\n # Require the use of a single global 'const' declaration only.\n # Default: false\n const-require-single-const: true\n # Require the use of grouped global 'const' declarations.\n # Default: false\n const-require-grouping: true\n # Require the use of a single 'import' declaration only.\n # Default: false\n import-require-single-import: true\n # Require the use of grouped 'import' declarations.\n # Default: false\n import-require-grouping: true\n # Require the use of a single global 'type' declaration only.\n # Default: false\n type-require-single-type: true\n # Require the use of grouped global 'type' declarations.\n # Default: false\n type-require-grouping: true\n # Require the use of a single global 'var' declaration only.\n # Default: false\n var-require-single-var: true\n # Require the use of grouped global 'var' declarations.\n # Default: false\n var-require-grouping: true\n", + "iface": "linters:\n settings:\n iface:\n # List of analyzers.\n # Default: [\"identical\"]\n enable:\n - identical # Identifies interfaces in the same package that have identical method sets.\n - unused # Identifies interfaces that are not used anywhere in the same package where the interface is defined.\n - opaque # Identifies functions that return interfaces, but the actual returned value is always a single concrete implementation.\n - unexported # Identifies interfaces that are not exported but are used in exported functions or methods.\n settings:\n unused:\n # List of packages path to exclude from the check.\n # Default: []\n exclude:\n - github.com/example/log\n", + "importas": "linters:\n settings:\n importas:\n # Do not allow unaliased imports of aliased packages.\n # Default: false\n no-unaliased: true\n # Do not allow non-required aliases.\n # Default: false\n no-extra-aliases: true\n # List of aliases\n # Default: []\n alias:\n # Using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package.\n - pkg: knative.dev/serving/pkg/apis/serving/v1\n alias: servingv1\n # Using `autoscalingv1alpha1` alias for `knative.dev/serving/pkg/apis/autoscaling/v1alpha1` package.\n - pkg: knative.dev/serving/pkg/apis/autoscaling/v1alpha1\n alias: autoscalingv1alpha1\n # You can specify the package path by regular expression,\n # and alias by regular expression expansion syntax like below.\n # See https://github.com/julz/importas#use-regular-expression for details.\n - pkg: knative.dev/serving/pkg/apis/(\\w+)/(v[\\w\\d]+)\n alias: $1$2\n # An explicit empty alias can be used to ensure no aliases are used for a package.\n # This can be useful if `no-extra-aliases: true` doesn't fit your need.\n # Multiple packages can use an empty alias.\n - pkg: errors\n alias: \"\"\n", + "inamedparam": "linters:\n settings:\n inamedparam:\n # Skips check for interface methods with only a single parameter.\n # Default: false\n skip-single-param: true\n", + "interfacebloat": "linters:\n settings:\n interfacebloat:\n # The maximum number of methods allowed for an interface.\n # Default: 10\n max: 5\n", + "ireturn": "linters:\n settings:\n ireturn:\n # List of interfaces to allow.\n # Lists of the keywords and regular expressions matched to interface or package names can be used.\n # `allow` and `reject` settings cannot be used at the same time.\n #\n # Keywords:\n # - `empty` for `interface{}`\n # - `error` for errors\n # - `stdlib` for standard library\n # - `anon` for anonymous interfaces\n # - `generic` for generic interfaces added in go 1.18\n #\n # Default: [anon, error, empty, stdlib]\n allow:\n - anon\n # You can specify idiomatic endings for interface\n - (or|er)$\n # List of interfaces to reject.\n # Lists of the keywords and regular expressions matched to interface or package names can be used.\n # `allow` and `reject` settings cannot be used at the same time.\n #\n # Keywords:\n # - `empty` for `interface{}`\n # - `error` for errors\n # - `stdlib` for standard library\n # - `anon` for anonymous interfaces\n # - `generic` for generic interfaces added in go 1.18\n #\n # Default: []\n reject:\n - github.com\\/user\\/package\\/v4\\.Type\n", + "lll": "linters:\n settings:\n lll:\n # Max line length, lines longer will be reported.\n # '\\t' is counted as 1 character by default, and can be changed with the tab-width option.\n # Default: 120.\n line-length: 120\n # Tab width in spaces.\n # Default: 1\n tab-width: 1\n", + "loggercheck": "linters:\n settings:\n loggercheck:\n # Allow check for the github.com/go-kit/log library.\n # Default: true\n kitlog: false\n # Allow check for the k8s.io/klog/v2 library.\n # Default: true\n klog: false\n # Allow check for the github.com/go-logr/logr library.\n # Default: true\n logr: false\n # Allow check for the log/slog library.\n # Default: true\n slog: false\n # Allow check for the \"sugar logger\" from go.uber.org/zap library.\n # Default: true\n zap: false\n # Require all logging keys to be inlined constant strings.\n # Default: false\n require-string-key: true\n # Require printf-like format specifier (%s, %d for example) not present.\n # Default: false\n no-printf-like: true\n # List of custom rules to check against, where each rule is a single logger pattern, useful for wrapped loggers.\n # For example: https://github.com/timonwong/loggercheck/blob/7395ab86595781e33f7afba27ad7b55e6956ebcd/testdata/custom-rules.txt\n # Default: empty\n rules:\n - k8s.io/klog/v2.InfoS # package level exported functions\n - (github.com/go-logr/logr.Logger).Error # \"Methods\"\n - (*go.uber.org/zap.SugaredLogger).With # Also \"Methods\", but with a pointer receiver\n", + "maintidx": "linters:\n settings:\n maintidx:\n # Show functions with maintainability index lower than N.\n # A high index indicates better maintainability (it's kind of the opposite of complexity).\n # Default: 20\n under: 100\n", + "makezero": "linters:\n settings:\n makezero:\n # Allow only slices initialized with a length of zero.\n # Default: false\n always: true\n", + "misspell": "linters:\n settings:\n misspell:\n # Correct spellings using locale preferences for US or UK.\n # Setting locale to US will correct the British spelling of 'colour' to 'color'.\n # Default is to use a neutral variety of English.\n locale: US\n # Typos to ignore.\n # Should be in lower case.\n # Default: []\n ignore-rules:\n - someword\n # Extra word corrections.\n # `typo` and `correction` should only contain letters.\n # The words are case-insensitive.\n # Default: []\n extra-words:\n - typo: \"iff\"\n correction: \"if\"\n - typo: \"cancelation\"\n correction: \"cancellation\"\n # Mode of the analysis:\n # - default: checks all the file content.\n # - restricted: checks only comments.\n # Default: \"\"\n mode: restricted\n", + "mnd": "linters:\n settings:\n mnd:\n # List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.\n # Default: [\"argument\", \"case\", \"condition\", \"operation\", \"return\", \"assign\"]\n checks:\n - argument\n - case\n - condition\n - operation\n - return\n - assign\n # List of numbers to exclude from analysis.\n # The numbers should be written as string.\n # Values always ignored: \"1\", \"1.0\", \"0\" and \"0.0\".\n # Default: []\n ignored-numbers:\n - '0666'\n - '0755'\n - '42'\n # List of file patterns to exclude from analysis.\n # Values always ignored: `.+_test.go`.\n # Default: []\n ignored-files:\n - 'magic1_.+\\.go$'\n # List of function patterns to exclude from analysis.\n # Following functions are always ignored: `time.Date`,\n # `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`,\n # `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`.\n # Default: []\n ignored-functions:\n - '^math\\.'\n - '^http\\.StatusText$'\n", + "musttag": "linters:\n settings:\n musttag:\n # A set of custom functions to check in addition to the builtin ones.\n # Default: json, xml, gopkg.in/yaml.v3, BurntSushi/toml, mitchellh/mapstructure, jmoiron/sqlx\n functions:\n # The full name of the function, including the package.\n - name: github.com/hashicorp/hcl/v2/hclsimple.DecodeFile\n # The struct tag whose presence should be ensured.\n tag: hcl\n # The position of the argument to check.\n arg-pos: 2\n", + "nakedret": "linters:\n settings:\n nakedret:\n # Make an issue if func has more lines of code than this setting, and it has naked returns.\n # Default: 30\n max-func-lines: 31\n", + "nestif": "linters:\n settings:\n nestif:\n # Minimal complexity of if statements to report.\n # Default: 5\n min-complexity: 4\n", + "nilnil": "linters:\n settings:\n nilnil:\n # To check functions with only two return values (`return nil, nil`).\n # If disabled then returns like `return nil, nil, ..., nil` are supported.\n # Default: true\n only-two: false\n # In addition, detect opposite situation (simultaneous return of non-nil error and valid value).\n # E.g, `return clone, fh.indexer.Update(clone)` will be considered as invalid.\n # Default: false\n detect-opposite: true\n # List of return types to check.\n # Default: [\"chan\", \"func\", \"iface\", \"map\", \"ptr\", \"uintptr\", \"unsafeptr\"]\n checked-types:\n - chan\n - func\n - iface\n - map\n - ptr\n - uintptr\n - unsafeptr\n", + "nlreturn": "linters:\n settings:\n nlreturn:\n # Size of the block (including return statement that is still \"OK\"),\n # so no return split required.\n # Default: 1\n block-size: 2\n", + "nolintlint": "linters:\n settings:\n nolintlint:\n # Disable to ensure that all nolint directives actually have an effect.\n # Default: false\n allow-unused: true\n # Exclude following linters from requiring an explanation.\n # Default: []\n allow-no-explanation: []\n # Enable to require an explanation of nonzero length after each nolint directive.\n # Default: false\n require-explanation: true\n # Enable to require nolint directives to mention the specific linter being suppressed.\n # Default: false\n require-specific: true\n", + "nonamedreturns": "linters:\n settings:\n nonamedreturns:\n # Report named error if it is assigned inside defer.\n # Default: false\n report-error-in-defer: true\n", + "paralleltest": "linters:\n settings:\n paralleltest:\n # Ignore missing calls to `t.Parallel()` and only report incorrect uses of it.\n # Default: false\n ignore-missing: true\n # Ignore missing calls to `t.Parallel()` in subtests. Top-level tests are\n # still required to have `t.Parallel`, but subtests are allowed to skip it.\n # Default: false\n ignore-missing-subtests: true\n", + "perfsprint": "linters:\n settings:\n perfsprint:\n # Enable/disable optimization of integer formatting.\n # Default: true\n integer-format: false\n # Optimizes even if it requires an int or uint type cast.\n # Default: true\n int-conversion: false\n # Enable/disable optimization of error formatting.\n # Default: true\n error-format: false\n # Optimizes into `err.Error()` even if it is only equivalent for non-nil errors.\n # Default: false\n err-error: true\n # Optimizes `fmt.Errorf`.\n # Default: true\n errorf: false\n # Enable/disable optimization of string formatting.\n # Default: true\n string-format: false\n # Optimizes `fmt.Sprintf` with only one argument.\n # Default: true\n sprintf1: false\n # Optimizes into strings concatenation.\n # Default: true\n strconcat: false\n # Enable/disable optimization of bool formatting.\n # Default: true\n bool-format: false\n # Enable/disable optimization of hex formatting.\n # Default: true\n hex-format: false\n", + "prealloc": "linters:\n settings:\n prealloc:\n # IMPORTANT: we don't recommend using this linter before doing performance profiling.\n # For most programs usage of prealloc will be a premature optimization.\n\n # Report pre-allocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.\n # Default: true\n simple: false\n # Report pre-allocation suggestions on range loops.\n # Default: true\n range-loops: false\n # Report pre-allocation suggestions on for loops.\n # Default: false\n for-loops: true\n", + "predeclared": "linters:\n settings:\n predeclared:\n # List of predeclared identifiers to not report on.\n # Default: []\n ignore:\n - new\n - int\n # Include method names and field names in checks.\n # Default: false\n qualified-name: true\n", + "promlinter": "linters:\n settings:\n promlinter:\n # Promlinter cannot infer all metrics name in static analysis.\n # Enable strict mode will also include the errors caused by failing to parse the args.\n # Default: false\n strict: true\n # Please refer to https://github.com/yeya24/promlinter#usage for detailed usage.\n # Default: []\n disabled-linters:\n # Help detects issues related to the help text for a metric.\n - Help\n # MetricUnits detects issues with metric unit names.\n - MetricUnits\n # Counter detects issues specific to counters, as well as patterns that should only be used with counters.\n - Counter\n # HistogramSummaryReserved detects when other types of metrics use names or labels reserved for use by histograms and/or summaries.\n - HistogramSummaryReserved\n # MetricTypeInName detects when metric types are included in the metric name.\n - MetricTypeInName\n # ReservedChars detects colons in metric names.\n - ReservedChars\n # CamelCase detects metric names and label names written in camelCase.\n - CamelCase\n # UnitAbbreviations detects abbreviated units in the metric name.\n - UnitAbbreviations\n", + "protogetter": "linters:\n settings:\n protogetter:\n # Skip files generated by specified generators from the checking.\n # Checks only the file's initial comment, which must follow the format: \"// Code generated by \u003cgenerator-name\u003e\".\n # Files generated by protoc-gen-go, protoc-gen-go-grpc, and protoc-gen-grpc-gateway are always excluded automatically.\n # Default: []\n skip-generated-by: [\"protoc-gen-go-my-own-generator\"]\n # Skip files matching the specified glob pattern from the checking.\n # Default: []\n skip-files:\n - \"*.pb.go\"\n - \"*/vendor/*\"\n - \"/full/path/to/file.go\"\n # Skip any generated files from the checking.\n # Default: false\n skip-any-generated: true\n # Skip first argument of append function.\n # Default: false\n replace-first-arg-in-append: true\n", + "reassign": "linters:\n settings:\n reassign:\n # Patterns for global variable names that are checked for reassignment.\n # See https://github.com/curioswitch/go-reassign#usage\n # Default: [\"EOF\", \"Err.*\"]\n patterns:\n - \".*\"\n", + "recvcheck": "linters:\n settings:\n recvcheck:\n # Disables the built-in method exclusions:\n # - `MarshalText`\n # - `MarshalJSON`\n # - `MarshalYAML`\n # - `MarshalXML`\n # - `MarshalBinary`\n # - `GobEncode`\n # Default: false\n disable-builtin: true\n # User-defined method exclusions.\n # The format is `struct_name.method_name` (ex: `Foo.MethodName`).\n # A wildcard `*` can use as a struct name (ex: `*.MethodName`).\n # Default: []\n exclusions:\n - \"*.Value\"\n", + "revive": "linters:\n settings:\n revive:\n # Maximum number of open files at the same time.\n # See https://github.com/mgechev/revive#command-line-flags\n # Defaults to unlimited.\n max-open-files: 2048\n # Sets the default severity.\n # See https://github.com/mgechev/revive#configuration\n # Default: warning\n severity: error\n # Enable all available rules.\n # Default: false\n enable-all-rules: true\n # Enable validation of comment directives.\n # See https://github.com/mgechev/revive#comment-directives\n directives:\n - name: specify-disable-reason\n severity: error\n # Sets the default failure confidence.\n # This means that linting errors with less than 0.8 confidence will be ignored.\n # Default: 0.8\n confidence: 0.1\n # Run `GL_DEBUG=revive golangci-lint run --enable-only=revive` to see default, all available rules, and enabled rules.\n rules:\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#add-constant\n - name: add-constant\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - max-lit-count: \"3\"\n allow-strs: '\"\"'\n allow-ints: \"0,1,2\"\n allow-floats: \"0.0,0.,1.0,1.,2.0,2.\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#argument-limit\n - name: argument-limit\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments: [4]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#atomic\n - name: atomic\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#banned-characters\n - name: banned-characters\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments: [\"Ω\", \"Σ\", \"σ\", \"7\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#bare-return\n - name: bare-return\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#blank-imports\n - name: blank-imports\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#bool-literal-in-expr\n - name: bool-literal-in-expr\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#call-to-gc\n - name: call-to-gc\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#cognitive-complexity\n - name: cognitive-complexity\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments: [7]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#comment-spacings\n - name: comment-spacings\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - mypragma\n - otherpragma\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#comments-density\n - name: comments-density\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments: [15]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#confusing-naming\n - name: confusing-naming\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#confusing-results\n - name: confusing-results\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#constant-logical-expr\n - name: constant-logical-expr\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#context-as-argument\n - name: context-as-argument\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - allow-types-before: \"*testing.T,*github.com/user/repo/testing.Harness\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#context-keys-type\n - name: context-keys-type\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#cyclomatic\n - name: cyclomatic\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments: [3]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#datarace\n - name: datarace\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#deep-exit\n - name: deep-exit\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#defer\n - name: defer\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - \"call-chain\"\n - \"loop\"\n - \"method-call\"\n - \"recover\"\n - \"immediate-recover\"\n - \"return\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#dot-imports\n - name: dot-imports\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - allowed-packages: [\"github.com/onsi/ginkgo/v2\", \"github.com/onsi/gomega\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#duplicated-imports\n - name: duplicated-imports\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#early-return\n - name: early-return\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - \"preserve-scope\"\n - \"allow-jump\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#empty-block\n - name: empty-block\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#empty-lines\n - name: empty-lines\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#enforce-map-style\n - name: enforce-map-style\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - \"make\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#enforce-repeated-arg-type-style\n - name: enforce-repeated-arg-type-style\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - \"short\"\n # Or this parameter:\n - func-arg-style: \"full\"\n func-ret-val-style: \"short\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#enforce-slice-style\n - name: enforce-slice-style\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - \"make\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#enforce-switch-style\n - name: enforce-switch-style\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments: [\"allowNoDefault\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#error-naming\n - name: error-naming\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#error-return\n - name: error-return\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#error-strings\n - name: error-strings\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - \"xerrors.New\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#errorf\n - name: errorf\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#exported\n - name: exported\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - \"check-private-receivers\"\n - \"disable-stuttering-check\"\n - \"say-repetitive-instead-of-stutters\"\n - \"check-public-interface\"\n - \"disable-checks-on-constants\"\n - \"disable-checks-on-functions\"\n - \"disable-checks-on-methods\"\n - \"disable-checks-on-types\"\n - \"disable-checks-on-variables\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#file-header\n - name: file-header\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - This is the text that must appear at the top of source files.\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#file-length-limit\n - name: file-length-limit\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - max: 100\n skip-comments: true\n skip-blank-lines: true\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#filename-format\n - name: filename-format\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - \"^[_a-z][_a-z0-9]*\\\\.go$\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#flag-parameter\n - name: flag-parameter\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#function-length\n - name: function-length\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments: [10, 0]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#function-result-limit\n - name: function-result-limit\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments: [3]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#get-return\n - name: get-return\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#identical-branches\n - name: identical-branches\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#if-return\n - name: if-return\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#import-alias-naming\n - name: import-alias-naming\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - \"^[a-z][a-z0-9]{0,}$\"\n # Or this parameter:\n - allow-regex: \"^[a-z][a-z0-9]{0,}$\"\n deny-regex: '^v\\d+$'\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#import-shadowing\n - name: import-shadowing\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#imports-blocklist\n - name: imports-blocklist\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - \"crypto/md5\"\n - \"crypto/sha1\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#increment-decrement\n - name: increment-decrement\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#indent-error-flow\n - name: indent-error-flow\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - \"preserve-scope\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#line-length-limit\n - name: line-length-limit\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments: [80]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#max-control-nesting\n - name: max-control-nesting\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments: [3]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#max-public-structs\n - name: max-public-structs\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments: [3]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#modifies-parameter\n - name: modifies-parameter\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#modifies-value-receiver\n - name: modifies-value-receiver\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#nested-structs\n - name: nested-structs\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#optimize-operands-order\n - name: optimize-operands-order\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#package-comments\n - name: package-comments\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#range\n - name: range\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#range-val-address\n - name: range-val-address\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#range-val-in-closure\n - name: range-val-in-closure\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#receiver-naming\n - name: receiver-naming\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - max-length: 2\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#redefines-builtin-id\n - name: redefines-builtin-id\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#redundant-build-tag\n - name: redundant-build-tag\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#redundant-import-alias\n - name: redundant-import-alias\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#redundant-test-main-exit\n - name: redundant-test-main-exit\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#string-format\n - name: string-format\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - - 'core.WriteError[1].Message'\n - '/^([^A-Z]|$)/'\n - must not start with a capital letter\n - - 'fmt.Errorf[0]'\n - '/(^|[^\\.!?])$/'\n - must not end in punctuation\n - - panic\n - '/^[^\\n]*$/'\n - must not contain line breaks\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#string-of-int\n - name: string-of-int\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#struct-tag\n - name: struct-tag\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - \"json,inline\"\n - \"bson,outline,gnu\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#superfluous-else\n - name: superfluous-else\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - \"preserve-scope\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#time-date\n - name: time-date\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#time-equal\n - name: time-equal\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#time-naming\n - name: time-naming\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unchecked-type-assertion\n - name: unchecked-type-assertion\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - accept-ignored-assertion-result: true\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unconditional-recursion\n - name: unconditional-recursion\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unexported-naming\n - name: unexported-naming\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unexported-return\n - name: unexported-return\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unhandled-error\n - name: unhandled-error\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - \"^fmt.Printf\"\n - \"myFunction\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unnecessary-format\n - name: unnecessary-format\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unnecessary-stmt\n - name: unnecessary-stmt\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unreachable-code\n - name: unreachable-code\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unused-parameter\n - name: unused-parameter\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - allow-regex: \"^_\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unused-receiver\n - name: unused-receiver\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - allow-regex: \"^_\"\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#use-any\n - name: use-any\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#use-errors-new\n - name: use-errors-new\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#use-fmt-print\n - name: use-fmt-print\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#useless-break\n - name: useless-break\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#var-declaration\n - name: var-declaration\n severity: warning\n disabled: false\n exclude: [\"\"]\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#var-naming\n - name: var-naming\n severity: warning\n disabled: false\n exclude: [\"\"]\n arguments:\n - [\"ID\"] # AllowList\n - [\"VM\"] # DenyList\n - - skip-initialism-name-checks: true\n upper-case-const: true\n skip-package-name-checks: true\n extra-bad-package-names:\n - helpers\n - models\n # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#waitgroup-by-value\n - name: waitgroup-by-value\n severity: warning\n disabled: false\n exclude: [\"\"]\n", + "rowserrcheck": "linters:\n settings:\n rowserrcheck:\n # database/sql is always checked.\n # Default: []\n packages:\n - github.com/jmoiron/sqlx\n", + "sloglint": "linters:\n settings:\n sloglint:\n # Enforce not mixing key-value pairs and attributes.\n # https://github.com/go-simpler/sloglint?tab=readme-ov-file#no-mixed-arguments\n # Default: true\n no-mixed-args: false\n # Enforce using key-value pairs only (overrides no-mixed-args, incompatible with attr-only).\n # https://github.com/go-simpler/sloglint?tab=readme-ov-file#key-value-pairs-only\n # Default: false\n kv-only: true\n # Enforce using attributes only (overrides no-mixed-args, incompatible with kv-only).\n # https://github.com/go-simpler/sloglint?tab=readme-ov-file#attributes-only\n # Default: false\n attr-only: true\n # Enforce not using global loggers.\n # Values:\n # - \"\": disabled\n # - \"all\": report all global loggers\n # - \"default\": report only the default slog logger\n # https://github.com/go-simpler/sloglint?tab=readme-ov-file#no-global\n # Default: \"\"\n no-global: \"all\"\n # Enforce using methods that accept a context.\n # Values:\n # - \"\": disabled\n # - \"all\": report all contextless calls\n # - \"scope\": report only if a context exists in the scope of the outermost function\n # https://github.com/go-simpler/sloglint?tab=readme-ov-file#context-only\n # Default: \"\"\n context: \"all\"\n # Enforce using static values for log messages.\n # https://github.com/go-simpler/sloglint?tab=readme-ov-file#static-messages\n # Default: false\n static-msg: true\n # Enforce message style.\n # Values: lowercased, capitalized\n # https://github.com/go-simpler/sloglint?tab=readme-ov-file#message-style\n # Default: \"\"\n msg-style: capitalized\n # Enforce using constants instead of raw keys.\n # https://github.com/go-simpler/sloglint?tab=readme-ov-file#no-raw-keys\n # Default: false\n no-raw-keys: true\n # Enforce key naming convention.\n # Values: snake, kebab, camel, pascal\n # https://github.com/go-simpler/sloglint?tab=readme-ov-file#key-naming-convention\n # Default: \"\"\n key-naming-case: snake\n # Enforce not using specific keys.\n # https://github.com/go-simpler/sloglint?tab=readme-ov-file#forbidden-keys\n # Default: []\n forbidden-keys:\n - time\n - level\n - msg\n - source\n - foo\n # Enforce putting arguments on separate lines.\n # https://github.com/go-simpler/sloglint?tab=readme-ov-file#arguments-on-separate-lines\n # Default: false\n args-on-sep-lines: true\n", + "spancheck": "linters:\n settings:\n spancheck:\n # Checks to enable.\n # Options include:\n # - `end`: check that `span.End()` is called\n # - `record-error`: check that `span.RecordError(err)` is called when an error is returned\n # - `set-status`: check that `span.SetStatus(codes.Error, msg)` is called when an error is returned\n # Default: [\"end\"]\n checks:\n - end\n - record-error\n - set-status\n # A list of regexes for function signatures that silence `record-error` and `set-status` reports\n # if found in the call path to a returned error.\n # https://github.com/jjti/go-spancheck#ignore-check-signatures\n # Default: []\n ignore-check-signatures:\n - \"telemetry.RecordError\"\n # A list of regexes for additional function signatures that create spans.\n # This is useful if you have a utility method to create spans.\n # Each entry should be of the form `\u003cregex\u003e:\u003ctelemetry-type\u003e`, where `telemetry-type` can be `opentelemetry` or `opencensus`.\n # https://github.com/jjti/go-spancheck#extra-start-span-signatures\n # Default: []\n extra-start-span-signatures:\n - \"github.com/user/repo/telemetry/trace.Start:opentelemetry\"\n", + "staticcheck": "linters:\n settings:\n staticcheck:\n # https://staticcheck.dev/docs/configuration/options/#dot_import_whitelist\n # Default: [\"github.com/mmcloughlin/avo/build\", \"github.com/mmcloughlin/avo/operand\", \"github.com/mmcloughlin/avo/reg\"]\n dot-import-whitelist:\n - fmt\n # https://staticcheck.dev/docs/configuration/options/#initialisms\n # Default: [\"ACL\", \"API\", \"ASCII\", \"CPU\", \"CSS\", \"DNS\", \"EOF\", \"GUID\", \"HTML\", \"HTTP\", \"HTTPS\", \"ID\", \"IP\", \"JSON\", \"QPS\", \"RAM\", \"RPC\", \"SLA\", \"SMTP\", \"SQL\", \"SSH\", \"TCP\", \"TLS\", \"TTL\", \"UDP\", \"UI\", \"GID\", \"UID\", \"UUID\", \"URI\", \"URL\", \"UTF8\", \"VM\", \"XML\", \"XMPP\", \"XSRF\", \"XSS\", \"SIP\", \"RTP\", \"AMQP\", \"DB\", \"TS\"]\n initialisms: [\"ACL\", \"API\", \"ASCII\", \"CPU\", \"CSS\", \"DNS\", \"EOF\", \"GUID\", \"HTML\", \"HTTP\", \"HTTPS\", \"ID\", \"IP\", \"JSON\", \"QPS\", \"RAM\", \"RPC\", \"SLA\", \"SMTP\", \"SQL\", \"SSH\", \"TCP\", \"TLS\", \"TTL\", \"UDP\", \"UI\", \"GID\", \"UID\", \"UUID\", \"URI\", \"URL\", \"UTF8\", \"VM\", \"XML\", \"XMPP\", \"XSRF\", \"XSS\", \"SIP\", \"RTP\", \"AMQP\", \"DB\", \"TS\"]\n # https://staticcheck.dev/docs/configuration/options/#http_status_code_whitelist\n # Default: [\"200\", \"400\", \"404\", \"500\"]\n http-status-code-whitelist: [\"200\", \"400\", \"404\", \"500\"]\n # SAxxxx checks in https://staticcheck.dev/docs/configuration/options/#checks\n # Example (to disable some checks): [ \"all\", \"-SA1000\", \"-SA1001\"]\n # Run `GL_DEBUG=staticcheck golangci-lint run --enable=staticcheck` to see all available checks and enabled by config checks.\n # Default: [\"all\", \"-ST1000\", \"-ST1003\", \"-ST1016\", \"-ST1020\", \"-ST1021\", \"-ST1022\"]\n checks:\n # Invalid regular expression.\n # https://staticcheck.dev/docs/checks/#SA1000\n - SA1000\n # Invalid template.\n # https://staticcheck.dev/docs/checks/#SA1001\n - SA1001\n # Invalid format in 'time.Parse'.\n # https://staticcheck.dev/docs/checks/#SA1002\n - SA1002\n # Unsupported argument to functions in 'encoding/binary'.\n # https://staticcheck.dev/docs/checks/#SA1003\n - SA1003\n # Suspiciously small untyped constant in 'time.Sleep'.\n # https://staticcheck.dev/docs/checks/#SA1004\n - SA1004\n # Invalid first argument to 'exec.Command'.\n # https://staticcheck.dev/docs/checks/#SA1005\n - SA1005\n # 'Printf' with dynamic first argument and no further arguments.\n # https://staticcheck.dev/docs/checks/#SA1006\n - SA1006\n # Invalid URL in 'net/url.Parse'.\n # https://staticcheck.dev/docs/checks/#SA1007\n - SA1007\n # Non-canonical key in 'http.Header' map.\n # https://staticcheck.dev/docs/checks/#SA1008\n - SA1008\n # '(*regexp.Regexp).FindAll' called with 'n == 0', which will always return zero results.\n # https://staticcheck.dev/docs/checks/#SA1010\n - SA1010\n # Various methods in the \"strings\" package expect valid UTF-8, but invalid input is provided.\n # https://staticcheck.dev/docs/checks/#SA1011\n - SA1011\n # A nil 'context.Context' is being passed to a function, consider using 'context.TODO' instead.\n # https://staticcheck.dev/docs/checks/#SA1012\n - SA1012\n # 'io.Seeker.Seek' is being called with the whence constant as the first argument, but it should be the second.\n # https://staticcheck.dev/docs/checks/#SA1013\n - SA1013\n # Non-pointer value passed to 'Unmarshal' or 'Decode'.\n # https://staticcheck.dev/docs/checks/#SA1014\n - SA1014\n # Using 'time.Tick' in a way that will leak. Consider using 'time.NewTicker', and only use 'time.Tick' in tests, commands and endless functions.\n # https://staticcheck.dev/docs/checks/#SA1015\n - SA1015\n # Trapping a signal that cannot be trapped.\n # https://staticcheck.dev/docs/checks/#SA1016\n - SA1016\n # Channels used with 'os/signal.Notify' should be buffered.\n # https://staticcheck.dev/docs/checks/#SA1017\n - SA1017\n # 'strings.Replace' called with 'n == 0', which does nothing.\n # https://staticcheck.dev/docs/checks/#SA1018\n - SA1018\n # Using a deprecated function, variable, constant or field.\n # https://staticcheck.dev/docs/checks/#SA1019\n - SA1019\n # Using an invalid host:port pair with a 'net.Listen'-related function.\n # https://staticcheck.dev/docs/checks/#SA1020\n - SA1020\n # Using 'bytes.Equal' to compare two 'net.IP'.\n # https://staticcheck.dev/docs/checks/#SA1021\n - SA1021\n # Modifying the buffer in an 'io.Writer' implementation.\n # https://staticcheck.dev/docs/checks/#SA1023\n - SA1023\n # A string cutset contains duplicate characters.\n # https://staticcheck.dev/docs/checks/#SA1024\n - SA1024\n # It is not possible to use '(*time.Timer).Reset''s return value correctly.\n # https://staticcheck.dev/docs/checks/#SA1025\n - SA1025\n # Cannot marshal channels or functions.\n # https://staticcheck.dev/docs/checks/#SA1026\n - SA1026\n # Atomic access to 64-bit variable must be 64-bit aligned.\n # https://staticcheck.dev/docs/checks/#SA1027\n - SA1027\n # 'sort.Slice' can only be used on slices.\n # https://staticcheck.dev/docs/checks/#SA1028\n - SA1028\n # Inappropriate key in call to 'context.WithValue'.\n # https://staticcheck.dev/docs/checks/#SA1029\n - SA1029\n # Invalid argument in call to a 'strconv' function.\n # https://staticcheck.dev/docs/checks/#SA1030\n - SA1030\n # Overlapping byte slices passed to an encoder.\n # https://staticcheck.dev/docs/checks/#SA1031\n - SA1031\n # Wrong order of arguments to 'errors.Is'.\n # https://staticcheck.dev/docs/checks/#SA1032\n - SA1032\n # 'sync.WaitGroup.Add' called inside the goroutine, leading to a race condition.\n # https://staticcheck.dev/docs/checks/#SA2000\n - SA2000\n # Empty critical section, did you mean to defer the unlock?.\n # https://staticcheck.dev/docs/checks/#SA2001\n - SA2001\n # Called 'testing.T.FailNow' or 'SkipNow' in a goroutine, which isn't allowed.\n # https://staticcheck.dev/docs/checks/#SA2002\n - SA2002\n # Deferred 'Lock' right after locking, likely meant to defer 'Unlock' instead.\n # https://staticcheck.dev/docs/checks/#SA2003\n - SA2003\n # 'TestMain' doesn't call 'os.Exit', hiding test failures.\n # https://staticcheck.dev/docs/checks/#SA3000\n - SA3000\n # Assigning to 'b.N' in benchmarks distorts the results.\n # https://staticcheck.dev/docs/checks/#SA3001\n - SA3001\n # Binary operator has identical expressions on both sides.\n # https://staticcheck.dev/docs/checks/#SA4000\n - SA4000\n # '\u0026*x' gets simplified to 'x', it does not copy 'x'.\n # https://staticcheck.dev/docs/checks/#SA4001\n - SA4001\n # Comparing unsigned values against negative values is pointless.\n # https://staticcheck.dev/docs/checks/#SA4003\n - SA4003\n # The loop exits unconditionally after one iteration.\n # https://staticcheck.dev/docs/checks/#SA4004\n - SA4004\n # Field assignment that will never be observed. Did you mean to use a pointer receiver?.\n # https://staticcheck.dev/docs/checks/#SA4005\n - SA4005\n # A value assigned to a variable is never read before being overwritten. Forgotten error check or dead code?.\n # https://staticcheck.dev/docs/checks/#SA4006\n - SA4006\n # The variable in the loop condition never changes, are you incrementing the wrong variable?.\n # https://staticcheck.dev/docs/checks/#SA4008\n - SA4008\n # A function argument is overwritten before its first use.\n # https://staticcheck.dev/docs/checks/#SA4009\n - SA4009\n # The result of 'append' will never be observed anywhere.\n # https://staticcheck.dev/docs/checks/#SA4010\n - SA4010\n # Break statement with no effect. Did you mean to break out of an outer loop?.\n # https://staticcheck.dev/docs/checks/#SA4011\n - SA4011\n # Comparing a value against NaN even though no value is equal to NaN.\n # https://staticcheck.dev/docs/checks/#SA4012\n - SA4012\n # Negating a boolean twice ('!!b') is the same as writing 'b'. This is either redundant, or a typo.\n # https://staticcheck.dev/docs/checks/#SA4013\n - SA4013\n # An if/else if chain has repeated conditions and no side-effects; if the condition didn't match the first time, it won't match the second time, either.\n # https://staticcheck.dev/docs/checks/#SA4014\n - SA4014\n # Calling functions like 'math.Ceil' on floats converted from integers doesn't do anything useful.\n # https://staticcheck.dev/docs/checks/#SA4015\n - SA4015\n # Certain bitwise operations, such as 'x ^ 0', do not do anything useful.\n # https://staticcheck.dev/docs/checks/#SA4016\n - SA4016\n # Discarding the return values of a function without side effects, making the call pointless.\n # https://staticcheck.dev/docs/checks/#SA4017\n - SA4017\n # Self-assignment of variables.\n # https://staticcheck.dev/docs/checks/#SA4018\n - SA4018\n # Multiple, identical build constraints in the same file.\n # https://staticcheck.dev/docs/checks/#SA4019\n - SA4019\n # Unreachable case clause in a type switch.\n # https://staticcheck.dev/docs/checks/#SA4020\n - SA4020\n # \"x = append(y)\" is equivalent to \"x = y\".\n # https://staticcheck.dev/docs/checks/#SA4021\n - SA4021\n # Comparing the address of a variable against nil.\n # https://staticcheck.dev/docs/checks/#SA4022\n - SA4022\n # Impossible comparison of interface value with untyped nil.\n # https://staticcheck.dev/docs/checks/#SA4023\n - SA4023\n # Checking for impossible return value from a builtin function.\n # https://staticcheck.dev/docs/checks/#SA4024\n - SA4024\n # Integer division of literals that results in zero.\n # https://staticcheck.dev/docs/checks/#SA4025\n - SA4025\n # Go constants cannot express negative zero.\n # https://staticcheck.dev/docs/checks/#SA4026\n - SA4026\n # '(*net/url.URL).Query' returns a copy, modifying it doesn't change the URL.\n # https://staticcheck.dev/docs/checks/#SA4027\n - SA4027\n # 'x % 1' is always zero.\n # https://staticcheck.dev/docs/checks/#SA4028\n - SA4028\n # Ineffective attempt at sorting slice.\n # https://staticcheck.dev/docs/checks/#SA4029\n - SA4029\n # Ineffective attempt at generating random number.\n # https://staticcheck.dev/docs/checks/#SA4030\n - SA4030\n # Checking never-nil value against nil.\n # https://staticcheck.dev/docs/checks/#SA4031\n - SA4031\n # Comparing 'runtime.GOOS' or 'runtime.GOARCH' against impossible value.\n # https://staticcheck.dev/docs/checks/#SA4032\n - SA4032\n # Assignment to nil map.\n # https://staticcheck.dev/docs/checks/#SA5000\n - SA5000\n # Deferring 'Close' before checking for a possible error.\n # https://staticcheck.dev/docs/checks/#SA5001\n - SA5001\n # The empty for loop (\"for {}\") spins and can block the scheduler.\n # https://staticcheck.dev/docs/checks/#SA5002\n - SA5002\n # Defers in infinite loops will never execute.\n # https://staticcheck.dev/docs/checks/#SA5003\n - SA5003\n # \"for { select { ...\" with an empty default branch spins.\n # https://staticcheck.dev/docs/checks/#SA5004\n - SA5004\n # The finalizer references the finalized object, preventing garbage collection.\n # https://staticcheck.dev/docs/checks/#SA5005\n - SA5005\n # Infinite recursive call.\n # https://staticcheck.dev/docs/checks/#SA5007\n - SA5007\n # Invalid struct tag.\n # https://staticcheck.dev/docs/checks/#SA5008\n - SA5008\n # Invalid Printf call.\n # https://staticcheck.dev/docs/checks/#SA5009\n - SA5009\n # Impossible type assertion.\n # https://staticcheck.dev/docs/checks/#SA5010\n - SA5010\n # Possible nil pointer dereference.\n # https://staticcheck.dev/docs/checks/#SA5011\n - SA5011\n # Passing odd-sized slice to function expecting even size.\n # https://staticcheck.dev/docs/checks/#SA5012\n - SA5012\n # Using 'regexp.Match' or related in a loop, should use 'regexp.Compile'.\n # https://staticcheck.dev/docs/checks/#SA6000\n - SA6000\n # Missing an optimization opportunity when indexing maps by byte slices.\n # https://staticcheck.dev/docs/checks/#SA6001\n - SA6001\n # Storing non-pointer values in 'sync.Pool' allocates memory.\n # https://staticcheck.dev/docs/checks/#SA6002\n - SA6002\n # Converting a string to a slice of runes before ranging over it.\n # https://staticcheck.dev/docs/checks/#SA6003\n - SA6003\n # Inefficient string comparison with 'strings.ToLower' or 'strings.ToUpper'.\n # https://staticcheck.dev/docs/checks/#SA6005\n - SA6005\n # Using io.WriteString to write '[]byte'.\n # https://staticcheck.dev/docs/checks/#SA6006\n - SA6006\n # Defers in range loops may not run when you expect them to.\n # https://staticcheck.dev/docs/checks/#SA9001\n - SA9001\n # Using a non-octal 'os.FileMode' that looks like it was meant to be in octal.\n # https://staticcheck.dev/docs/checks/#SA9002\n - SA9002\n # Empty body in an if or else branch.\n # https://staticcheck.dev/docs/checks/#SA9003\n - SA9003\n # Only the first constant has an explicit type.\n # https://staticcheck.dev/docs/checks/#SA9004\n - SA9004\n # Trying to marshal a struct with no public fields nor custom marshaling.\n # https://staticcheck.dev/docs/checks/#SA9005\n - SA9005\n # Dubious bit shifting of a fixed size integer value.\n # https://staticcheck.dev/docs/checks/#SA9006\n - SA9006\n # Deleting a directory that shouldn't be deleted.\n # https://staticcheck.dev/docs/checks/#SA9007\n - SA9007\n # 'else' branch of a type assertion is probably not reading the right value.\n # https://staticcheck.dev/docs/checks/#SA9008\n - SA9008\n # Ineffectual Go compiler directive.\n # https://staticcheck.dev/docs/checks/#SA9009\n - SA9009\n # Incorrect or missing package comment.\n # https://staticcheck.dev/docs/checks/#ST1000\n - ST1000\n # Dot imports are discouraged.\n # https://staticcheck.dev/docs/checks/#ST1001\n - ST1001\n # Poorly chosen identifier.\n # https://staticcheck.dev/docs/checks/#ST1003\n - ST1003\n # Incorrectly formatted error string.\n # https://staticcheck.dev/docs/checks/#ST1005\n - ST1005\n # Poorly chosen receiver name.\n # https://staticcheck.dev/docs/checks/#ST1006\n - ST1006\n # A function's error value should be its last return value.\n # https://staticcheck.dev/docs/checks/#ST1008\n - ST1008\n # Poorly chosen name for variable of type 'time.Duration'.\n # https://staticcheck.dev/docs/checks/#ST1011\n - ST1011\n # Poorly chosen name for error variable.\n # https://staticcheck.dev/docs/checks/#ST1012\n - ST1012\n # Should use constants for HTTP error codes, not magic numbers.\n # https://staticcheck.dev/docs/checks/#ST1013\n - ST1013\n # A switch's default case should be the first or last case.\n # https://staticcheck.dev/docs/checks/#ST1015\n - ST1015\n # Use consistent method receiver names.\n # https://staticcheck.dev/docs/checks/#ST1016\n - ST1016\n # Don't use Yoda conditions.\n # https://staticcheck.dev/docs/checks/#ST1017\n - ST1017\n # Avoid zero-width and control characters in string literals.\n # https://staticcheck.dev/docs/checks/#ST1018\n - ST1018\n # Importing the same package multiple times.\n # https://staticcheck.dev/docs/checks/#ST1019\n - ST1019\n # The documentation of an exported function should start with the function's name.\n # https://staticcheck.dev/docs/checks/#ST1020\n - ST1020\n # The documentation of an exported type should start with type's name.\n # https://staticcheck.dev/docs/checks/#ST1021\n - ST1021\n # The documentation of an exported variable or constant should start with variable's name.\n # https://staticcheck.dev/docs/checks/#ST1022\n - ST1022\n # Redundant type in variable declaration.\n # https://staticcheck.dev/docs/checks/#ST1023\n - ST1023\n # Use plain channel send or receive instead of single-case select.\n # https://staticcheck.dev/docs/checks/#S1000\n - S1000\n # Replace for loop with call to copy.\n # https://staticcheck.dev/docs/checks/#S1001\n - S1001\n # Omit comparison with boolean constant.\n # https://staticcheck.dev/docs/checks/#S1002\n - S1002\n # Replace call to 'strings.Index' with 'strings.Contains'.\n # https://staticcheck.dev/docs/checks/#S1003\n - S1003\n # Replace call to 'bytes.Compare' with 'bytes.Equal'.\n # https://staticcheck.dev/docs/checks/#S1004\n - S1004\n # Drop unnecessary use of the blank identifier.\n # https://staticcheck.dev/docs/checks/#S1005\n - S1005\n # Use \"for { ... }\" for infinite loops.\n # https://staticcheck.dev/docs/checks/#S1006\n - S1006\n # Simplify regular expression by using raw string literal.\n # https://staticcheck.dev/docs/checks/#S1007\n - S1007\n # Simplify returning boolean expression.\n # https://staticcheck.dev/docs/checks/#S1008\n - S1008\n # Omit redundant nil check on slices, maps, and channels.\n # https://staticcheck.dev/docs/checks/#S1009\n - S1009\n # Omit default slice index.\n # https://staticcheck.dev/docs/checks/#S1010\n - S1010\n # Use a single 'append' to concatenate two slices.\n # https://staticcheck.dev/docs/checks/#S1011\n - S1011\n # Replace 'time.Now().Sub(x)' with 'time.Since(x)'.\n # https://staticcheck.dev/docs/checks/#S1012\n - S1012\n # Use a type conversion instead of manually copying struct fields.\n # https://staticcheck.dev/docs/checks/#S1016\n - S1016\n # Replace manual trimming with 'strings.TrimPrefix'.\n # https://staticcheck.dev/docs/checks/#S1017\n - S1017\n # Use \"copy\" for sliding elements.\n # https://staticcheck.dev/docs/checks/#S1018\n - S1018\n # Simplify \"make\" call by omitting redundant arguments.\n # https://staticcheck.dev/docs/checks/#S1019\n - S1019\n # Omit redundant nil check in type assertion.\n # https://staticcheck.dev/docs/checks/#S1020\n - S1020\n # Merge variable declaration and assignment.\n # https://staticcheck.dev/docs/checks/#S1021\n - S1021\n # Omit redundant control flow.\n # https://staticcheck.dev/docs/checks/#S1023\n - S1023\n # Replace 'x.Sub(time.Now())' with 'time.Until(x)'.\n # https://staticcheck.dev/docs/checks/#S1024\n - S1024\n # Don't use 'fmt.Sprintf(\"%s\", x)' unnecessarily.\n # https://staticcheck.dev/docs/checks/#S1025\n - S1025\n # Simplify error construction with 'fmt.Errorf'.\n # https://staticcheck.dev/docs/checks/#S1028\n - S1028\n # Range over the string directly.\n # https://staticcheck.dev/docs/checks/#S1029\n - S1029\n # Use 'bytes.Buffer.String' or 'bytes.Buffer.Bytes'.\n # https://staticcheck.dev/docs/checks/#S1030\n - S1030\n # Omit redundant nil check around loop.\n # https://staticcheck.dev/docs/checks/#S1031\n - S1031\n # Use 'sort.Ints(x)', 'sort.Float64s(x)', and 'sort.Strings(x)'.\n # https://staticcheck.dev/docs/checks/#S1032\n - S1032\n # Unnecessary guard around call to \"delete\".\n # https://staticcheck.dev/docs/checks/#S1033\n - S1033\n # Use result of type assertion to simplify cases.\n # https://staticcheck.dev/docs/checks/#S1034\n - S1034\n # Redundant call to 'net/http.CanonicalHeaderKey' in method call on 'net/http.Header'.\n # https://staticcheck.dev/docs/checks/#S1035\n - S1035\n # Unnecessary guard around map access.\n # https://staticcheck.dev/docs/checks/#S1036\n - S1036\n # Elaborate way of sleeping.\n # https://staticcheck.dev/docs/checks/#S1037\n - S1037\n # Unnecessarily complex way of printing formatted string.\n # https://staticcheck.dev/docs/checks/#S1038\n - S1038\n # Unnecessary use of 'fmt.Sprint'.\n # https://staticcheck.dev/docs/checks/#S1039\n - S1039\n # Type assertion to current type.\n # https://staticcheck.dev/docs/checks/#S1040\n - S1040\n # Apply De Morgan's law.\n # https://staticcheck.dev/docs/checks/#QF1001\n - QF1001\n # Convert untagged switch to tagged switch.\n # https://staticcheck.dev/docs/checks/#QF1002\n - QF1002\n # Convert if/else-if chain to tagged switch.\n # https://staticcheck.dev/docs/checks/#QF1003\n - QF1003\n # Use 'strings.ReplaceAll' instead of 'strings.Replace' with 'n == -1'.\n # https://staticcheck.dev/docs/checks/#QF1004\n - QF1004\n # Expand call to 'math.Pow'.\n # https://staticcheck.dev/docs/checks/#QF1005\n - QF1005\n # Lift 'if'+'break' into loop condition.\n # https://staticcheck.dev/docs/checks/#QF1006\n - QF1006\n # Merge conditional assignment into variable declaration.\n # https://staticcheck.dev/docs/checks/#QF1007\n - QF1007\n # Omit embedded fields from selector expression.\n # https://staticcheck.dev/docs/checks/#QF1008\n - QF1008\n # Use 'time.Time.Equal' instead of '==' operator.\n # https://staticcheck.dev/docs/checks/#QF1009\n - QF1009\n # Convert slice of bytes to string when printing it.\n # https://staticcheck.dev/docs/checks/#QF1010\n - QF1010\n # Omit redundant type from variable declaration.\n # https://staticcheck.dev/docs/checks/#QF1011\n - QF1011\n # Use 'fmt.Fprintf(x, ...)' instead of 'x.Write(fmt.Sprintf(...))'.\n # https://staticcheck.dev/docs/checks/#QF1012\n - QF1012\n", + "tagalign": "linters:\n settings:\n tagalign:\n # Align and sort can be used together or separately.\n #\n # Whether enable align. If true, the struct tags will be aligned.\n # E.g.:\n # type FooBar struct {\n # Bar string `json:\"bar\" validate:\"required\"`\n # FooFoo int8 `json:\"foo_foo\" validate:\"required\"`\n # }\n # will be formatted to:\n # type FooBar struct {\n # Bar string `json:\"bar\" validate:\"required\"`\n # FooFoo int8 `json:\"foo_foo\" validate:\"required\"`\n # }\n # Default: true.\n align: false\n # Whether enable tags sort.\n # If true, the tags will be sorted by name in ascending order.\n # E.g.: `xml:\"bar\" json:\"bar\" validate:\"required\"` -\u003e `json:\"bar\" validate:\"required\" xml:\"bar\"`.\n # Default: true\n sort: false\n # Specify the order of tags, the other tags will be sorted by name.\n # This option will be ignored if `sort` is false.\n # Default: []\n order:\n - json\n - yaml\n - yml\n - toml\n - mapstructure\n - binding\n - validate\n # Whether enable strict style.\n # In this style, the tags will be sorted and aligned in the dictionary order,\n # and the tags with the same name will be aligned together.\n # Note: This option will be ignored if 'align' or 'sort' is false.\n # Default: false\n strict: true\n", + "tagliatelle": "linters:\n settings:\n tagliatelle:\n # Checks the struct tag name case.\n case:\n # Defines the association between tag name and case.\n # Any struct tag name can be used.\n # Supported string cases:\n # - `camel`\n # - `pascal`\n # - `kebab`\n # - `snake`\n # - `upperSnake`\n # - `goCamel`\n # - `goPascal`\n # - `goKebab`\n # - `goSnake`\n # - `upper`\n # - `lower`\n # - `header`\n rules:\n json: camel\n yaml: camel\n xml: camel\n toml: camel\n bson: camel\n avro: snake\n mapstructure: kebab\n env: upperSnake\n envconfig: upperSnake\n whatever: snake\n # Defines the association between tag name and case.\n # Important: the `extended-rules` overrides `rules`.\n # Default: empty\n extended-rules:\n json:\n # Supported string cases:\n # - `camel`\n # - `pascal`\n # - `kebab`\n # - `snake`\n # - `upperSnake`\n # - `goCamel`\n # - `goPascal`\n # - `goKebab`\n # - `goSnake`\n # - `header`\n # - `lower`\n # - `header`\n #\n # Required\n case: camel\n # Adds 'AMQP', 'DB', 'GID', 'RTP', 'SIP', 'TS' to initialisms,\n # and removes 'LHS', 'RHS' from initialisms.\n # Default: false\n extra-initialisms: true\n # Defines initialism additions and overrides.\n # Default: empty\n initialism-overrides:\n DB: true # add a new initialism\n LHS: false # disable a default initialism.\n # ...\n # Uses the struct field name to check the name of the struct tag.\n # Default: false\n use-field-name: true\n # The field names to ignore.\n # Default: []\n ignored-fields:\n - Bar\n - Foo\n # Overrides the default/root configuration.\n # Default: []\n overrides:\n - # The package path (uses `/` only as a separator).\n # Required\n pkg: foo/bar\n # Default: empty or the same as the default/root configuration.\n rules:\n json: snake\n xml: pascal\n # Default: empty or the same as the default/root configuration.\n extended-rules:\n # Same options as the base `extended-rules`.\n # Default: false (WARNING: it doesn't follow the default/root configuration)\n use-field-name: true\n # The field names to ignore.\n # Default: [] or the same as the default/root configuration.\n ignored-fields:\n - Bar\n - Foo\n # Ignore the package (takes precedence over all other configurations).\n # Default: false\n ignore: true\n", + "testifylint": "linters:\n settings:\n testifylint:\n # Enable all checkers (https://github.com/Antonboom/testifylint#checkers).\n # Default: false\n enable-all: true\n # Disable checkers by name\n # (in addition to default\n # suite-thelper\n # ).\n disable:\n - blank-import\n - bool-compare\n - compares\n - contains\n - empty\n - encoded-compare\n - equal-values\n - error-is-as\n - error-nil\n - expected-actual\n - float-compare\n - formatter\n - go-require\n - len\n - negative-positive\n - nil-compare\n - regexp\n - require-error\n - suite-broken-parallel\n - suite-dont-use-pkg\n - suite-extra-assert-call\n - suite-method-signature\n - suite-subtest-run\n - suite-thelper\n - useless-assert\n # Disable all checkers (https://github.com/Antonboom/testifylint#checkers).\n # Default: false\n disable-all: true\n # Enable checkers by name\n # (in addition to default\n # blank-import, bool-compare, compares, contains, empty, encoded-compare, equal-values, error-is-as, error-nil,\n # expected-actual, go-require, float-compare, formatter, len, negative-positive, nil-compare, regexp, require-error,\n # suite-broken-parallel, suite-dont-use-pkg, suite-extra-assert-call, suite-subtest-run, suite-method-signature,\n # useless-assert\n # ).\n enable:\n - blank-import\n - bool-compare\n - compares\n - contains\n - empty\n - encoded-compare\n - equal-values\n - error-is-as\n - error-nil\n - expected-actual\n - float-compare\n - formatter\n - go-require\n - len\n - negative-positive\n - nil-compare\n - regexp\n - require-error\n - suite-broken-parallel\n - suite-dont-use-pkg\n - suite-extra-assert-call\n - suite-method-signature\n - suite-subtest-run\n - suite-thelper\n - useless-assert\n bool-compare:\n # To ignore user defined types (over builtin bool).\n # Default: false\n ignore-custom-types: true\n expected-actual:\n # Regexp for expected variable name.\n # Default: (^(exp(ected)?|want(ed)?)([A-Z]\\w*)?$)|(^(\\w*[a-z])?(Exp(ected)?|Want(ed)?)$)\n pattern: ^expected\n formatter:\n # To enable go vet's printf checks.\n # Default: true\n check-format-string: false\n # To require f-assertions (e.g. `assert.Equalf`) if format string is used, even if there are no variable-length\n # variables, i.e. it requires `require.NoErrorf` for both these cases:\n # - require.NoErrorf(t, err, \"unexpected error\")\n # - require.NoErrorf(t, err, \"unexpected error for sid: %v\", sid)\n # To understand this behavior, please read the\n # https://github.com/Antonboom/testifylint?tab=readme-ov-file#historical-reference-of-formatter.\n # Default: false\n require-f-funcs: true\n # To require that the first element of msgAndArgs (msg) has a string type.\n # For example, in such case assertion like `assert.True(t, b, tt.case)` will be considered as invalid.\n # Default: true\n require-string-msg: false\n go-require:\n # To ignore HTTP handlers (like http.HandlerFunc).\n # Default: false\n ignore-http-handlers: true\n require-error:\n # Regexp for assertions to analyze. If defined, then only matched error assertions will be reported.\n # Default: \"\"\n fn-pattern: ^(Errorf?|NoErrorf?)$\n suite-extra-assert-call:\n # To require or remove extra Assert() call?\n # Default: remove\n mode: require\n", + "testpackage": "linters:\n settings:\n testpackage:\n # Regexp pattern to skip files.\n # Default: \"(export|internal)_test\\\\.go\"\n skip-regexp: (export|internal)_test\\.go\n # List of packages that don't end with _test that tests are allowed to be in.\n # Default: \"main\"\n allow-packages:\n - example\n - main\n", + "thelper": "linters:\n settings:\n thelper:\n test:\n # Check *testing.T is first param (or after context.Context) of helper function.\n # Default: true\n first: false\n # Check *testing.T param has name t.\n # Default: true\n name: false\n # Check t.Helper() begins helper function.\n # Default: true\n begin: false\n benchmark:\n # Check *testing.B is first param (or after context.Context) of helper function.\n # Default: true\n first: false\n # Check *testing.B param has name b.\n # Default: true\n name: false\n # Check b.Helper() begins helper function.\n # Default: true\n begin: false\n tb:\n # Check *testing.TB is first param (or after context.Context) of helper function.\n # Default: true\n first: false\n # Check *testing.TB param has name tb.\n # Default: true\n name: false\n # Check tb.Helper() begins helper function.\n # Default: true\n begin: false\n fuzz:\n # Check *testing.F is first param (or after context.Context) of helper function.\n # Default: true\n first: false\n # Check *testing.F param has name f.\n # Default: true\n name: false\n # Check f.Helper() begins helper function.\n # Default: true\n begin: false\n", + "unconvert": "linters:\n settings:\n unconvert:\n # Remove conversions that force intermediate rounding.\n # Default: false\n fast-math: true\n # Be more conservative (experimental).\n # Default: false\n safe: true\n", + "unparam": "linters:\n settings:\n unparam:\n # Inspect exported functions.\n #\n # Set to true if no external program/library imports your code.\n # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:\n # if it's called for subdir of a project it can't find external interfaces. All text editor integrations\n # with golangci-lint call it on a directory with the changed file.\n #\n # Default: false\n check-exported: true\n", + "unused": "linters:\n settings:\n unused:\n # Mark all struct fields that have been written to as used.\n # Default: true\n field-writes-are-uses: false\n # Treat IncDec statement (e.g. `i++` or `i--`) as both read and write operation instead of just write.\n # Default: false\n post-statements-are-reads: true\n # Mark all exported fields as used.\n # default: true\n exported-fields-are-used: false\n # Mark all function parameters as used.\n # default: true\n parameters-are-used: false\n # Mark all local variables as used.\n # default: true\n local-variables-are-used: false\n # Mark all identifiers inside generated files as used.\n # Default: true\n generated-is-used: false\n", + "usestdlibvars": "linters:\n settings:\n usestdlibvars:\n # Suggest the use of http.MethodXX.\n # Default: true\n http-method: false\n # Suggest the use of http.StatusXX.\n # Default: true\n http-status-code: false\n # Suggest the use of time.Month in time.Date.\n # Default: false\n time-date-month: true\n # Suggest the use of time.Weekday.String().\n # Default: true\n time-weekday: true\n # Suggest the use of time.Month.String().\n # Default: false\n time-month: true\n # Suggest the use of time.Layout.\n # Default: false\n time-layout: true\n # Suggest the use of crypto.Hash.String().\n # Default: false\n crypto-hash: true\n # Suggest the use of rpc.DefaultXXPath.\n # Default: false\n default-rpc-path: true\n # Suggest the use of sql.LevelXX.String().\n # Default: false\n sql-isolation-level: true\n # Suggest the use of tls.SignatureScheme.String().\n # Default: false\n tls-signature-scheme: true\n # Suggest the use of constant.Kind.String().\n # Default: false\n constant-kind: true\n", + "usetesting": "linters:\n settings:\n usetesting:\n # Enable/disable `os.CreateTemp(\"\", ...)` detections.\n # Default: true\n os-create-temp: false\n # Enable/disable `os.MkdirTemp()` detections.\n # Default: true\n os-mkdir-temp: false\n # Enable/disable `os.Setenv()` detections.\n # Default: true\n os-setenv: false\n # Enable/disable `os.TempDir()` detections.\n # Default: false\n os-temp-dir: true\n # Enable/disable `os.Chdir()` detections.\n # Disabled if Go \u003c 1.24.\n # Default: true\n os-chdir: false\n # Enable/disable `context.Background()` detections.\n # Disabled if Go \u003c 1.24.\n # Default: false\n context-background: true\n # Enable/disable `context.TODO()` detections.\n # Disabled if Go \u003c 1.24.\n # Default: false\n context-todo: true\n", + "varnamelen": "linters:\n settings:\n varnamelen:\n # The longest distance, in source lines, that is being considered a \"small scope\".\n # Variables used in at most this many lines will be ignored.\n # Default: 5\n max-distance: 6\n # The minimum length of a variable's name that is considered \"long\".\n # Variable names that are at least this long will be ignored.\n # Default: 3\n min-name-length: 2\n # Check method receivers.\n # Default: false\n check-receiver: true\n # Check named return values.\n # Default: false\n check-return: true\n # Check type parameters.\n # Default: false\n check-type-param: true\n # Ignore \"ok\" variables that hold the bool return value of a type assertion.\n # Default: false\n ignore-type-assert-ok: true\n # Ignore \"ok\" variables that hold the bool return value of a map index.\n # Default: false\n ignore-map-index-ok: true\n # Ignore \"ok\" variables that hold the bool return value of a channel receive.\n # Default: false\n ignore-chan-recv-ok: true\n # Optional list of variable names that should be ignored completely.\n # Default: []\n ignore-names:\n - err\n # Optional list of variable declarations that should be ignored completely.\n # Entries must be in one of the following forms (see below for examples):\n # - for variables, parameters, named return values, method receivers, or type parameters:\n # \u003cname\u003e \u003ctype\u003e (\u003ctype\u003e can also be a pointer/slice/map/chan/...)\n # - for constants: const \u003cname\u003e\n #\n # Default: []\n ignore-decls:\n - c echo.Context\n - t testing.T\n - f *foo.Bar\n - e error\n - i int\n - const C\n - T any\n - m map[string]int\n", + "whitespace": "linters:\n settings:\n whitespace:\n # Enforces newlines (or comments) after every multi-line if statement.\n # Default: false\n multi-if: true\n # Enforces newlines (or comments) after every multi-line function signature.\n # Default: false\n multi-func: true\n", + "wrapcheck": "linters:\n settings:\n wrapcheck:\n # An array of strings specifying additional substrings of signatures to ignore.\n # Unlike 'ignore-sigs', this option extends the default set (or the set specified in 'ignore-sigs') without replacing it entirely.\n # This allows you to add specific signatures to the ignore list\n # while retaining the defaults or any items in 'ignore-sigs'.\n # Default: []\n extra-ignore-sigs:\n - .CustomError(\n - .SpecificWrap(\n # An array of strings that specify substrings of signatures to ignore.\n # If this set, it will override the default set of ignored signatures.\n # See https://github.com/tomarrell/wrapcheck#configuration for more information.\n # Default: [\".Errorf(\", \"errors.New(\", \"errors.Unwrap(\", \"errors.Join(\", \".Wrap(\", \".Wrapf(\", \".WithMessage(\", \".WithMessagef(\", \".WithStack(\"]\n ignore-sigs:\n - .Errorf(\n - errors.New(\n - errors.Unwrap(\n - errors.Join(\n - .Wrap(\n - .Wrapf(\n - .WithMessage(\n - .WithMessagef(\n - .WithStack(\n # An array of strings that specify regular expressions of signatures to ignore.\n # Default: []\n ignore-sig-regexps:\n - \\.New.*Error\\(\n # An array of strings that specify globs of packages to ignore.\n # Default: []\n ignore-package-globs:\n - encoding/*\n - github.com/pkg/*\n # An array of strings that specify regular expressions of interfaces to ignore.\n # Default: []\n ignore-interface-regexps:\n - ^(?i)c(?-i)ach(ing|e)\n # Determines whether wrapcheck should report errors returned from inside the package.\n # Default: false\n report-internal-errors: true\n", + "wsl_v5": "linters:\n settings:\n wsl_v5:\n # Allow cuddling a variable if it's used first in the immediate following block,\n # even if the statement with the block doesn't use the variable.\n # https://github.com/bombsimon/wsl/tree/main?tab=readme-ov-file#configuration\n # Default: true\n allow-first-in-block: false\n # Same as above,\n # but allows cuddling if the variable is used anywhere in the following (or nested) block.\n # https://github.com/bombsimon/wsl/tree/main?tab=readme-ov-file#configuration\n # Default: false\n allow-whole-block: true\n # If a block contains more than this number of lines,\n # the branch statement needs to be separated by whitespace.\n # https://github.com/bombsimon/wsl/tree/main?tab=readme-ov-file#configuration\n # Default: 2\n branch-max-lines: 4\n # If set to a non-negative number,\n # case blocks need to end with whitespace if exceeding this number\n # https://github.com/bombsimon/wsl/tree/main?tab=readme-ov-file#configuration\n # Default: 0\n case-max-lines: 2\n # Default checks to use.\n # Can be `all`, `none`, `default` or empty.\n # https://github.com/bombsimon/wsl/tree/main?tab=readme-ov-file#checks-and-configuration\n # Default: \"\"\n default: all\n # Enabled checks.\n # Will be additive to any presets.\n # https://github.com/bombsimon/wsl/tree/main?tab=readme-ov-file#checks-and-configuration\n # Default: []\n enable:\n - assign\n - branch\n - decl\n - defer\n - expr\n - for\n - go\n - if\n - inc-dec\n - label\n - range\n - return\n - select\n - send\n - switch\n - type-switch\n - append\n - assign-exclusive\n - assign-expr\n - err\n - leading-whitespace\n - trailing-whitespace\n # Disable checks.\n # Will be subtractive to any preset.\n # https://github.com/bombsimon/wsl/tree/main?tab=readme-ov-file#checks-and-configuration\n # Default: []\n disable:\n - assign\n - branch\n - decl\n - defer\n - expr\n - for\n - go\n - if\n - inc-dec\n - label\n - range\n - return\n - select\n - send\n - switch\n - type-switch\n - append\n - assign-exclusive\n - assign-expr\n - err\n - leading-whitespace\n - trailing-whitespace\n" +} diff --git a/assets/linters-info.json b/docs/data/linters_info.json similarity index 92% rename from assets/linters-info.json rename to docs/data/linters_info.json index 10bd6eb4b5c4..cca964d3cb8f 100644 --- a/assets/linters-info.json +++ b/docs/data/linters_info.json @@ -2,7 +2,6 @@ { "name": "arangolint", "desc": "opinionated best practices for arangodb client", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/Crocmagnon/arangolint", "internal": false, @@ -12,7 +11,6 @@ { "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, @@ -22,7 +20,6 @@ { "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, @@ -32,7 +29,6 @@ { "name": "bidichk", "desc": "Checks for dangerous unicode character sequences", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/breml/bidichk", "internal": false, @@ -42,7 +38,6 @@ { "name": "bodyclose", "desc": "checks whether HTTP response body is closed successfully", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/timakin/bodyclose", "internal": false, @@ -52,7 +47,6 @@ { "name": "canonicalheader", "desc": "canonicalheader checks whether net/http.Header uses canonical header", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/lasiar/canonicalheader", "internal": false, @@ -63,7 +57,6 @@ { "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, @@ -73,7 +66,6 @@ { "name": "contextcheck", "desc": "check whether the function uses a non-inherited context", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/kkHAIKE/contextcheck", "internal": false, @@ -83,7 +75,6 @@ { "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, @@ -94,7 +85,6 @@ { "name": "cyclop", "desc": "checks function and package cyclomatic complexity", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/bkielbasa/cyclop", "internal": false, @@ -104,7 +94,6 @@ { "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, @@ -114,7 +103,6 @@ { "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, @@ -124,7 +112,6 @@ { "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, @@ -134,7 +121,6 @@ { "name": "dupl", "desc": "Detects duplicate fragments of code.", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/mibk/dupl", "internal": false, @@ -144,7 +130,6 @@ { "name": "dupword", "desc": "Checks for duplicate words in the source code", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/Abirdcfly/dupword", "internal": false, @@ -155,7 +140,6 @@ { "name": "durationcheck", "desc": "check for two durations multiplied together", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/charithe/durationcheck", "internal": false, @@ -165,7 +149,6 @@ { "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, @@ -175,9 +158,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", - "Groups": { - "standard": {} - }, + "groups": [ + "standard" + ], "loadMode": 8767, "originalURL": "https://github.com/kisielk/errcheck", "internal": false, @@ -187,7 +170,6 @@ { "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, @@ -197,7 +179,6 @@ { "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, @@ -207,7 +188,6 @@ { "name": "errorlint", "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", "internal": false, @@ -218,7 +198,6 @@ { "name": "exhaustive", "desc": "check exhaustiveness of enum switch statements", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/nishanths/exhaustive", "internal": false, @@ -228,7 +207,6 @@ { "name": "exhaustruct", "desc": "Checks if all structure fields are initialized", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/GaijinEntertainment/go-exhaustruct", "internal": false, @@ -238,7 +216,6 @@ { "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, @@ -249,7 +226,6 @@ { "name": "forbidigo", "desc": "Forbids identifiers", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/ashanbrown/forbidigo", "internal": false, @@ -259,7 +235,6 @@ { "name": "forcetypeassert", "desc": "Find forced type assertions", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/gostaticanalysis/forcetypeassert", "internal": false, @@ -269,7 +244,6 @@ { "name": "funcorder", "desc": "checks the order of functions, methods, and constructors", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/manuelarte/funcorder", "internal": false, @@ -279,7 +253,6 @@ { "name": "fatcontext", "desc": "detects nested contexts in loops and function literals", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/Crocmagnon/fatcontext", "internal": false, @@ -290,7 +263,6 @@ { "name": "funlen", "desc": "Checks for long functions.", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/ultraware/funlen", "internal": false, @@ -300,7 +272,6 @@ { "name": "ginkgolinter", "desc": "enforces standards of using ginkgo and gomega", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/nunnatsa/ginkgolinter", "internal": false, @@ -311,7 +282,6 @@ { "name": "gocheckcompilerdirectives", "desc": "Checks that go compiler directive comments (//go:) are valid.", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/leighmcculloch/gocheckcompilerdirectives", "internal": false, @@ -321,7 +291,6 @@ { "name": "gochecknoglobals", "desc": "Check that no global variables exist.", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/leighmcculloch/gochecknoglobals", "internal": false, @@ -331,7 +300,6 @@ { "name": "gochecknoinits", "desc": "Checks that no init functions are present in Go code", - "Groups": null, "loadMode": 8199, "internal": false, "isSlow": false, @@ -340,7 +308,6 @@ { "name": "gochecksumtype", "desc": "Run exhaustiveness checks on Go \"sum types\"", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/alecthomas/go-check-sumtype", "internal": false, @@ -350,7 +317,6 @@ { "name": "gocognit", "desc": "Computes and checks the cognitive complexity of functions", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/uudashr/gocognit", "internal": false, @@ -360,7 +326,6 @@ { "name": "goconst", "desc": "Finds repeated strings that could be replaced by a constant", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/jgautheron/goconst", "internal": false, @@ -370,7 +335,6 @@ { "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, @@ -381,7 +345,6 @@ { "name": "gocyclo", "desc": "Computes and checks the cyclomatic complexity of functions", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/fzipp/gocyclo", "internal": false, @@ -391,7 +354,6 @@ { "name": "godot", "desc": "Check if comments end in a period", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/tetafro/godot", "internal": false, @@ -402,7 +364,6 @@ { "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, @@ -412,7 +373,6 @@ { "name": "err113", "desc": "Check errors handling expressions", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/Djarvur/go-err113", "internal": false, @@ -423,7 +383,6 @@ { "name": "goheader", "desc": "Check if file header matches to pattern", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/denis-tingaikin/go-header", "internal": false, @@ -434,7 +393,6 @@ { "name": "mnd", "desc": "An analyzer to detect magic numbers.", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/tommy-muehle/go-mnd", "internal": false, @@ -444,7 +402,6 @@ { "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, @@ -454,7 +411,6 @@ { "name": "gomodguard", "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", "internal": false, @@ -464,7 +420,6 @@ { "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, @@ -474,7 +429,6 @@ { "name": "gosec", "desc": "Inspects source code for security problems", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/securego/gosec", "internal": false, @@ -484,7 +438,6 @@ { "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, @@ -494,9 +447,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.", - "Groups": { - "standard": {} - }, + "groups": [ + "standard" + ], "loadMode": 8767, "originalURL": "https://pkg.go.dev/cmd/vet", "internal": false, @@ -507,7 +460,6 @@ { "name": "grouper", "desc": "Analyze expression groups.", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/leonklingele/grouper", "internal": false, @@ -517,7 +469,6 @@ { "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, @@ -528,7 +479,6 @@ { "name": "importas", "desc": "Enforces consistent import aliases", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/julz/importas", "internal": false, @@ -539,7 +489,6 @@ { "name": "inamedparam", "desc": "reports interfaces with unnamed method parameters", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/macabu/inamedparam", "internal": false, @@ -549,9 +498,9 @@ { "name": "ineffassign", "desc": "Detects when assignments to existing variables are not used", - "Groups": { - "standard": {} - }, + "groups": [ + "standard" + ], "loadMode": 8199, "originalURL": "https://github.com/gordonklaus/ineffassign", "internal": false, @@ -561,7 +510,6 @@ { "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, @@ -571,7 +519,6 @@ { "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, @@ -582,7 +529,6 @@ { "name": "ireturn", "desc": "Accept Interfaces, Return Concrete Types", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/butuzov/ireturn", "internal": false, @@ -592,7 +538,6 @@ { "name": "lll", "desc": "Reports long lines", - "Groups": null, "loadMode": 8199, "internal": false, "isSlow": false, @@ -601,7 +546,6 @@ { "name": "loggercheck", "desc": "Checks key value pairs for common logger libraries (kitlog,klog,logr,slog,zap).", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/timonwong/loggercheck", "internal": false, @@ -611,7 +555,6 @@ { "name": "maintidx", "desc": "maintidx measures the maintainability index of each function.", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/yagipy/maintidx", "internal": false, @@ -621,7 +564,6 @@ { "name": "makezero", "desc": "Find slice declarations with non-zero initial length", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/ashanbrown/makezero", "internal": false, @@ -631,7 +573,6 @@ { "name": "mirror", "desc": "reports wrong mirror patterns of bytes/strings usage", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/butuzov/mirror", "internal": false, @@ -642,7 +583,6 @@ { "name": "misspell", "desc": "Finds commonly misspelled English words", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/golangci/misspell", "internal": false, @@ -653,7 +593,6 @@ { "name": "musttag", "desc": "enforce field tags in (un)marshaled structs", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/go-simpler/musttag", "internal": false, @@ -663,7 +602,6 @@ { "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, @@ -674,7 +612,6 @@ { "name": "nestif", "desc": "Reports deeply nested if statements", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/nakabonne/nestif", "internal": false, @@ -684,7 +621,6 @@ { "name": "nilerr", "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", "internal": false, @@ -694,7 +630,6 @@ { "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, @@ -704,7 +639,6 @@ { "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, @@ -714,7 +648,6 @@ { "name": "nlreturn", "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", "internal": false, @@ -725,7 +658,6 @@ { "name": "noctx", "desc": "Detects function and method with missing usage of context.Context", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/sonatard/noctx", "internal": false, @@ -735,7 +667,6 @@ { "name": "noinlineerr", "desc": "Disallows inline error handling (`if err := ...; err != nil {`)", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/AlwxSin/noinlineerr", "internal": false, @@ -745,7 +676,6 @@ { "name": "nonamedreturns", "desc": "Reports all named returns", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/firefart/nonamedreturns", "internal": false, @@ -755,7 +685,6 @@ { "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, @@ -765,7 +694,6 @@ { "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, @@ -775,7 +703,6 @@ { "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, @@ -786,7 +713,6 @@ { "name": "prealloc", "desc": "Find slice declarations that could potentially be pre-allocated", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/alexkohler/prealloc", "internal": false, @@ -796,7 +722,6 @@ { "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, @@ -806,7 +731,6 @@ { "name": "promlinter", "desc": "Check Prometheus metrics naming via promlint", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/yeya24/promlinter", "internal": false, @@ -816,7 +740,6 @@ { "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, @@ -827,7 +750,6 @@ { "name": "reassign", "desc": "Checks that package variables are not reassigned", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/curioswitch/go-reassign", "internal": false, @@ -837,7 +759,6 @@ { "name": "recvcheck", "desc": "checks for receiver type consistency", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/raeperd/recvcheck", "internal": false, @@ -847,7 +768,6 @@ { "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, @@ -858,7 +778,6 @@ { "name": "rowserrcheck", "desc": "checks whether Rows.Err of rows is checked successfully", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/jingyugao/rowserrcheck", "internal": false, @@ -868,7 +787,6 @@ { "name": "sloglint", "desc": "ensure consistent code style when using log/slog", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/go-simpler/sloglint", "internal": false, @@ -879,7 +797,6 @@ { "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, @@ -889,7 +806,6 @@ { "name": "spancheck", "desc": "Checks for mistakes with OpenTelemetry/Census spans.", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/jjti/go-spancheck", "internal": false, @@ -899,9 +815,9 @@ { "name": "staticcheck", "desc": "It's the set of rules from staticcheck.", - "Groups": { - "standard": {} - }, + "groups": [ + "standard" + ], "loadMode": 8767, "originalURL": "https://staticcheck.dev/", "internal": false, @@ -912,7 +828,6 @@ { "name": "tagalign", "desc": "check that struct tags are well aligned", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/4meepo/tagalign", "internal": false, @@ -923,7 +838,6 @@ { "name": "tagliatelle", "desc": "Checks the struct tags.", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/ldez/tagliatelle", "internal": false, @@ -933,7 +847,6 @@ { "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, @@ -943,7 +856,6 @@ { "name": "testifylint", "desc": "Checks usage of github.com/stretchr/testify.", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/Antonboom/testifylint", "internal": false, @@ -954,7 +866,6 @@ { "name": "testpackage", "desc": "linter that makes you use a separate _test package", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/maratori/testpackage", "internal": false, @@ -964,7 +875,6 @@ { "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, @@ -974,7 +884,6 @@ { "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, @@ -984,7 +893,6 @@ { "name": "typecheck", "desc": "Like the front-end of a Go compiler, parses and type-checks Go code", - "Groups": null, "loadMode": 8199, "internal": true, "isSlow": false, @@ -993,7 +901,6 @@ { "name": "unconvert", "desc": "Remove unnecessary type conversions", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/mdempsky/unconvert", "internal": false, @@ -1003,7 +910,6 @@ { "name": "unparam", "desc": "Reports unused function parameters", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/mvdan/unparam", "internal": false, @@ -1013,9 +919,9 @@ { "name": "unused", "desc": "Checks Go code for unused constants, variables, functions and types", - "Groups": { - "standard": {} - }, + "groups": [ + "standard" + ], "loadMode": 8767, "originalURL": "https://github.com/dominikh/go-tools/tree/HEAD/unused", "internal": false, @@ -1026,7 +932,6 @@ { "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, @@ -1037,7 +942,6 @@ { "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, @@ -1048,7 +952,6 @@ { "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, @@ -1058,7 +961,6 @@ { "name": "wastedassign", "desc": "Finds wasted assignment statements", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/sanposhiho/wastedassign", "internal": false, @@ -1068,7 +970,6 @@ { "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, @@ -1079,7 +980,6 @@ { "name": "wrapcheck", "desc": "Checks that errors returned from external packages are wrapped", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/tomarrell/wrapcheck", "internal": false, @@ -1089,7 +989,6 @@ { "name": "wsl", "desc": "add or remove empty lines", - "Groups": null, "loadMode": 8199, "originalURL": "https://github.com/bombsimon/wsl", "internal": false, @@ -1105,7 +1004,6 @@ { "name": "wsl_v5", "desc": "add or remove empty lines", - "Groups": null, "loadMode": 8767, "originalURL": "https://github.com/bombsimon/wsl", "internal": false, @@ -1116,7 +1014,6 @@ { "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, @@ -1126,7 +1023,6 @@ { "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/docs/data/thanks.json b/docs/data/thanks.json new file mode 100644 index 000000000000..100c0649fe1f --- /dev/null +++ b/docs/data/thanks.json @@ -0,0 +1,700 @@ +[ + { + "name": "4meepo", + "linters": [ + "tagalign" + ], + "profile": "https://github.com/sponsors/4meepo", + "avatar": "https://github.com/4meepo.png" + }, + { + "name": "Abirdcfly", + "linters": [ + "dupword" + ], + "profile": "https://github.com/sponsors/Abirdcfly", + "avatar": "https://github.com/Abirdcfly.png" + }, + { + "name": "alecthomas", + "linters": [ + "gochecksumtype" + ], + "profile": "https://github.com/sponsors/alecthomas", + "avatar": "https://github.com/alecthomas.png" + }, + { + "name": "alexkohler", + "linters": [ + "dogsled", + "nakedret", + "prealloc" + ], + "profile": "https://github.com/sponsors/alexkohler", + "avatar": "https://github.com/alexkohler.png" + }, + { + "name": "alingse", + "linters": [ + "asasalint", + "nilnesserr" + ], + "profile": "https://github.com/sponsors/alingse", + "avatar": "https://github.com/alingse.png" + }, + { + "name": "AlwxSin", + "linters": [ + "noinlineerr" + ], + "profile": "https://github.com/sponsors/AlwxSin", + "avatar": "https://github.com/AlwxSin.png" + }, + { + "name": "Antonboom", + "linters": [ + "errname", + "nilnil", + "testifylint" + ], + "profile": "https://github.com/sponsors/Antonboom", + "avatar": "https://github.com/Antonboom.png" + }, + { + "name": "ashanbrown", + "linters": [ + "forbidigo", + "makezero" + ], + "profile": "https://github.com/sponsors/ashanbrown", + "avatar": "https://github.com/ashanbrown.png" + }, + { + "name": "bkielbasa", + "linters": [ + "cyclop" + ], + "profile": "https://github.com/sponsors/bkielbasa", + "avatar": "https://github.com/bkielbasa.png" + }, + { + "name": "blizzy78", + "linters": [ + "varnamelen" + ], + "profile": "https://github.com/sponsors/blizzy78", + "avatar": "https://github.com/blizzy78.png" + }, + { + "name": "bombsimon", + "linters": [ + "wsl", + "wsl_v5" + ], + "profile": "https://github.com/sponsors/bombsimon", + "avatar": "https://github.com/bombsimon.png" + }, + { + "name": "bosi", + "linters": [ + "decorder" + ], + "profile": "https://gitlab.com/bosi", + "avatar": "https://github.com/bosix.png" + }, + { + "name": "breml", + "linters": [ + "bidichk", + "errchkjson" + ], + "profile": "https://github.com/sponsors/breml", + "avatar": "https://github.com/breml.png" + }, + { + "name": "butuzov", + "linters": [ + "ireturn", + "mirror" + ], + "profile": "https://github.com/sponsors/butuzov", + "avatar": "https://github.com/butuzov.png" + }, + { + "name": "catenacyber", + "linters": [ + "perfsprint" + ], + "profile": "https://github.com/sponsors/catenacyber", + "avatar": "https://github.com/catenacyber.png" + }, + { + "name": "charithe", + "linters": [ + "durationcheck" + ], + "profile": "https://github.com/sponsors/charithe", + "avatar": "https://github.com/charithe.png" + }, + { + "name": "chokoswitch", + "linters": [ + "reassign" + ], + "profile": "https://github.com/sponsors/chokoswitch", + "avatar": "https://github.com/chokoswitch.png" + }, + { + "name": "ckaznocha", + "linters": [ + "intrange" + ], + "profile": "https://github.com/sponsors/ckaznocha", + "avatar": "https://github.com/ckaznocha.png" + }, + { + "name": "client9", + "linters": [ + "misspell" + ], + "profile": "https://github.com/sponsors/client9", + "avatar": "https://github.com/client9.png" + }, + { + "name": "Crocmagnon", + "linters": [ + "arangolint", + "fatcontext" + ], + "profile": "https://github.com/sponsors/Crocmagnon", + "avatar": "https://github.com/Crocmagnon.png" + }, + { + "name": "daixiang0", + "linters": [ + "gci" + ], + "profile": "https://github.com/sponsors/daixiang0", + "avatar": "https://github.com/daixiang0.png" + }, + { + "name": "denis-tingaikin", + "linters": [ + "goheader" + ], + "profile": "https://github.com/sponsors/denis-tingaikin", + "avatar": "https://github.com/denis-tingaikin.png" + }, + { + "name": "dixonwille", + "linters": [ + "depguard" + ], + "profile": "https://github.com/sponsors/dixonwille", + "avatar": "https://github.com/dixonwille.png" + }, + { + "name": "Djarvur", + "linters": [ + "err113" + ], + "profile": "https://github.com/sponsors/Djarvur", + "avatar": "https://github.com/Djarvur.png" + }, + { + "name": "dominikh", + "linters": [ + "staticcheck", + "unused" + ], + "profile": "https://github.com/sponsors/dominikh", + "avatar": "https://github.com/dominikh.png" + }, + { + "name": "firefart", + "linters": [ + "nonamedreturns" + ], + "profile": "https://github.com/sponsors/firefart", + "avatar": "https://github.com/firefart.png" + }, + { + "name": "fzipp", + "linters": [ + "gocyclo" + ], + "profile": "https://github.com/sponsors/fzipp", + "avatar": "https://github.com/fzipp.png" + }, + { + "name": "ghostiam", + "linters": [ + "protogetter" + ], + "profile": "https://github.com/sponsors/ghostiam", + "avatar": "https://github.com/ghostiam.png" + }, + { + "name": "go-critic", + "linters": [ + "gocritic" + ], + "profile": "https://github.com/sponsors/go-critic", + "avatar": "https://github.com/go-critic.png" + }, + { + "name": "golang", + "linters": [ + "gofmt", + "goimports", + "govet" + ], + "profile": "https://github.com/sponsors/golang", + "avatar": "https://github.com/golang.png" + }, + { + "name": "gordonklaus", + "linters": [ + "ineffassign" + ], + "profile": "https://github.com/sponsors/gordonklaus", + "avatar": "https://github.com/gordonklaus.png" + }, + { + "name": "jgautheron", + "linters": [ + "goconst" + ], + "profile": "https://github.com/sponsors/jgautheron", + "avatar": "https://github.com/jgautheron.png" + }, + { + "name": "jingyugao", + "linters": [ + "rowserrcheck" + ], + "profile": "https://github.com/sponsors/jingyugao", + "avatar": "https://github.com/jingyugao.png" + }, + { + "name": "jjti", + "linters": [ + "spancheck" + ], + "profile": "https://github.com/sponsors/jjti", + "avatar": "https://github.com/jjti.png" + }, + { + "name": "julz", + "linters": [ + "importas" + ], + "profile": "https://github.com/sponsors/julz", + "avatar": "https://github.com/julz.png" + }, + { + "name": "karamaru-alpha", + "linters": [ + "copyloopvar" + ], + "profile": "https://github.com/sponsors/karamaru-alpha", + "avatar": "https://github.com/karamaru-alpha.png" + }, + { + "name": "kisielk", + "linters": [ + "errcheck" + ], + "profile": "https://github.com/sponsors/kisielk", + "avatar": "https://github.com/kisielk.png" + }, + { + "name": "kkHAIKE", + "linters": [ + "contextcheck" + ], + "profile": "https://github.com/sponsors/kkHAIKE", + "avatar": "https://github.com/kkHAIKE.png" + }, + { + "name": "kulti", + "linters": [ + "thelper" + ], + "profile": "https://github.com/sponsors/kulti", + "avatar": "https://github.com/kulti.png" + }, + { + "name": "kunwardeep", + "linters": [ + "paralleltest" + ], + "profile": "https://github.com/sponsors/kunwardeep", + "avatar": "https://github.com/kunwardeep.png" + }, + { + "name": "lasiar", + "linters": [ + "canonicalheader" + ], + "profile": "https://github.com/sponsors/lasiar", + "avatar": "https://github.com/lasiar.png" + }, + { + "name": "ldez", + "linters": [ + "exptostd", + "gomoddirectives", + "tagliatelle", + "usetesting" + ], + "profile": "https://github.com/sponsors/ldez", + "avatar": "https://github.com/ldez.png" + }, + { + "name": "leighmcculloch", + "linters": [ + "gocheckcompilerdirectives", + "gochecknoglobals" + ], + "profile": "https://github.com/sponsors/leighmcculloch", + "avatar": "https://github.com/leighmcculloch.png" + }, + { + "name": "leonklingele", + "linters": [ + "grouper" + ], + "profile": "https://github.com/sponsors/leonklingele", + "avatar": "https://github.com/leonklingele.png" + }, + { + "name": "macabu", + "linters": [ + "inamedparam" + ], + "profile": "https://github.com/sponsors/macabu", + "avatar": "https://github.com/macabu.png" + }, + { + "name": "manuelarte", + "linters": [ + "embeddedstructfieldcheck", + "funcorder" + ], + "profile": "https://github.com/sponsors/manuelarte", + "avatar": "https://github.com/manuelarte.png" + }, + { + "name": "maratori", + "linters": [ + "testableexamples", + "testpackage" + ], + "profile": "https://github.com/sponsors/maratori", + "avatar": "https://github.com/maratori.png" + }, + { + "name": "matoous", + "linters": [ + "godox" + ], + "profile": "https://github.com/sponsors/matoous", + "avatar": "https://github.com/matoous.png" + }, + { + "name": "mdempsky", + "linters": [ + "unconvert" + ], + "profile": "https://github.com/sponsors/mdempsky", + "avatar": "https://github.com/mdempsky.png" + }, + { + "name": "mgechev", + "linters": [ + "revive" + ], + "profile": "https://github.com/sponsors/mgechev", + "avatar": "https://github.com/mgechev.png" + }, + { + "name": "mibk", + "linters": [ + "dupl" + ], + "profile": "https://github.com/sponsors/mibk", + "avatar": "https://github.com/mibk.png" + }, + { + "name": "moricho", + "linters": [ + "tparallel" + ], + "profile": "https://github.com/sponsors/moricho", + "avatar": "https://github.com/moricho.png" + }, + { + "name": "mvdan", + "linters": [ + "gofumpt", + "unparam" + ], + "profile": "https://github.com/sponsors/mvdan", + "avatar": "https://github.com/mvdan.png" + }, + { + "name": "nakabonne", + "linters": [ + "nestif" + ], + "profile": "https://github.com/sponsors/nakabonne", + "avatar": "https://github.com/nakabonne.png" + }, + { + "name": "nishanths", + "linters": [ + "exhaustive", + "predeclared" + ], + "profile": "https://github.com/sponsors/nishanths", + "avatar": "https://github.com/nishanths.png" + }, + { + "name": "nunnatsa", + "linters": [ + "ginkgolinter" + ], + "profile": "https://github.com/sponsors/nunnatsa", + "avatar": "https://github.com/nunnatsa.png" + }, + { + "name": "polyfloyd", + "linters": [ + "errorlint" + ], + "profile": "https://github.com/sponsors/polyfloyd", + "avatar": "https://github.com/polyfloyd.png" + }, + { + "name": "raeperd", + "linters": [ + "recvcheck" + ], + "profile": "https://github.com/sponsors/raeperd", + "avatar": "https://github.com/raeperd.png" + }, + { + "name": "ryancurrah", + "linters": [ + "gomodguard" + ], + "profile": "https://github.com/sponsors/ryancurrah", + "avatar": "https://github.com/ryancurrah.png" + }, + { + "name": "ryanrolds", + "linters": [ + "sqlclosecheck" + ], + "profile": "https://github.com/sponsors/ryanrolds", + "avatar": "https://github.com/ryanrolds.png" + }, + { + "name": "sanposhiho", + "linters": [ + "wastedassign" + ], + "profile": "https://github.com/sponsors/sanposhiho", + "avatar": "https://github.com/sanposhiho.png" + }, + { + "name": "sashamelentyev", + "linters": [ + "interfacebloat", + "usestdlibvars" + ], + "profile": "https://github.com/sponsors/sashamelentyev", + "avatar": "https://github.com/sashamelentyev.png" + }, + { + "name": "securego", + "linters": [ + "gosec" + ], + "profile": "https://github.com/sponsors/securego", + "avatar": "https://github.com/securego.png" + }, + { + "name": "segmentio", + "linters": [ + "golines" + ], + "profile": "https://github.com/sponsors/segmentio", + "avatar": "https://github.com/segmentio.png" + }, + { + "name": "sivchari", + "linters": [ + "containedctx" + ], + "profile": "https://github.com/sponsors/sivchari", + "avatar": "https://github.com/sivchari.png" + }, + { + "name": "sonatard", + "linters": [ + "noctx" + ], + "profile": "https://github.com/sponsors/sonatard", + "avatar": "https://github.com/sonatard.png" + }, + { + "name": "ssgreg", + "linters": [ + "nlreturn" + ], + "profile": "https://github.com/sponsors/ssgreg", + "avatar": "https://github.com/ssgreg.png" + }, + { + "name": "stbenjam", + "linters": [ + "nosprintfhostport" + ], + "profile": "https://github.com/sponsors/stbenjam", + "avatar": "https://github.com/stbenjam.png" + }, + { + "name": "swaggo", + "linters": [ + "swaggo" + ], + "profile": "https://github.com/sponsors/swaggo", + "avatar": "https://github.com/swaggo.png" + }, + { + "name": "tdakkota", + "linters": [ + "asciicheck" + ], + "profile": "https://github.com/sponsors/tdakkota", + "avatar": "https://github.com/tdakkota.png" + }, + { + "name": "tenntenn", + "linters": [ + "forcetypeassert", + "nilerr" + ], + "profile": "https://github.com/sponsors/tenntenn", + "avatar": "https://github.com/tenntenn.png" + }, + { + "name": "tetafro", + "linters": [ + "godot" + ], + "profile": "https://github.com/sponsors/tetafro", + "avatar": "https://github.com/tetafro.png" + }, + { + "name": "timakin", + "linters": [ + "bodyclose" + ], + "profile": "https://github.com/sponsors/timakin", + "avatar": "https://github.com/timakin.png" + }, + { + "name": "timonwong", + "linters": [ + "loggercheck" + ], + "profile": "https://github.com/sponsors/timonwong", + "avatar": "https://github.com/timonwong.png" + }, + { + "name": "tmzane", + "linters": [ + "musttag", + "sloglint" + ], + "profile": "https://github.com/sponsors/tmzane", + "avatar": "https://github.com/tmzane.png" + }, + { + "name": "tomarrell", + "linters": [ + "wrapcheck" + ], + "profile": "https://github.com/sponsors/tomarrell", + "avatar": "https://github.com/tomarrell.png" + }, + { + "name": "tommy-muehle", + "linters": [ + "mnd" + ], + "profile": "https://github.com/sponsors/tommy-muehle", + "avatar": "https://github.com/tommy-muehle.png" + }, + { + "name": "ultraware", + "linters": [ + "funlen", + "whitespace" + ], + "profile": "https://github.com/sponsors/ultraware", + "avatar": "https://github.com/ultraware.png" + }, + { + "name": "uudashr", + "linters": [ + "gocognit", + "iface" + ], + "profile": "https://github.com/sponsors/uudashr", + "avatar": "https://github.com/uudashr.png" + }, + { + "name": "xen0n", + "linters": [ + "gosmopolitan" + ], + "profile": "https://github.com/sponsors/xen0n", + "avatar": "https://github.com/xen0n.png" + }, + { + "name": "xobotyi", + "linters": [ + "exhaustruct" + ], + "profile": "https://github.com/sponsors/xobotyi", + "avatar": "https://github.com/xobotyi.png" + }, + { + "name": "yagipy", + "linters": [ + "maintidx" + ], + "profile": "https://github.com/sponsors/yagipy", + "avatar": "https://github.com/yagipy.png" + }, + { + "name": "yeya24", + "linters": [ + "promlinter" + ], + "profile": "https://github.com/sponsors/yeya24", + "avatar": "https://github.com/yeya24.png" + }, + { + "name": "ykadowak", + "linters": [ + "zerologlint" + ], + "profile": "https://github.com/sponsors/ykadowak", + "avatar": "https://github.com/ykadowak.png" + } +] diff --git a/docs/hugo.yaml b/docs/hugo.yaml index ba65b6c6d02a..4061c37b2f08 100644 --- a/docs/hugo.yaml +++ b/docs/hugo.yaml @@ -66,7 +66,7 @@ menu: icon: github sidebar: - identifier: donate - name: "Donate" + name: "Support Us" url: "https://donate.golangci.org" weight: 1 - identifier: more diff --git a/docs/layouts/_partials/author-cards.html b/docs/layouts/_partials/author-cards.html new file mode 100644 index 000000000000..aeb8c3c43dcb --- /dev/null +++ b/docs/layouts/_partials/author-cards.html @@ -0,0 +1,7 @@ +{{/* Modified version of https://github.com/imfing/hextra/blob/v0.9.7/layouts/partials/shortcodes/cards.html */}} +{{- $cols := .cols | default 3 -}} +{{- $content := .content -}} + +
+ {{- $content -}} +
diff --git a/docs/layouts/_partials/clickable-badge.html b/docs/layouts/_partials/clickable-badge.html new file mode 100644 index 000000000000..35891580d592 --- /dev/null +++ b/docs/layouts/_partials/clickable-badge.html @@ -0,0 +1,39 @@ +{{- /* Modified version of https://github.com/imfing/hextra/blob/v0.9.7/layouts/partials/shortcodes/badge.html */ -}} +{{- /* +Creates a badge with the given id and class. + +@param {string} content The content of the badge. +@param {string} type The type of the badge. +@param {string} id The id of the badge. +@param {string} class The class of the badge. +@param {boolean} border Whether to render a border around the badge. +@param {string} icon The icon of the badge. + +*/ -}} + +{{- $content := .content -}} +{{- $type := .type -}} +{{- $id := .id | default "" -}} +{{- $class := .class | default "" -}} +{{- $border := .border | default false -}} +{{- $icon := .icon | default "" -}} + +{{- $defaultClass := "hx-text-gray-600 hx-bg-gray-100 dark:hx-bg-neutral-800 dark:hx-text-neutral-200 hx-border-gray-200 dark:hx-border-neutral-700" -}} + +{{- $styleClass := newScratch -}} +{{- $styleClass.Set "info" "hx-border-blue-200 hx-bg-blue-100 hx-text-blue-900 dark:hx-border-blue-200/30 dark:hx-bg-blue-900/30 dark:hx-text-blue-200" -}} +{{- $styleClass.Set "warning" "hx-border-yellow-100 hx-bg-yellow-50 hx-text-yellow-900 dark:hx-border-yellow-200/30 dark:hx-bg-yellow-700/30 dark:hx-text-yellow-200" -}} +{{- $styleClass.Set "error" "hx-border-red-200 hx-bg-red-100 hx-text-red-900 dark:hx-border-red-200/30 dark:hx-bg-red-900/30 dark:hx-text-red-200" -}} +{{- $styleClass.Set "green" "hx-border-green-200 hx-bg-green-100 hx-text-green-900 dark:hx-border-green-200/30 dark:hx-bg-green-900/30 dark:hx-text-green-200" -}} +{{- $styleClass.Set "indigo" "hx-border-indigo-200 hx-bg-indigo-100 hx-text-indigo-900 dark:hx-border-indigo-200/30 dark:hx-bg-indigo-900/30 dark:hx-text-indigo-200" -}} +{{- $styleClass.Set "amber" "hx-border-amber-200 hx-bg-amber-100 hx-text-amber-900 dark:hx-border-amber-200/30 dark:hx-bg-amber-900/30 dark:hx-text-amber-200" -}} + +{{- $borderClass := cond (eq $border true) "hx-border" "" -}} +{{- $badgeClass := or ($styleClass.Get $type) $defaultClass -}} +
+
+ {{- with $icon -}}{{- partial "utils/icon" (dict "name" . "attributes" "height=12") -}}{{- end -}} + {{- $content -}} +
+
+{{- /* Strip trailing newline. */ -}} diff --git a/docs/layouts/_partials/compare-versions.html b/docs/layouts/_partials/compare-versions.html new file mode 100644 index 000000000000..45cad4ce14d5 --- /dev/null +++ b/docs/layouts/_partials/compare-versions.html @@ -0,0 +1,14 @@ +{{- /* +Compares two versions. + +@param {string} a Version A +@param {string} b Version B +@returns {boolean} + +@example {{ partial "compare-versions.html" (dict "a" "v1.2.3" "b" "v1.2.4") }} +*/ -}} + +{{- $aVersion := path.Dir (replace .a "." "/") -}} +{{- $bVersion := path.Dir (replace .b "." "/") -}} + +{{- return (eq $aVersion $bVersion) -}} diff --git a/docs/layouts/_partials/custom/head-end.html b/docs/layouts/_partials/custom/head-end.html index 25875e2287b0..59ab5ccbbd4c 100644 --- a/docs/layouts/_partials/custom/head-end.html +++ b/docs/layouts/_partials/custom/head-end.html @@ -4,3 +4,67 @@ quicklink.listen(); }); + diff --git a/docs/layouts/_partials/format-description.html b/docs/layouts/_partials/format-description.html new file mode 100644 index 000000000000..8a661a0003d0 --- /dev/null +++ b/docs/layouts/_partials/format-description.html @@ -0,0 +1,15 @@ +{{- /* +Formats a item (linter/formatter) description. + +@param {string} (positional parameter 0) Description +@returns {string} + +@example {{ partial "format-description" "message" }} +*/ -}} + +{{- $desc := . -}} +{{- $desc = strings.FirstUpper $desc -}} +{{- if not (hasSuffix $desc ".") -}} + {{- $desc = print $desc "." -}} +{{- end -}} +{{- return $desc -}} diff --git a/docs/layouts/_partials/item-tag.html b/docs/layouts/_partials/item-tag.html new file mode 100644 index 000000000000..93dc2ee40b21 --- /dev/null +++ b/docs/layouts/_partials/item-tag.html @@ -0,0 +1,32 @@ +{{- /* +Creates tag information for an item (linter/formatter). + +@param {string} (positional parameter 0) Description +@returns {map[tag: string, tagType: string]} + +@example {{ partial "item-tag.html" (dict "gcilVersion" "v1.2.3" "item" .) }} +*/ -}} + +{{- $gcilVersion := .gcilVersion -}} +{{- $item := .item -}} + +{{- $tag := newScratch -}} + +{{- if $item.deprecation -}} + {{- $replacement := "" -}} + {{- if $item.deprecation.replacement -}} + {{- $replacement = print " Use `" $item.deprecation.replacement "` instead." -}} + {{- end -}} + + {{- $tag.SetInMap "options" "subtitle" (print (strings.FirstUpper $item.deprecation.message) $replacement) -}} + {{- $tag.SetInMap "options" "tag" (print "Deprecated since " $item.deprecation.since) -}} + {{- $tag.SetInMap "options" "tagType" "error" -}} +{{- else if (partial "compare-versions.html" (dict "a" $gcilVersion "b" $item.since)) -}} + {{- $tag.SetInMap "options" "tag" "New" -}} + {{- $tag.SetInMap "options" "tagType" "warning" -}} +{{- else if $item.canAutoFix -}} + {{- $tag.SetInMap "options" "tag" "Autofix" -}} + {{- $tag.SetInMap "options" "tagType" "info" -}} +{{- end -}} + +{{- return ($tag.Get "options") -}} diff --git a/docs/layouts/_partials/utils/fragments.html b/docs/layouts/_partials/utils/fragments.html new file mode 100644 index 000000000000..b47e59752b4c --- /dev/null +++ b/docs/layouts/_partials/utils/fragments.html @@ -0,0 +1,63 @@ +{{/* Copy from https://github.com/imfing/hextra/blob/v0.9.7/layouts/partials/utils/fragments.html */}} +{{/* Split page raw content into fragments */}} +{{ $page := .context }} +{{ $type := .type | default "content" }} + +{{ $headingKeys := slice }} +{{ $headingTitles := slice }} + +{{ range $h1 := $page.Fragments.Headings }} + {{ if eq $h1.Title "" }} + {{ $headingKeys = $headingKeys | append $h1.Title }} + {{ else }} + {{ $headingKeys = $headingKeys | append (printf "%s#%s" $h1.ID $h1.Title) }} + {{ end }} + {{ $headingTitles = $headingTitles | append (printf "

%s" $h1.Title) }} + + {{ range $h2 := $h1.Headings }} + {{ $headingKeys = $headingKeys | append (printf "%s#%s" $h2.ID $h2.Title) }} + {{ $headingTitles = $headingTitles | append (printf "

%s" $h2.Title) }} + {{ end }} +{{ end }} + +{{ $content := $page.Content | htmlUnescape }} +{{ $len := len $headingKeys }} +{{ $data := dict }} + +{{ if eq $type "content" }} + {{/* Include full content of the page */}} + {{ if eq $len 0 }} + {{ $data = $data | merge (dict "" ($page.Plain | htmlUnescape | chomp)) }} + {{ else }} + {{/* Split the raw content from bottom to top */}} + {{ range seq $len }} + {{ $i := sub $len . }} + {{ $headingKey := index $headingKeys $i }} + {{ $headingTitle := index $headingTitles $i }} + + {{ if eq $i 0 }} + {{ $data = $data | merge (dict $headingKey ($content | plainify | htmlUnescape | chomp)) }} + {{ else }} + {{ $parts := split $content (printf "%s" $headingTitle) }} + {{ $lastPart := index $parts (sub (len $parts) 1) }} + + {{ $data = $data | merge (dict $headingKey ($lastPart | plainify | htmlUnescape | chomp)) }} + {{ $content = strings.TrimSuffix $lastPart $content }} + {{ $content = strings.TrimSuffix (printf "%s" $headingTitle) $content }} + {{ end }} + {{ end }} + {{ end }} +{{ else if (eq $type "heading" ) }} + {{/* Put heading keys with empty content to the data object */}} + {{ $data = dict "" "" }} + {{ range $headingKeys }} + {{ $data = $data | merge (dict . "") }} + {{ end }} +{{ else if (eq $type "title") }} + {{/* Use empty data object since title is included in search-data.json */}} + {{ $data = $data | merge (dict "" "") }} +{{ else if (eq $type "summary" ) }} + {{ $data = $data | merge (dict "" ($page.Summary | plainify | htmlUnescape | chomp)) }} +{{ end }} + +{{ return $data }} diff --git a/docs/layouts/_shortcodes/author-cards.html b/docs/layouts/_shortcodes/author-cards.html new file mode 100644 index 000000000000..49003a8786d0 --- /dev/null +++ b/docs/layouts/_shortcodes/author-cards.html @@ -0,0 +1,10 @@ +{{- /* Modified version of https://github.com/imfing/hextra/blob/v0.9.7/layouts/shortcodes/cards.html */ -}} +{{- /* +Creates a card for each author of a linter/formatter. + +@example {{< author-cards cols=7 >}}{{< authors >}}{{< /author-cards >}} +*/ -}} + +{{- $cols := .Get "cols" | default 3 -}} + +{{- partial "author-cards" (dict "cols" $cols "content" .Inner) -}} diff --git a/docs/layouts/_shortcodes/authors.html b/docs/layouts/_shortcodes/authors.html new file mode 100644 index 000000000000..b907a279ab18 --- /dev/null +++ b/docs/layouts/_shortcodes/authors.html @@ -0,0 +1,23 @@ +{{- /* +Creates a card for each author of a linter/formatter. + +@example {{< authors >}} +*/ -}} + +{{- $thanks := index $.Site.Data.thanks -}} +{{- range $thanks }} + +{{ $v := slice }} +{{- range .linters -}} +{{- $v = $v | append (printf "%s" .) -}} +{{- end -}} + +{{- partial "shortcodes/card" (dict + "page" .Page + "link" .profile + "title" .name + "subtitle" (delimit $v "
") + "image" .avatar + ) +-}} +{{- end -}} diff --git a/docs/layouts/_shortcodes/cli-output.html b/docs/layouts/_shortcodes/cli-output.html new file mode 100644 index 000000000000..33515b267588 --- /dev/null +++ b/docs/layouts/_shortcodes/cli-output.html @@ -0,0 +1,29 @@ +{{- /* +Creates a code block with the output of the CLI. + +@param {string} cmd The name of the command. +@param {string} section The name of the section inside the data file. + +@example {{% cli-output %}} +@example {{% cli-output cmd="foo" %}} +@example {{% cli-output section="sectionName" cmd="foo bar" %}} +*/ -}} + +{{- $cmdName := .Get "cmd" -}} +{{- $section := .Get "section" -}} + +{{- $cliData := index $.Site.Data.cli_help -}} + +```console +{{ if $section -}} + +$ golangci-lint {{ $cmdName }} + +{{- else -}} + {{- $section = print (or $cmdName "root") "Output" -}} + +$ golangci-lint{{ if $cmdName }} {{ $cmdName }}{{ end }} -h + +{{- end }} +{{ index $cliData $section | safeHTML }} +``` diff --git a/docs/layouts/_shortcodes/clickable-badge.html b/docs/layouts/_shortcodes/clickable-badge.html new file mode 100644 index 000000000000..a5be98df730d --- /dev/null +++ b/docs/layouts/_shortcodes/clickable-badge.html @@ -0,0 +1,30 @@ +{{- /* Modified version of https://github.com/imfing/hextra/blob/v0.9.7/layouts/shortcodes/badge.html */ -}} +{{- /* +Creates a badge with the given id and class. + +@param {string} content The content of the badge. +@param {string} type The type of the badge. +@param {string} id The id of the badge. +@param {string} class The class of the badge. +@param {boolean} border Whether to render a border around the badge. +@param {string} icon The icon of the badge. + +@example {{< clickable-badge icon="inbox" id="my-id" content="Text" class="my-class" type="info" border=true >}} +*/}} + +{{- $content := .Get "content" -}} +{{- $type := .Get "type" | default "" -}} +{{- $id := .Get "id" | default "" -}} +{{- $class := .Get "class" | default "" -}} +{{- $icon := .Get "icon" | default "" -}} +{{- $border := .Get "border" | default false -}} + +{{- partial "clickable-badge.html" (dict + "id" $id + "class" $class + "content" $content + "type" $type + "border" $border + "icon" $icon + ) +-}} diff --git a/docs/layouts/_shortcodes/configuration-file-snippet.html b/docs/layouts/_shortcodes/configuration-file-snippet.html new file mode 100644 index 000000000000..f70c521a9939 --- /dev/null +++ b/docs/layouts/_shortcodes/configuration-file-snippet.html @@ -0,0 +1,16 @@ +{{- /* +Creates a code block with the contents of a configuration file section. + +@param {string} section The name of the section inside the data file. +@returns {string} + +@example {{% configuration-file-snippet section="sectionName" %}} +*/ -}} + +{{- $sectionName := .Get "section" -}} + +{{- $file := index $.Site.Data.configuration_file -}} + +```yaml +{{ index $file $sectionName | safeHTML }} +``` diff --git a/docs/layouts/_shortcodes/embed.html b/docs/layouts/_shortcodes/embed.html new file mode 100644 index 000000000000..70e3c5efa4c6 --- /dev/null +++ b/docs/layouts/_shortcodes/embed.html @@ -0,0 +1,12 @@ +{{- /* +Embeds a file. + +@param {string} file The path to the file. +@returns {string} + +@example {{% embed file="path/to/file.txt" %}} +*/ -}} + +{{- $file := .Get "file" -}} + +{{ readFile $file | safeHTML}} diff --git a/docs/layouts/_shortcodes/exclusion-presets.html b/docs/layouts/_shortcodes/exclusion-presets.html new file mode 100644 index 000000000000..9cd5029defec --- /dev/null +++ b/docs/layouts/_shortcodes/exclusion-presets.html @@ -0,0 +1,28 @@ +{{- /* +Creates a table of exclusion presets. + +@example {{% exclusion-presets %}} +*/ -}} + +{{- $presets := index $.Site.Data.exclusion_presets -}} + +{{ range $key, $values := $presets }} +### Preset {{ print "`" $key "`" }} + + + + + + + + + + {{- range $i, $value := $values -}} + + + + + {{- end -}} + +
LinterIssue Text
{{ index $value "linters" 0 }}{{ index $value "text" }}
+{{ end }} diff --git a/docs/layouts/_shortcodes/item-cards.html b/docs/layouts/_shortcodes/item-cards.html new file mode 100644 index 000000000000..9d34c3002b7f --- /dev/null +++ b/docs/layouts/_shortcodes/item-cards.html @@ -0,0 +1,87 @@ +{{- /* +Creates a card for each item (linter/formatter) in a data file. + +@param {string} data The name of the data file. +@param {string} path The path to the data file. +@param {string} group The group to filter items by (use the prefix `!` to exclude items from the group). +@returns {string} + +@example {{< item-cards path="formatters" data="formatters_info" >}} +@example {{< item-cards path="linters" data="linters_info" group="!standard" >}} +*/ -}} + +{{- $file := .Get "data" -}} +{{- $path := .Get "path" -}} +{{- $group := .Get "group" | default "" -}} + +{{- $info := index $.Site.Data $file -}} + +{{- /* Determine if we should exclude items from the group */ -}} +{{- $notInGroup := hasPrefix $group "!" -}} +{{- if $notInGroup -}} + {{- $group = strings.TrimPrefix "!" $group -}} +{{- end -}} + +{{- /* Filter items by group */ -}} +{{ $items := slice }} +{{- range sort $info "name" -}} + {{- if $group -}} + {{- if in .groups $group -}} + {{- if not $notInGroup -}} + {{- $items = $items | append . -}} + {{- end -}} + {{- else -}} + {{- if $notInGroup -}} + {{- $items = $items | append . -}} + {{- end -}} + {{- end -}} + {{- else -}} + {{- $items = $items | append . -}} + {{- end -}} +{{- end -}} + +{{- $gcilVersion := index $.Site.Data.version.version -}} + +{{- /* Create cards */ -}} +{{- range $items -}} + {{- if .internal -}} + {{- continue -}} + {{- end -}} + + {{- $s := newScratch -}} + {{- $s.SetInMap "options" "page" .Page -}} + {{- $s.SetInMap "options" "link" (print "/docs/" $path "/configuration/#" .name) -}} + {{- $s.SetInMap "options" "title" .name -}} + {{- $s.SetInMap "options" "subtitle" (partial "format-description" .desc) -}} + + {{- /* Create tag information */ -}} + {{- $tagOptions := partial "item-tag.html" (dict "gcilVersion" $gcilVersion "item" .) -}} + {{- range $k, $v := $tagOptions -}} + {{- $s.SetInMap "options" $k $v -}} + {{- end -}} + + {{- /* CSS classes */ -}} + {{- $class := slice "gl-item" -}} + {{- if .canAutoFix -}} + {{- $class = $class | append "gl-autofix" -}} + {{- end -}} + {{- if .deprecation -}} + {{- $class = $class | append "gl-deprecated" -}} + {{- end -}} + {{- if .isSlow -}} + {{- $class = $class | append "gl-slow" -}} + {{- else -}} + {{- $class = $class | append "gl-fast" -}} + {{- end -}} + {{- if in .groups "standard" -}} + {{- $class = $class | append "gl-default" -}} + {{- end -}} + {{- if (partial "compare-versions.html" (dict "a" $gcilVersion "b" .since)) -}} + {{- $class = $class | append "gl-new" -}} + {{- end -}} + +
+ {{- partial "shortcodes/card" ($s.Get "options") -}} +
+ +{{- end -}} diff --git a/docs/layouts/_shortcodes/item-settings.html b/docs/layouts/_shortcodes/item-settings.html new file mode 100644 index 000000000000..abf5502066a3 --- /dev/null +++ b/docs/layouts/_shortcodes/item-settings.html @@ -0,0 +1,92 @@ +{{- /* +Creates a section for each setting of a linter/formatter. + +@param {string} info The name of the data file containing the linter/formatter information. +@param {string} settings The name of the data file containing the linter/formatter settings. + +@example {{% item-settings info="formatters_info" settings="formatter_settings" %}} +*/ -}} + +{{- $fileInfo := .Get "info" -}} +{{- $fileSettings := .Get "settings" -}} + +{{- $gcilVersion := index $.Site.Data.version.version -}} +{{- $info := index $.Site.Data $fileInfo -}} +{{- $settings := index $.Site.Data $fileSettings -}} + +{{- range sort $info "name" -}} +{{- if .internal -}} + {{- continue -}} +{{- end -}} + +## {{ .name }} + +{{/* Description */}} +{{ if .deprecation -}} +{{- $replacement := "" -}} +{{- if .deprecation.replacement -}} +{{- $replacement = print " Use `" .deprecation.replacement "` instead." -}} +{{- end -}} +{{ print (partial "format-description" .deprecation.message) $replacement }} +{{ else }} +{{ partial "format-description" .desc }} +{{ end }} + +{{/* Badges */}} +

+{{ partial "shortcodes/badge.html" (dict + "border" true + "icon" "calendar" + "content" (print "Since golangci-lint " .since) + ) +}} +{{ if .deprecation -}} +{{ partial "shortcodes/badge.html" (dict + "border" true + "icon" "sparkles" + "content" (print "Deprecated since " .deprecation.since) + "type" "error" + ) + }} +{{ else }} + {{ if (partial "compare-versions.html" (dict "a" $gcilVersion "b" .since)) }} +{{ partial "shortcodes/badge.html" (dict + "border" true + "icon" "sparkles" + "content" "New" + "type" "warning" + ) +}} + {{ end }} + {{ if .canAutoFix }} +{{ partial "shortcodes/badge.html" (dict + "border" true + "icon" "sparkles" + "content" "Autofix" + "type" "info" + ) +}} + {{ end }} +{{ end }} + +{{ partial "shortcodes/badge.html" (dict + "border" true + "icon" "github" + "content" "Repository" + "link" .originalURL + ) +}} + +

+ +{{/* Settings */}} +{{- $setting := index $settings .name -}} +{{- if $setting -}} +```yaml +{{ $setting | safeHTML}} +``` +{{- else -}} +_No settings available._ +{{- end }} + +{{ end -}} diff --git a/docs/layouts/_shortcodes/latest-version.html b/docs/layouts/_shortcodes/latest-version.html new file mode 100644 index 000000000000..fc8807b9a987 --- /dev/null +++ b/docs/layouts/_shortcodes/latest-version.html @@ -0,0 +1,8 @@ +{{- /* +Displays the latest version of golangci-lint. +Based on the data file `data/version.json`. + +@example {{< latest-version >}} +*/ -}} + +{{- index $.Site.Data.version.version | default .Page.GitInfo.AbbreviatedHash | default "devel" -}} diff --git a/docs/static/images/colored-line-number.png b/docs/static/images/colored-line-number.png index e972c23d3434..4de85d610b6e 100644 Binary files a/docs/static/images/colored-line-number.png and b/docs/static/images/colored-line-number.png differ diff --git a/pkg/commands/cache.go b/pkg/commands/cache.go index 13e895057358..9772841c9435 100644 --- a/pkg/commands/cache.go +++ b/pkg/commands/cache.go @@ -21,7 +21,7 @@ func newCacheCommand() *cacheCommand { cacheCmd := &cobra.Command{ Use: "cache", - Short: "Cache control and information", + Short: "Cache control and information.", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) error { return cmd.Help() diff --git a/pkg/commands/config.go b/pkg/commands/config.go index 6628aa427b05..b1889fa42667 100644 --- a/pkg/commands/config.go +++ b/pkg/commands/config.go @@ -42,7 +42,7 @@ func newConfigCommand(log logutils.Log, info BuildInfo) *configCommand { configCmd := &cobra.Command{ Use: "config", - Short: "Config file information", + Short: "Configuration file information and verification.", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) error { return cmd.Help() @@ -52,7 +52,7 @@ func newConfigCommand(log logutils.Log, info BuildInfo) *configCommand { verifyCommand := &cobra.Command{ Use: "verify", - Short: "Verify configuration against JSON schema", + Short: "Verify configuration against JSON schema.", Args: cobra.NoArgs, ValidArgsFunction: cobra.NoFileCompletions, RunE: c.executeVerify, @@ -62,7 +62,7 @@ func newConfigCommand(log logutils.Log, info BuildInfo) *configCommand { pathCommand := &cobra.Command{ Use: "path", - Short: "Print used config path", + Short: "Print used configuration path.", Args: cobra.NoArgs, ValidArgsFunction: cobra.NoFileCompletions, RunE: c.executePath, diff --git a/pkg/commands/custom.go b/pkg/commands/custom.go index a53197ce3457..227df9bee104 100644 --- a/pkg/commands/custom.go +++ b/pkg/commands/custom.go @@ -26,7 +26,7 @@ func newCustomCommand(logger logutils.Log) *customCommand { customCmd := &cobra.Command{ Use: "custom", - Short: "Build a version of golangci-lint with custom linters", + Short: "Build a version of golangci-lint with custom linters.", Args: cobra.NoArgs, PreRunE: c.preRunE, RunE: c.runE, diff --git a/pkg/commands/fmt.go b/pkg/commands/fmt.go index c1ba8716612f..3292af3e9e5a 100644 --- a/pkg/commands/fmt.go +++ b/pkg/commands/fmt.go @@ -50,7 +50,7 @@ func newFmtCommand(logger logutils.Log, info BuildInfo) *fmtCommand { fmtCmd := &cobra.Command{ Use: "fmt", - Short: "Format Go source files", + Short: "Format Go source files.", RunE: c.execute, PreRunE: c.preRunE, PersistentPreRunE: c.persistentPreRunE, diff --git a/pkg/commands/formatters.go b/pkg/commands/formatters.go index 22a9914ae2ff..bd6e0e80fc51 100644 --- a/pkg/commands/formatters.go +++ b/pkg/commands/formatters.go @@ -47,7 +47,7 @@ func newFormattersCommand(logger logutils.Log) *formattersCommand { formattersCmd := &cobra.Command{ Use: "formatters", - Short: "List current formatters configuration", + Short: "List current formatters configuration.", Args: cobra.NoArgs, ValidArgsFunction: cobra.NoFileCompletions, RunE: c.execute, diff --git a/pkg/commands/help.go b/pkg/commands/help.go index bb5696e7c944..6e9393ddd344 100644 --- a/pkg/commands/help.go +++ b/pkg/commands/help.go @@ -31,7 +31,7 @@ func newHelpCommand(logger logutils.Log) *helpCommand { helpCmd := &cobra.Command{ Use: "help", - Short: "Help", + Short: "Display extra help", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) error { return cmd.Help() @@ -40,7 +40,7 @@ func newHelpCommand(logger logutils.Log) *helpCommand { lintersCmd := &cobra.Command{ Use: "linters", - Short: "Help about linters", + Short: "Display help for linters.", Args: cobra.NoArgs, ValidArgsFunction: cobra.NoFileCompletions, RunE: c.lintersExecute, @@ -56,7 +56,7 @@ func newHelpCommand(logger logutils.Log) *helpCommand { formattersCmd := &cobra.Command{ Use: "formatters", - Short: "Help about formatters", + Short: "Display help for formatters.", Args: cobra.NoArgs, ValidArgsFunction: cobra.NoFileCompletions, RunE: c.formattersExecute, diff --git a/pkg/commands/linters.go b/pkg/commands/linters.go index 40036bb8567f..4be11ab567ca 100644 --- a/pkg/commands/linters.go +++ b/pkg/commands/linters.go @@ -47,7 +47,7 @@ func newLintersCommand(logger logutils.Log) *lintersCommand { lintersCmd := &cobra.Command{ Use: "linters", - Short: "List current linters configuration", + Short: "List current linters configuration.", Args: cobra.NoArgs, ValidArgsFunction: cobra.NoFileCompletions, RunE: c.execute, diff --git a/pkg/commands/migrate.go b/pkg/commands/migrate.go index cb4b50f6ec49..7012e9226e51 100644 --- a/pkg/commands/migrate.go +++ b/pkg/commands/migrate.go @@ -51,7 +51,7 @@ func newMigrateCommand(log logutils.Log, info BuildInfo) *migrateCommand { migrateCmd := &cobra.Command{ Use: "migrate", - Short: "Migrate configuration file from v1 to v2", + Short: "Migrate configuration file from v1 to v2.", SilenceUsage: true, SilenceErrors: true, Args: cobra.NoArgs, diff --git a/pkg/commands/run.go b/pkg/commands/run.go index 8ff8a674c7d1..d1c96b88eec0 100644 --- a/pkg/commands/run.go +++ b/pkg/commands/run.go @@ -111,7 +111,7 @@ func newRunCommand(logger logutils.Log, info BuildInfo) *runCommand { runCmd := &cobra.Command{ Use: "run", - Short: "Run the linters", + Short: "Lint the code.", Run: c.execute, PreRunE: c.preRunE, PostRun: c.postRun, diff --git a/pkg/commands/version.go b/pkg/commands/version.go index 2bcb12f471df..c8057a86c1f7 100644 --- a/pkg/commands/version.go +++ b/pkg/commands/version.go @@ -42,7 +42,7 @@ func newVersionCommand(info BuildInfo) *versionCommand { versionCmd := &cobra.Command{ Use: "version", - Short: "Version", + Short: "Display the golangci-lint version.", Args: cobra.NoArgs, ValidArgsFunction: cobra.NoFileCompletions, RunE: c.execute, diff --git a/scripts/website/dump_info/cmd_help.go b/scripts/website/dump_info/cmd_help.go new file mode 100644 index 000000000000..fbda4436bfb5 --- /dev/null +++ b/scripts/website/dump_info/cmd_help.go @@ -0,0 +1,107 @@ +package main + +import ( + "bytes" + "context" + "fmt" + "os" + "os/exec" + "slices" + + "github.com/golangci/golangci-lint/v2/scripts/website/types" +) + +func saveCLIHelp(ctx context.Context, dst string) error { + err := exec.CommandContext(ctx, "make", "build").Run() + if err != nil { + return fmt.Errorf("can't run make build: %w", err) + } + + lintersOut, err := exec.CommandContext(ctx, "./golangci-lint", "help", "linters").Output() + if err != nil { + return fmt.Errorf("can't run linters cmd: %w", err) + } + + lintersOutParts := bytes.Split(lintersOut, []byte("\n\n")) + + data := types.CLIHelp{ + Enable: string(lintersOutParts[0]), + } + + data.RootCmdHelp, err = getCmdHelp(ctx) + if err != nil { + return err + } + + data.RunCmdHelp, err = getCmdHelp(ctx, "run") + if err != nil { + return err + } + + data.LintersCmdHelp, err = getCmdHelp(ctx, "linters") + if err != nil { + return err + } + + data.FmtCmdHelp, err = getCmdHelp(ctx, "fmt") + if err != nil { + return err + } + + data.FormattersCmdHelp, err = getCmdHelp(ctx, "formatters") + if err != nil { + return err + } + + data.HelpCmdHelp, err = getCmdHelp(ctx, "help") + if err != nil { + return err + } + + data.ConfigCmdHelp, err = getCmdHelp(ctx, "config") + if err != nil { + return err + } + + data.MigrateCmdHelp, err = getCmdHelp(ctx, "migrate") + if err != nil { + return err + } + + data.CustomCmdHelp, err = getCmdHelp(ctx, "custom") + if err != nil { + return err + } + + data.CacheCmdHelp, err = getCmdHelp(ctx, "cache") + if err != nil { + return err + } + + data.VersionCmdHelp, err = getCmdHelp(ctx, "version") + if err != nil { + return err + } + + data.CompletionCmdHelp, err = getCmdHelp(ctx, "completion") + if err != nil { + return err + } + + return saveToJSONFile(dst, data) +} + +func getCmdHelp(ctx context.Context, names ...string) (string, error) { + args := slices.Clone(names) + args = append(args, "--help") + + helpCmd := exec.CommandContext(ctx, "./golangci-lint", args...) + helpCmd.Env = append(helpCmd.Env, os.Environ()...) + + help, err := helpCmd.Output() + if err != nil { + return "", fmt.Errorf("can't run help cmd: %w", err) + } + + return string(help), nil +} diff --git a/scripts/website/dump_info/default_exclusions.go b/scripts/website/dump_info/default_exclusions.go new file mode 100644 index 000000000000..8a78a3891a81 --- /dev/null +++ b/scripts/website/dump_info/default_exclusions.go @@ -0,0 +1,24 @@ +package main + +import ( + "github.com/golangci/golangci-lint/v2/pkg/result/processors" + "github.com/golangci/golangci-lint/v2/scripts/website/types" +) + +func saveDefaultExclusions(dst string) error { + data := make(map[string][]types.ExcludeRule) + + for name, rules := range processors.LinterExclusionPresets { + for _, rule := range rules { + data[name] = append(data[name], types.ExcludeRule{ + Linters: rule.Linters, + Path: rule.Path, + PathExcept: rule.PathExcept, + Text: rule.Text, + Source: rule.Source, + }) + } + } + + return saveToJSONFile(dst, data) +} diff --git a/scripts/website/dump_info/formatters.go b/scripts/website/dump_info/formatters.go new file mode 100644 index 000000000000..6378de034a1e --- /dev/null +++ b/scripts/website/dump_info/formatters.go @@ -0,0 +1,53 @@ +package main + +import ( + "maps" + "slices" + + "github.com/golangci/golangci-lint/v2/pkg/config" + "github.com/golangci/golangci-lint/v2/pkg/goformatters" + "github.com/golangci/golangci-lint/v2/pkg/lint/linter" + "github.com/golangci/golangci-lint/v2/pkg/lint/lintersdb" + "github.com/golangci/golangci-lint/v2/scripts/website/types" +) + +func saveFormatters(dst string) 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: slices.AppendSeq(make([]string, 0, len(l.Groups)), maps.Keys(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(dst, wraps) +} diff --git a/scripts/website/dump_info/linters.go b/scripts/website/dump_info/linters.go new file mode 100644 index 000000000000..31f766d49f32 --- /dev/null +++ b/scripts/website/dump_info/linters.go @@ -0,0 +1,53 @@ +package main + +import ( + "maps" + "slices" + + "github.com/golangci/golangci-lint/v2/pkg/config" + "github.com/golangci/golangci-lint/v2/pkg/goformatters" + "github.com/golangci/golangci-lint/v2/pkg/lint/linter" + "github.com/golangci/golangci-lint/v2/pkg/lint/lintersdb" + "github.com/golangci/golangci-lint/v2/scripts/website/types" +) + +func saveLinters(dst string) 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: slices.AppendSeq(make([]string, 0, len(l.Groups)), maps.Keys(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(dst, wraps) +} diff --git a/scripts/website/dump_info/main.go b/scripts/website/dump_info/main.go index a400ff41ce7e..49ba745ded17 100644 --- a/scripts/website/dump_info/main.go +++ b/scripts/website/dump_info/main.go @@ -1,242 +1,41 @@ package main import ( - "bytes" "context" "encoding/json" "fmt" "log" "os" - "os/exec" "path/filepath" - "slices" - - "github.com/golangci/golangci-lint/v2/pkg/config" - "github.com/golangci/golangci-lint/v2/pkg/goformatters" - "github.com/golangci/golangci-lint/v2/pkg/lint/linter" - "github.com/golangci/golangci-lint/v2/pkg/lint/lintersdb" - "github.com/golangci/golangci-lint/v2/pkg/result/processors" - "github.com/golangci/golangci-lint/v2/scripts/website/types" ) func main() { - err := saveLinters() + dataDir := filepath.Join("docs", "data") + + err := saveLinters(filepath.Join(dataDir, "linters_info.json")) if err != nil { log.Fatalf("Save linters: %v", err) } - err = saveFormatters() + err = saveFormatters(filepath.Join(dataDir, "formatters_info.json")) if err != nil { log.Fatalf("Save formatters: %v", err) } - err = saveDefaultExclusions() + err = saveDefaultExclusions(filepath.Join(dataDir, "exclusion_presets.json")) if err != nil { log.Fatalf("Save default exclusions: %v", err) } - err = saveCLIHelp(context.Background(), filepath.Join("assets", "cli-help.json")) + err = saveCLIHelp(context.Background(), filepath.Join(dataDir, "cli_help.json")) if err != nil { log.Fatalf("Save CLI help: %v", err) } -} - -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()) - - 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", "linters-info.json"), wraps) -} - -func saveDefaultExclusions() error { - data := make(map[string][]types.ExcludeRule) - - for name, rules := range processors.LinterExclusionPresets { - for _, rule := range rules { - data[name] = append(data[name], types.ExcludeRule{ - Linters: rule.Linters, - Path: rule.Path, - PathExcept: rule.PathExcept, - Text: rule.Text, - Source: rule.Source, - }) - } - } - - return saveToJSONFile(filepath.Join("assets", "exclusion-presets.json"), data) -} - -func saveCLIHelp(ctx context.Context, dst string) error { - err := exec.CommandContext(ctx, "make", "build").Run() + err = saveThanksList(filepath.Join(dataDir, "thanks.json")) if err != nil { - return fmt.Errorf("can't run make build: %w", err) + log.Fatalf("Save thanks list: %v", err) } - - lintersOut, err := exec.CommandContext(ctx, "./golangci-lint", "help", "linters").Output() - if err != nil { - return fmt.Errorf("can't run linters cmd: %w", err) - } - - lintersOutParts := bytes.Split(lintersOut, []byte("\n\n")) - - data := types.CLIHelp{ - Enable: string(lintersOutParts[0]), - } - - data.RootCmdHelp, err = getCmdHelp(ctx) - if err != nil { - return err - } - - data.RunCmdHelp, err = getCmdHelp(ctx, "run") - if err != nil { - return err - } - - data.LintersCmdHelp, err = getCmdHelp(ctx, "linters") - if err != nil { - return err - } - - data.FmtCmdHelp, err = getCmdHelp(ctx, "fmt") - if err != nil { - return err - } - - data.FormattersCmdHelp, err = getCmdHelp(ctx, "formatters") - if err != nil { - return err - } - - data.HelpCmdHelp, err = getCmdHelp(ctx, "help") - if err != nil { - return err - } - - data.ConfigCmdHelp, err = getCmdHelp(ctx, "config") - if err != nil { - return err - } - - data.MigrateCmdHelp, err = getCmdHelp(ctx, "migrate") - if err != nil { - return err - } - - data.CustomCmdHelp, err = getCmdHelp(ctx, "custom") - if err != nil { - return err - } - - data.CacheCmdHelp, err = getCmdHelp(ctx, "cache") - if err != nil { - return err - } - - data.VersionCmdHelp, err = getCmdHelp(ctx, "version") - if err != nil { - return err - } - - data.CompletionCmdHelp, err = getCmdHelp(ctx, "completion") - if err != nil { - return err - } - - return saveToJSONFile(dst, data) -} - -func getCmdHelp(ctx context.Context, names ...string) (string, error) { - args := slices.Clone(names) - args = append(args, "--help") - - helpCmd := exec.CommandContext(ctx, "./golangci-lint", args...) - helpCmd.Env = append(helpCmd.Env, os.Environ()...) - - help, err := helpCmd.Output() - if err != nil { - return "", fmt.Errorf("can't run help cmd: %w", err) - } - - helpLines := bytes.Split(help, []byte("\n")) - shortHelp := bytes.Join(helpLines[2:], []byte("\n")) - - return string(shortHelp), nil } func saveToJSONFile(dst string, data any) error { diff --git a/scripts/website/expand_templates/thanks.go b/scripts/website/dump_info/thanks.go similarity index 75% rename from scripts/website/expand_templates/thanks.go rename to scripts/website/dump_info/thanks.go index 43a6b1f75a0f..f22f8b08423e 100644 --- a/scripts/website/expand_templates/thanks.go +++ b/scripts/website/dump_info/thanks.go @@ -18,12 +18,17 @@ const ( ) type authorDetails struct { - Linters []string - Profile string - Avatar string + Name string `json:"name"` + Linters []string `json:"linters"` + Profile string `json:"profile"` + Avatar string `json:"avatar"` } -func getThanksList() string { +func saveThanksList(dst string) error { + return saveToJSONFile(dst, getThanksList()) +} + +func getThanksList() []*authorDetails { addedAuthors := map[string]*authorDetails{} linters, _ := lintersdb.NewLinterBuilder().Build(config.NewDefault()) @@ -49,9 +54,10 @@ func getThanksList() string { addedAuthors[info.Author].Linters = append(addedAuthors[info.Author].Linters, lc.Name()) } else { addedAuthors[info.Author] = &authorDetails{ + Name: info.Author, Linters: []string{lc.Name()}, - Profile: fmt.Sprintf("[%[1]s](https://github.com/sponsors/%[1]s)", info.Author), - Avatar: getGitHubAvatar(info), + Profile: fmt.Sprintf("https://github.com/sponsors/%s", info.Author), + Avatar: fmt.Sprintf("https://github.com/%[1]s.png", info.Author), } } @@ -59,11 +65,16 @@ func getThanksList() string { if _, ok := addedAuthors[info.Author]; ok { addedAuthors[info.Author].Linters = append(addedAuthors[info.Author].Linters, lc.Name()) } else { - getGitHubAvatar(info) + ghAuthor := info.Author + if info.Author == "bosi" { + ghAuthor = "bosix" + } + addedAuthors[info.Author] = &authorDetails{ + Name: info.Author, Linters: []string{lc.Name()}, - Profile: fmt.Sprintf("[%[1]s](https://gitlab.com/%[1]s)", info.Author), - Avatar: getGitHubAvatar(info), + Profile: fmt.Sprintf("https://gitlab.com/%[1]s", info.Author), + Avatar: fmt.Sprintf("https://github.com/%[1]s.png", ghAuthor), } } } @@ -73,24 +84,13 @@ func getThanksList() string { return strings.Compare(strings.ToLower(a), strings.ToLower(b)) }) - lines := []string{ - "|Author|Linter(s)|", - "|---|---|", - } + var details []*authorDetails for _, author := range authors { - lines = append(lines, fmt.Sprintf("|
%s
%s
|%s|", - addedAuthors[author].Avatar, addedAuthors[author].Profile, strings.Join(addedAuthors[author].Linters, ", "))) + details = append(details, addedAuthors[author]) } - return strings.Join(lines, "\n") -} - -func getGitHubAvatar(info authorInfo) string { - return fmt.Sprintf( - `%[1]s`, - info.Author, - ) + return details } type authorInfo struct { @@ -105,6 +105,9 @@ func extractInfo(lc *linter.Config) authorInfo { case "staticcheck": return authorInfo{Author: "dominikh", Host: hostGitHub} + case "exhaustruct": + return authorInfo{Author: "xobotyi", Host: hostGitHub} + case "misspell": return authorInfo{Author: "client9", Host: hostGitHub} @@ -143,9 +146,6 @@ func extractInfo(lc *linter.Config) authorInfo { case "OpenPeeDeeP": info.Author = "dixonwille" - case "bosi": - info.Author = "bosix" - case "golangci": return authorInfo{} } diff --git a/scripts/website/expand_templates/thanks_test.go b/scripts/website/dump_info/thanks_test.go similarity index 100% rename from scripts/website/expand_templates/thanks_test.go rename to scripts/website/dump_info/thanks_test.go diff --git a/scripts/website/expand_templates/.gitignore b/scripts/website/expand_templates/.gitignore index 20377ad7139b..706882f57d00 100644 --- a/scripts/website/expand_templates/.gitignore +++ b/scripts/website/expand_templates/.gitignore @@ -1,3 +1,6 @@ ConfigurationFile.md +ConfigurationFile.json FormattersSettings.md +FormattersSettings.json LintersSettings.md +LintersSettings.json diff --git a/scripts/website/expand_templates/changelog.go b/scripts/website/expand_templates/changelog.go new file mode 100644 index 000000000000..a6c68f48c420 --- /dev/null +++ b/scripts/website/expand_templates/changelog.go @@ -0,0 +1,52 @@ +package main + +import ( + "bufio" + "bytes" + "os" + "path/filepath" +) + +func copyChangelog(dir string) error { + marker := "" + + in, err := os.ReadFile("CHANGELOG.md") + if err != nil { + return err + } + + out, err := os.Create(filepath.Join(dir, "raw_changelog.tmp")) + if err != nil { + return err + } + + defer func() { _ = out.Close() }() + + var write bool + + // TODO(ldez): use bytes.Lines when min go1.24 (and remove the new line) + scanner := bufio.NewScanner(bytes.NewBuffer(bytes.ReplaceAll(in, []byte("### "), []byte("## ")))) + scanner.Split(bufio.ScanLines) + + for scanner.Scan() { + line := scanner.Bytes() + + if bytes.Equal(bytes.TrimSpace(line), []byte(marker)) { + write = true + continue + } + + if !write { + continue + } + + line = append(line, '\n') + + _, err = out.Write(line) + if err != nil { + return err + } + } + + return nil +} diff --git a/scripts/website/expand_templates/configuration.go b/scripts/website/expand_templates/configuration.go new file mode 100644 index 000000000000..f7571023441d --- /dev/null +++ b/scripts/website/expand_templates/configuration.go @@ -0,0 +1,290 @@ +package main + +import ( + "bytes" + "fmt" + "os" + "path/filepath" + "reflect" + "strings" + + "gopkg.in/yaml.v3" + + "github.com/golangci/golangci-lint/v2/pkg/config" + "github.com/golangci/golangci-lint/v2/scripts/website/types" +) + +const ( + keyLinters = "linters" + keyFormatters = "formatters" + keySettings = "settings" +) + +type SettingSnippets struct { + ConfigurationFile map[string]string + LintersSettings map[string]string + FormattersSettings map[string]string +} + +type ExampleSnippetsExtractor struct { + referencePath string + assetsPath string +} + +func NewExampleSnippetsExtractor() *ExampleSnippetsExtractor { + return &ExampleSnippetsExtractor{ + referencePath: ".golangci.reference.yml", + assetsPath: filepath.Join("docs", "data"), + } +} + +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 + } + + root := data.Content[0] + + globalNode := &yaml.Node{ + Kind: root.Kind, + Style: root.Style, + Tag: root.Tag, + Value: root.Value, + Anchor: root.Anchor, + Alias: root.Alias, + HeadComment: root.HeadComment, + LineComment: root.LineComment, + FootComment: root.FootComment, + Line: root.Line, + Column: root.Column, + } + + snippets := SettingSnippets{ + ConfigurationFile: make(map[string]string), + } + + for j, node := range root.Content { + switch node.Value { + case "run", "output", keyLinters, keyFormatters, "issues", "severity", "version": + default: + continue + } + + nextNode := root.Content[j+1] + + newNode := &yaml.Node{ + Kind: nextNode.Kind, + Content: []*yaml.Node{ + { + HeadComment: fmt.Sprintf("See the dedicated %q documentation section.", node.Value), + Kind: node.Kind, + Style: node.Style, + Tag: node.Tag, + Value: "option", + }, + { + Kind: node.Kind, + Style: node.Style, + Tag: node.Tag, + Value: "value", + }, + }, + } + + if node.Value == "version" { + n := &yaml.Node{ + HeadComment: fmt.Sprintf("See the dedicated %q documentation section.", node.Value), + Kind: node.Kind, + Style: node.Style, + Tag: node.Tag, + Value: node.Value, + Content: node.Content, + } + + globalNode.Content = append(globalNode.Content, n, nextNode) + } else { + globalNode.Content = append(globalNode.Content, node, newNode) + } + + 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++ + } + } + + nodeSection := &yaml.Node{ + Kind: root.Kind, + Style: root.Style, + Tag: root.Tag, + Value: root.Value, + Content: []*yaml.Node{node, nextNode}, + } + + buf := bytes.NewBuffer(nil) + encoder := yaml.NewEncoder(buf) + encoder.SetIndent(2) + + err := encoder.Encode(nodeSection) + if err != nil { + return nil, err + } + + snippets.ConfigurationFile[node.Value] = buf.String() + } + + buf := bytes.NewBuffer(nil) + encoder := yaml.NewEncoder(buf) + encoder.SetIndent(2) + + err := encoder.Encode(globalNode) + if err != nil { + return nil, err + } + + snippets.ConfigurationFile["root"] = buf.String() + + return &snippets, nil +} + +func (e *ExampleSnippetsExtractor) getSettingSections(node, nextNode *yaml.Node) (map[string]string, error) { + // Extract YAML settings + allNodes := make(map[string]*yaml.Node) + + for i := 0; i < len(nextNode.Content); i += 2 { + allNodes[nextNode.Content[i].Value] = &yaml.Node{ + Kind: yaml.MappingNode, + Tag: nextNode.Tag, + Value: node.Value, + Content: []*yaml.Node{ + { + Kind: yaml.ScalarNode, + Value: node.Value, + Tag: node.Tag, + }, + { + Kind: yaml.MappingNode, + Content: []*yaml.Node{ + { + Kind: yaml.ScalarNode, + Value: "settings", + Tag: node.Tag, + }, + { + Kind: yaml.MappingNode, + Tag: nextNode.Tag, + Content: []*yaml.Node{nextNode.Content[i], nextNode.Content[i+1]}, + }, + }, + }, + }, + } + } + + linterSettings := make(map[string]string) + + // Using linter information + linters, err := readJSONFile[[]*types.LinterWrapper](filepath.Join(e.assetsPath, fmt.Sprintf("%s_info.json", node.Value))) + if err != nil { + return nil, err + } + + for _, lc := range linters { + if lc.Internal { + continue + } + + if lc.Deprecation != nil { + continue + } + + settings, ok := allNodes[lc.Name] + if !ok { + if hasSettings(lc.Name) { + return nil, fmt.Errorf("can't find %s settings in .golangci.reference.yml", lc.Name) + } + + continue + } + + buf := bytes.NewBuffer(nil) + encoder := yaml.NewEncoder(buf) + encoder.SetIndent(2) + + err := encoder.Encode(settings) + if err != nil { + return nil, err + } + + linterSettings[lc.Name] = buf.String() + } + + return linterSettings, nil +} + +func hasSettings(name string) bool { + tp := reflect.TypeOf(config.LintersSettings{}) + + for i := range tp.NumField() { + if strings.EqualFold(name, tp.Field(i).Name) { + return true + } + } + + tp = reflect.TypeOf(config.FormatterSettings{}) + + for i := range tp.NumField() { + if strings.EqualFold(name, tp.Field(i).Name) { + return true + } + } + + return false +} diff --git a/scripts/website/expand_templates/linters_test.go b/scripts/website/expand_templates/configuration_test.go similarity index 51% rename from scripts/website/expand_templates/linters_test.go rename to scripts/website/expand_templates/configuration_test.go index 478faa4e58ed..e99e0a20bff1 100644 --- a/scripts/website/expand_templates/linters_test.go +++ b/scripts/website/expand_templates/configuration_test.go @@ -1,7 +1,6 @@ package main import ( - "os" "path/filepath" "testing" @@ -12,8 +11,8 @@ func Test_ExampleSnippetsExtractor_GetExampleSnippets(t *testing.T) { t.Skip("only for debugging purpose") e := &ExampleSnippetsExtractor{ - referencePath: "../../../.golangci.next.reference.yml", - assetsPath: filepath.Join("..", "..", "..", "assets"), + referencePath: filepath.Join("..", "..", "..", ".golangci.next.reference.yml"), + assetsPath: filepath.Join("..", "..", "..", "docs", "data"), } m, err := e.GetExampleSnippets() @@ -21,12 +20,12 @@ func Test_ExampleSnippetsExtractor_GetExampleSnippets(t *testing.T) { t.Log(m) - err = os.WriteFile("./ConfigurationFile.md", []byte(m.ConfigurationFile), 0644) + err = saveToJSONFile("ConfigurationFile.json", m.ConfigurationFile) require.NoError(t, err) - err = os.WriteFile("./LintersSettings.md", []byte(m.LintersSettings), 0644) + err = saveToJSONFile("LintersSettings.json", m.LintersSettings) require.NoError(t, err) - err = os.WriteFile("./FormattersSettings.md", []byte(m.FormattersSettings), 0644) + err = saveToJSONFile("FormattersSettings.json", m.FormattersSettings) require.NoError(t, err) } diff --git a/scripts/website/expand_templates/exclusions.go b/scripts/website/expand_templates/exclusions.go deleted file mode 100644 index b84cae8a1b03..000000000000 --- a/scripts/website/expand_templates/exclusions.go +++ /dev/null @@ -1,53 +0,0 @@ -package main - -import ( - "bytes" - "path/filepath" - "text/template" - - "github.com/golangci/golangci-lint/v2/scripts/website/types" -) - -const exclusionTmpl = `{{- $tick := "` + "`" + `" -}} -{{- range $name, $rules := . }} -### Preset {{ $tick }}{{ $name }}{{ $tick }} - - - - - - - - - -{{- range $rule := $rules }} - - - - -{{- end }} - -
LinterIssue Text
{{ range $linter := $rule.Linters }}{{ $linter }}{{ end }}{{ if $rule.Text }}{{ $rule.Text }}{{ end }}
- -{{ end }}` - -func getExclusionPresets() (string, error) { - linterExclusionPresets, err := readJSONFile[map[string][]types.ExcludeRule](filepath.Join("assets", "exclusion-presets.json")) - if err != nil { - return "", err - } - - bufferString := bytes.NewBufferString("") - - tmpl, err := template.New("exclusions").Parse(exclusionTmpl) - if err != nil { - return "", err - } - - err = tmpl.Execute(bufferString, linterExclusionPresets) - if err != nil { - return "", err - } - - return bufferString.String(), nil -} diff --git a/scripts/website/expand_templates/internal/badge.go b/scripts/website/expand_templates/internal/badge.go deleted file mode 100644 index 3084986b4c58..000000000000 --- a/scripts/website/expand_templates/internal/badge.go +++ /dev/null @@ -1,42 +0,0 @@ -package internal - -import ( - "strconv" - "strings" -) - -type Badge struct { - data []string -} - -func NewBadge() *Badge { - return &Badge{} -} - -func (b *Badge) Link(v string) *Badge { - b.data = append(b.data, "link="+strconv.Quote(v)) - - return b -} - -func (b *Badge) Content(v string) *Badge { - b.data = append(b.data, "content="+strconv.Quote(v)) - - return b -} - -func (b *Badge) Type(v string) *Badge { - b.data = append(b.data, "type="+strconv.Quote(v)) - - return b -} - -func (b *Badge) Icon(v string) *Badge { - b.data = append(b.data, "icon="+strconv.Quote(v)) - - return b -} - -func (b *Badge) String() string { - return "{{< badge " + strings.Join(b.data, " ") + " >}}" -} diff --git a/scripts/website/expand_templates/internal/cards.go b/scripts/website/expand_templates/internal/cards.go deleted file mode 100644 index f0746e307512..000000000000 --- a/scripts/website/expand_templates/internal/cards.go +++ /dev/null @@ -1,112 +0,0 @@ -package internal - -import ( - "strconv" - "strings" -) - -type Cards struct { - cards []*Card - cols int -} - -func NewCards() *Cards { - return &Cards{} -} - -func (c *Cards) Cols(cols int) *Cards { - c.cols = cols - - return c -} - -func (c *Cards) Add(card *Card) *Cards { - c.cards = append(c.cards, card) - - return c -} - -func (c *Cards) String() string { - v := "{{< cards" - if c.cols > 0 { - v += " cols=" + strconv.Itoa(c.cols) - } - v += " >}}\n" - - for _, card := range c.cards { - v += card.String() - } - - v += "{{< /cards >}}\n" - - return v -} - -type Card struct { - data []string -} - -func NewCard() *Card { - return &Card{} -} - -func (c *Card) Link(v string) *Card { - c.data = append(c.data, "link="+strconv.Quote(v)) - - return c -} - -func (c *Card) Title(v string) *Card { - c.data = append(c.data, "title="+strconv.Quote(v)) - - return c -} - -func (c *Card) Subtitle(v string) *Card { - c.data = append(c.data, "subtitle="+strconv.Quote(v)) - - return c -} - -func (c *Card) Icon(v string) *Card { - c.data = append(c.data, "icon="+strconv.Quote(v)) - - return c -} - -func (c *Card) Image(v string) *Card { - c.data = append(c.data, "image="+strconv.Quote(v)) - - return c -} - -func (c *Card) ImageStyle(v string) *Card { - c.data = append(c.data, "imageStyle="+strconv.Quote(v)) - - return c -} - -func (c *Card) Width(v string) *Card { - c.data = append(c.data, "width="+strconv.Quote(v)) - - return c -} - -func (c *Card) Height(v string) *Card { - c.data = append(c.data, "height="+strconv.Quote(v)) - return c -} - -func (c *Card) Tag(v, tType string) *Card { - c.data = append(c.data, "tag="+strconv.Quote(v)) - - if tType != "" { - c.data = append(c.data, "tagType="+strconv.Quote(tType)) - } - - return c -} - -func (c *Card) String() string { - return " {{< card " + strings.Join(c.data, " ") + " >}}\n" -} diff --git a/scripts/website/expand_templates/linters.go b/scripts/website/expand_templates/linters.go deleted file mode 100644 index 214744e116ff..000000000000 --- a/scripts/website/expand_templates/linters.go +++ /dev/null @@ -1,480 +0,0 @@ -package main - -import ( - "fmt" - "maps" - "os" - "path/filepath" - "reflect" - "slices" - "sort" - "strings" - "unicode" - "unicode/utf8" - - "gopkg.in/yaml.v3" - - "github.com/golangci/golangci-lint/v2/pkg/config" - "github.com/golangci/golangci-lint/v2/scripts/website/expand_templates/internal" - "github.com/golangci/golangci-lint/v2/scripts/website/types" -) - -const ( - keyLinters = "linters" - keyFormatters = "formatters" - keySettings = "settings" -) - -func getLintersListMarkdown(enabled bool, src, section, latestVersion string) string { - linters, err := readJSONFile[[]*types.LinterWrapper](src) - if err != nil { - panic(err) - } - - var neededLcs []*types.LinterWrapper - for _, lc := range linters { - if lc.Internal { - continue - } - - if slices.Contains(slices.Collect(maps.Keys(lc.Groups)), config.GroupStandard) == enabled { - neededLcs = append(neededLcs, lc) - } - } - - sort.Slice(neededLcs, func(i, j int) bool { - return neededLcs[i].Name < neededLcs[j].Name - }) - - slices.SortFunc(neededLcs, func(a, b *types.LinterWrapper) int { - if a.IsDeprecated() && b.IsDeprecated() { - return strings.Compare(a.Name, b.Name) - } - - if a.IsDeprecated() { - return 1 - } - - if b.IsDeprecated() { - return -1 - } - - return strings.Compare(a.Name, b.Name) - }) - - cards := internal.NewCards() - - for _, lc := range neededLcs { - cards.Add(internal.NewCard(). - Link(fmt.Sprintf("/docs/%s/configuration/#%s", section, lc.Name)). - Title(lc.Name). - Subtitle(getDesc(lc)). - Tag(getTag(lc, latestVersion)), - ) - } - - return cards.String() -} - -func getTag(lc *types.LinterWrapper, latestVersion string) (content, style string) { - if lc.Deprecation != nil { - tagContent := "Deprecated" - if lc.Deprecation.Replacement != "" { - tagContent += fmt.Sprintf(" since %s", lc.Deprecation.Since) - } - - return tagContent, "error" - } - - if compareVersion(lc.Since, latestVersion) { - return "New", "warning" - } - - if lc.CanAutoFix { - return "Autofix", "info" - } - - return "", "" -} - -func compareVersion(a, b string) bool { - return a[:strings.LastIndex(a, ".")] == b[:strings.LastIndex(b, ".")] -} - -func getDesc(lc *types.LinterWrapper) string { - desc := lc.Desc - if lc.Deprecation != nil { - desc = lc.Deprecation.Message - if lc.Deprecation.Replacement != "" { - desc += fmt.Sprintf(" Replaced by %s.", lc.Deprecation.Replacement) - } - } - - return formatDesc(desc) -} - -func formatDesc(desc string) string { - runes := []rune(desc) - - r, _ := utf8.DecodeRuneInString(desc) - runes[0] = unicode.ToUpper(r) - - if runes[len(runes)-1] != '.' { - runes = append(runes, '.') - } - - return strings.NewReplacer("\n", "
", `"`, `'`).Replace(string(runes)) -} - -type SettingSnippets struct { - ConfigurationFile string - LintersSettings string - FormattersSettings string -} - -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{ - referencePath: ".golangci.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 -} - -//nolint:gocyclo // The complexity is expected because of raw YAML manipulations. -func (e *ExampleSnippetsExtractor) extractExampleSnippets(example []byte) (*SettingSnippets, error) { - var data yaml.Node - if err := yaml.Unmarshal(example, &data); err != nil { - return nil, err - } - - root := data.Content[0] - - globalNode := &yaml.Node{ - Kind: root.Kind, - Style: root.Style, - Tag: root.Tag, - Value: root.Value, - Anchor: root.Anchor, - Alias: root.Alias, - HeadComment: root.HeadComment, - LineComment: root.LineComment, - FootComment: root.FootComment, - Line: root.Line, - Column: root.Column, - } - - snippets := SettingSnippets{} - - builder := strings.Builder{} - - for j, node := range root.Content { - switch node.Value { - case "run", "output", keyLinters, keyFormatters, "issues", "severity", "version": - default: - continue - } - - nextNode := root.Content[j+1] - - newNode := &yaml.Node{ - Kind: nextNode.Kind, - Content: []*yaml.Node{ - { - HeadComment: fmt.Sprintf("See the dedicated %q documentation section.", node.Value), - Kind: node.Kind, - Style: node.Style, - Tag: node.Tag, - Value: "option", - }, - { - Kind: node.Kind, - Style: node.Style, - Tag: node.Tag, - Value: "value", - }, - }, - } - - if node.Value == "version" { - n := &yaml.Node{ - HeadComment: fmt.Sprintf("See the dedicated %q documentation section.", node.Value), - Kind: node.Kind, - Style: node.Style, - Tag: node.Tag, - Value: node.Value, - Content: node.Content, - } - - globalNode.Content = append(globalNode.Content, n, nextNode) - } else { - globalNode.Content = append(globalNode.Content, node, newNode) - } - - 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++ - } - } - - nodeSection := &yaml.Node{ - Kind: root.Kind, - Style: root.Style, - Tag: root.Tag, - Value: root.Value, - Content: []*yaml.Node{node, nextNode}, - } - - snippet, errSnip := marshallSnippet(nodeSection) - if errSnip != nil { - return nil, errSnip - } - - _, _ = builder.WriteString(fmt.Sprintf("## `%s` configuration\n\n", node.Value)) - - if node.Value == keyLinters || node.Value == keyFormatters { - baseTitle := []rune(node.Value) - r, _ := utf8.DecodeRuneInString(node.Value) - baseTitle[0] = unicode.ToUpper(r) - - builder.WriteString(internal.NewCards(). - Cols(2). - Add(internal.NewCard(). - Link(fmt.Sprintf("/docs/%s", node.Value)). - Title(string(baseTitle) + " Overview"). - Icon("collection")). - Add(internal.NewCard(). - Link(fmt.Sprintf("/docs/%s/configuration", node.Value)). - Title(string(baseTitle) + " Settings"). - Icon("adjustments")). - String()) - } - - _, _ = builder.WriteString(fmt.Sprintf("\n\n%s", snippet)) - } - - overview, err := marshallSnippet(globalNode) - if err != nil { - return nil, err - } - - snippets.ConfigurationFile = overview + builder.String() - - return &snippets, nil -} - -func (e *ExampleSnippetsExtractor) getSettingSections(node, nextNode *yaml.Node) (string, error) { - // Extract YAML settings - allNodes := make(map[string]*yaml.Node) - - for i := 0; i < len(nextNode.Content); i += 2 { - allNodes[nextNode.Content[i].Value] = &yaml.Node{ - Kind: yaml.MappingNode, - Tag: nextNode.Tag, - Value: node.Value, - Content: []*yaml.Node{ - { - Kind: yaml.ScalarNode, - Value: node.Value, - Tag: node.Tag, - }, - { - Kind: yaml.MappingNode, - Content: []*yaml.Node{ - { - Kind: yaml.ScalarNode, - Value: "settings", - Tag: node.Tag, - }, - { - Kind: yaml.MappingNode, - Tag: nextNode.Tag, - Content: []*yaml.Node{nextNode.Content[i], nextNode.Content[i+1]}, - }, - }, - }, - }, - } - } - - // Using linter information - - linters, err := readJSONFile[[]*types.LinterWrapper](filepath.Join(e.assetsPath, fmt.Sprintf("%s-info.json", node.Value))) - if err != nil { - return "", err - } - - builder := &strings.Builder{} - for _, lc := range linters { - if lc.Internal { - continue - } - - // it's important to use lc.Name() nor name because name can be alias - _, _ = fmt.Fprintf(builder, "## %s\n\n", lc.Name) - - writeTags(builder, lc) - - if lc.Deprecation != nil { - continue - } - - settings, ok := allNodes[lc.Name] - if !ok { - if hasSettings(lc.Name) { - return "", fmt.Errorf("can't find %s settings in .golangci.reference.yml", lc.Name) - } - - _, _ = fmt.Fprintln(builder, "_No configuration_") - - continue - } - - _, _ = fmt.Fprintln(builder, "```yaml") - - encoder := yaml.NewEncoder(builder) - encoder.SetIndent(2) - - err := encoder.Encode(settings) - if err != nil { - return "", err - } - - _, _ = fmt.Fprintln(builder, "```") - _, _ = fmt.Fprintln(builder) - } - - return builder.String(), nil -} - -func writeTags(builder *strings.Builder, lc *types.LinterWrapper) { - if lc == nil { - return - } - - _, _ = fmt.Fprintf(builder, "%s\n\n", getDesc(lc)) - - _, _ = fmt.Fprintln(builder, internal.NewBadge(). - Content(fmt.Sprintf("Since golangci-lint %s", lc.Since)). - Icon("calendar")) - - switch { - case lc.IsDeprecated(): - content := "Deprecated" - if lc.Deprecation.Replacement != "" { - content += fmt.Sprintf(" since %s", lc.Deprecation.Since) - } - - _, _ = fmt.Fprintln(builder, internal.NewBadge(). - Content(content). - Type("error"). - Icon("sparkles")) - - case lc.CanAutoFix: - _, _ = fmt.Fprintln(builder, internal.NewBadge(). - Content("Autofix"). - Type("info"). - Icon("sparkles")) - } - - if lc.OriginalURL != "" { - _, _ = fmt.Fprintln(builder, internal.NewBadge(). - Content("Repository"). - Link(lc.OriginalURL). - Icon("github")) - } - - _, _ = fmt.Fprintln(builder) -} - -func hasSettings(name string) bool { - tp := reflect.TypeOf(config.LintersSettings{}) - - for i := range tp.NumField() { - if strings.EqualFold(name, tp.Field(i).Name) { - return true - } - } - - tp = reflect.TypeOf(config.FormatterSettings{}) - - for i := range tp.NumField() { - if strings.EqualFold(name, tp.Field(i).Name) { - return true - } - } - - return false -} diff --git a/scripts/website/expand_templates/main.go b/scripts/website/expand_templates/main.go index 8c1a57ac37f6..11c9e299d78d 100644 --- a/scripts/website/expand_templates/main.go +++ b/scripts/website/expand_templates/main.go @@ -1,166 +1,85 @@ package main import ( - "bytes" "encoding/json" "fmt" "log" "os" "path/filepath" - "strings" - - "github.com/rogpeppe/go-internal/lockedfile" "github.com/golangci/golangci-lint/v2/scripts/website/github" - "github.com/golangci/golangci-lint/v2/scripts/website/types" ) func main() { - replacements, err := buildTemplateContext() + err := saveTmp(filepath.Join("docs", ".tmp")) if err != nil { - log.Fatalf("Failed to build template context: %s", err) + log.Fatalf("Save tmp: %s", err) } - if err := rewriteDocs(replacements); err != nil { - log.Fatalf("Failed to rewrite docs: %s", err) + err = saveData(filepath.Join("docs", "data")) + if err != nil { + log.Fatalf("Save data: %s", err) } log.Print("Successfully expanded templates") } -func rewriteDocs(replacements map[string]string) error { - madeReplacements := map[string]bool{} - - err := filepath.Walk(filepath.Join("docs", "content"), - func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - if info.IsDir() { - return nil - } - return processDoc(path, replacements, madeReplacements) - }) +func saveTmp(tmpDir string) error { + err := os.RemoveAll(tmpDir) if err != nil { - return fmt.Errorf("walk dir: %w", err) + return fmt.Errorf("remove tmp dir: %w", err) } - if len(madeReplacements) != len(replacements) { - for key := range replacements { - if !madeReplacements[key] { - log.Printf("Replacement %q wasn't performed", key) - } - } - return fmt.Errorf("%d replacements weren't performed", len(replacements)-len(madeReplacements)) + err = os.MkdirAll(tmpDir, os.ModePerm) + if err != nil { + return fmt.Errorf("create tmp dir: %w", err) } - return nil -} -func processDoc(path string, replacements map[string]string, madeReplacements map[string]bool) error { - contentBytes, err := os.ReadFile(path) + err = copyPluginReference(tmpDir) if err != nil { - return fmt.Errorf("read %s: %w", path, err) + return fmt.Errorf("copy plugin reference: %w", err) } - content := string(contentBytes) - hasReplacements := false - for key, replacement := range replacements { - nextContent := content - nextContent = strings.ReplaceAll(nextContent, fmt.Sprintf("{.%s}", key), replacement) + err = copyChangelog(tmpDir) + if err != nil { + return fmt.Errorf("copy changelog: %w", err) + } - // YAML formatter in mdx code section makes extra spaces, need to match them too. - nextContent = strings.ReplaceAll(nextContent, fmt.Sprintf("{ .%s }", key), replacement) + return nil +} - if nextContent != content { - hasReplacements = true - madeReplacements[key] = true - content = nextContent - } +func saveData(dir string) error { + latestVersion, err := github.GetLatestVersion() + if err != nil { + return fmt.Errorf("get the latest version: %w", err) } - if !hasReplacements { - return nil + + err = saveToJSONFile(filepath.Join(dir, "version.json"), map[string]string{"version": latestVersion}) + if err != nil { + return fmt.Errorf("save latest version: %w", err) } - log.Printf("Expanded template in %s, saving it", path) - if err = lockedfile.Write(path, bytes.NewBufferString(content), os.ModePerm); err != nil { - return fmt.Errorf("write changes to file %s: %w", path, err) + snippets, err := NewExampleSnippetsExtractor().GetExampleSnippets() + if err != nil { + return fmt.Errorf("get example snippets: %w", err) } - return nil -} + err = saveToJSONFile(filepath.Join(dir, "linter_settings.json"), snippets.LintersSettings) + if err != nil { + return fmt.Errorf("save linter snippets: %w", err) + } -func buildTemplateContext() (map[string]string, error) { - latestVersion, err := github.GetLatestVersion() + err = saveToJSONFile(filepath.Join(dir, "formatter_settings.json"), snippets.FormattersSettings) if err != nil { - return nil, fmt.Errorf("get the latest version: %w", err) + return fmt.Errorf("save formatter snippets: %w", err) } - snippets, err := NewExampleSnippetsExtractor().GetExampleSnippets() + err = saveToJSONFile(filepath.Join(dir, "configuration_file.json"), snippets.ConfigurationFile) if err != nil { - return nil, err - } - - pluginReference, err := getPluginReference() - if err != nil { - return nil, fmt.Errorf("read plugin reference file: %w", err) - } - - helps, err := readJSONFile[types.CLIHelp](filepath.Join("assets", "cli-help.json")) - if err != nil { - return nil, err - } - - changeLog, err := os.ReadFile("CHANGELOG.md") - if err != nil { - return nil, fmt.Errorf("read CHANGELOG.md: %w", err) - } - - exclusions, err := getExclusionPresets() - if err != nil { - return nil, fmt.Errorf("default exclusions: %w", err) - } - - return map[string]string{ - "CustomGCLReference": pluginReference, - "LintersExample": snippets.LintersSettings, - "FormattersExample": snippets.FormattersSettings, - "ConfigurationExample": snippets.ConfigurationFile, - "LintersCommandOutputEnabledOnly": helps.Enable, - "EnabledByDefaultLinters": getLintersListMarkdown( - true, - filepath.Join("assets", "linters-info.json"), - "linters", - latestVersion, - ), - "DisabledByDefaultLinters": getLintersListMarkdown( - false, - filepath.Join("assets", "linters-info.json"), - "linters", - latestVersion, - ), - "Formatters": getLintersListMarkdown( - false, - filepath.Join("assets", "formatters-info.json"), - "formatters", - latestVersion, - ), - "ExclusionPresets": exclusions, - "ThanksList": getThanksList(), - "CmdRootHelpText": helps.RootCmdHelp, - "CmdRunHelpText": helps.RunCmdHelp, - "CmdLintersHelpText": helps.LintersCmdHelp, - "CmdFmtHelpText": helps.FmtCmdHelp, - "CmdFormattersHelpText": helps.FormattersCmdHelp, - "CmdHelpText": helps.HelpCmdHelp, - "CmdConfigHelpText": helps.ConfigCmdHelp, - "CmdMigrateHelpText": helps.MigrateCmdHelp, - "CmdCustomHelpText": helps.CustomCmdHelp, - "CmdCacheHelpText": helps.CacheCmdHelp, - "CmdVersionHelpText": helps.VersionCmdHelp, - "CmdCompletionHelpText": helps.CompletionCmdHelp, - "ChangeLog": string(changeLog), - "LatestVersion": latestVersion, - }, nil + return fmt.Errorf("save configuration file snippets: %w", err) + } + + return nil } func readJSONFile[T any](src string) (T, error) { @@ -181,3 +100,22 @@ func readJSONFile[T any](src string) (T, error) { return result, nil } + +func saveToJSONFile(dst string, data any) error { + file, err := os.Create(dst) + if err != nil { + return fmt.Errorf("open file (%s): %w", dst, err) + } + + defer func() { _ = file.Close() }() + + encoder := json.NewEncoder(file) + encoder.SetIndent("", " ") + + err = encoder.Encode(data) + if err != nil { + return fmt.Errorf("encode JSON (%s): %w", dst, err) + } + + return nil +} diff --git a/scripts/website/expand_templates/plugins.go b/scripts/website/expand_templates/plugins.go index 8991252efe9a..d8272eb53230 100644 --- a/scripts/website/expand_templates/plugins.go +++ b/scripts/website/expand_templates/plugins.go @@ -1,15 +1,30 @@ package main import ( - "fmt" + "io" "os" + "path/filepath" ) -func getPluginReference() (string, error) { - reference, err := os.ReadFile(".custom-gcl.reference.yml") +func copyPluginReference(dir string) error { + in, err := os.Open(".custom-gcl.reference.yml") if err != nil { - return "", fmt.Errorf("can't read .custom-gcl.reference.yml: %w", err) + return err } - return string(reference), nil + defer func() { _ = in.Close() }() + + out, err := os.Create(filepath.Join(dir, ".custom-gcl.reference.yml")) + if err != nil { + return err + } + + defer func() { _ = out.Close() }() + + _, err = io.Copy(out, in) + if err != nil { + return err + } + + return nil } diff --git a/scripts/website/types/types.go b/scripts/website/types/types.go index e6486133c8a6..bcdbf485846b 100644 --- a/scripts/website/types/types.go +++ b/scripts/website/types/types.go @@ -5,19 +5,19 @@ import ( ) type CLIHelp struct { - Enable string `json:"enable"` - RootCmdHelp string `json:"rootHelp"` - RunCmdHelp string `json:"runHelp"` - LintersCmdHelp string `json:"lintersHelp"` - FmtCmdHelp string `json:"fmtHelp"` - FormattersCmdHelp string `json:"formattersHelp"` - HelpCmdHelp string `json:"help"` - MigrateCmdHelp string `json:"migrateHelp"` - ConfigCmdHelp string `json:"configHelp"` - CustomCmdHelp string `json:"customHelp"` - CacheCmdHelp string `json:"cacheHelp"` - VersionCmdHelp string `json:"versionHelp"` - CompletionCmdHelp string `json:"completionHelp"` + Enable string `json:"defaultEnabledLinters"` + RootCmdHelp string `json:"rootOutput"` + RunCmdHelp string `json:"runOutput"` + LintersCmdHelp string `json:"lintersOutput"` + FmtCmdHelp string `json:"fmtOutput"` + FormattersCmdHelp string `json:"formattersOutput"` + HelpCmdHelp string `json:"helpOutput"` + MigrateCmdHelp string `json:"migrateOutput"` + ConfigCmdHelp string `json:"configOutput"` + CustomCmdHelp string `json:"customOutput"` + CacheCmdHelp string `json:"cacheOutput"` + VersionCmdHelp string `json:"versionOutput"` + CompletionCmdHelp string `json:"completionOutput"` } type ExcludeRule struct { @@ -41,7 +41,7 @@ type LinterWrapper struct { Name string `json:"name"` // From linter. Desc string `json:"desc"` // From linter. - Groups map[string]struct{} + Groups []string `json:"groups,omitempty"` LoadMode packages.LoadMode `json:"loadMode,omitempty"`