From 8a5d4790c382a9c4517b98fb9ddb691cd11551ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Dec 2024 20:57:46 +0100 Subject: [PATCH] build(deps): bump github.com/raeperd/recvcheck from 0.1.2 to 0.2.0 (#5258) Co-authored-by: Fernandez Ludovic --- .golangci.next.reference.yml | 17 +++++++++++++++++ go.mod | 2 +- go.sum | 4 ++-- jsonschema/golangci.next.jsonschema.json | 18 ++++++++++++++++++ pkg/config/linters_settings.go | 6 ++++++ pkg/golinters/recvcheck/recvcheck.go | 12 ++++++++++-- pkg/lint/lintersdb/builder_linter.go | 2 +- 7 files changed, 55 insertions(+), 6 deletions(-) diff --git a/.golangci.next.reference.yml b/.golangci.next.reference.yml index 38718cee0cb7..cd7cfcaa0580 100644 --- a/.golangci.next.reference.yml +++ b/.golangci.next.reference.yml @@ -2318,6 +2318,23 @@ linters-settings: patterns: - ".*" + recvcheck: + # Disables the built-in method exclusions: + # - `MarshalText` + # - `MarshalJSON` + # - `MarshalYAML` + # - `MarshalXML` + # - `MarshalBinary` + # - `GobEncode` + # Default: false + disable-builtin: true + # User-defined method exclusions. + # The format is `struct_name.method_name` (ex: `Foo.MethodName`). + # A wildcard `*` can use as a struct name (ex: `*.MethodName`). + # Default: [] + exclusions: + - "*.Value" + revive: # Maximum number of open files at the same time. # See https://github.com/mgechev/revive#command-line-flags diff --git a/go.mod b/go.mod index 9c9b5c60ab79..7dd4e2a6d811 100644 --- a/go.mod +++ b/go.mod @@ -84,7 +84,7 @@ require ( github.com/pelletier/go-toml/v2 v2.2.3 github.com/polyfloyd/go-errorlint v1.7.0 github.com/quasilyte/go-ruleguard/dsl v0.3.22 - github.com/raeperd/recvcheck v0.1.2 + github.com/raeperd/recvcheck v0.2.0 github.com/rogpeppe/go-internal v1.13.1 github.com/ryancurrah/gomodguard v1.3.5 github.com/ryanrolds/sqlclosecheck v0.5.1 diff --git a/go.sum b/go.sum index 3c1ea2ee72f1..2dc0443ecd6a 100644 --- a/go.sum +++ b/go.sum @@ -469,8 +469,8 @@ github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 h1:TCg2WBOl github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= -github.com/raeperd/recvcheck v0.1.2 h1:SjdquRsRXJc26eSonWIo8b7IMtKD3OAT2Lb5G3ZX1+4= -github.com/raeperd/recvcheck v0.1.2/go.mod h1:n04eYkwIR0JbgD73wT8wL4JjPC3wm0nFtzBnWNocnYU= +github.com/raeperd/recvcheck v0.2.0 h1:GnU+NsbiCqdC2XX5+vMZzP+jAJC5fht7rcVTAhX74UI= +github.com/raeperd/recvcheck v0.2.0/go.mod h1:n04eYkwIR0JbgD73wT8wL4JjPC3wm0nFtzBnWNocnYU= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= diff --git a/jsonschema/golangci.next.jsonschema.json b/jsonschema/golangci.next.jsonschema.json index f21a4557081d..a5358dadd8ef 100644 --- a/jsonschema/golangci.next.jsonschema.json +++ b/jsonschema/golangci.next.jsonschema.json @@ -2394,6 +2394,24 @@ } } }, + "recvcheck": { + "type": "object", + "additionalProperties": false, + "properties": { + "disable-builtin": { + "description": "Disables the built-in method exclusions.", + "type": "boolean", + "default": true + }, + "exclusions": { + "description": "User-defined method exclusions.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, "nonamedreturns": { "type": "object", "additionalProperties": false, diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index 2a0068000174..8e6c184ca4d3 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -270,6 +270,7 @@ type LintersSettings struct { Promlinter PromlinterSettings ProtoGetter ProtoGetterSettings Reassign ReassignSettings + Recvcheck RecvcheckSettings Revive ReviveSettings RowsErrCheck RowsErrCheckSettings SlogLint SlogLintSettings @@ -819,6 +820,11 @@ type ReassignSettings struct { Patterns []string `mapstructure:"patterns"` } +type RecvcheckSettings struct { + DisableBuiltin bool `mapstructure:"disable-builtin"` + Exclusions []string `mapstructure:"exclusions"` +} + type ReviveSettings struct { Go string `mapstructure:"-"` MaxOpenFiles int `mapstructure:"max-open-files"` diff --git a/pkg/golinters/recvcheck/recvcheck.go b/pkg/golinters/recvcheck/recvcheck.go index 8b030f15ded6..3af4885b40d0 100644 --- a/pkg/golinters/recvcheck/recvcheck.go +++ b/pkg/golinters/recvcheck/recvcheck.go @@ -4,11 +4,19 @@ import ( "github.com/raeperd/recvcheck" "golang.org/x/tools/go/analysis" + "github.com/golangci/golangci-lint/pkg/config" "github.com/golangci/golangci-lint/pkg/goanalysis" ) -func New() *goanalysis.Linter { - a := recvcheck.Analyzer +func New(settings *config.RecvcheckSettings) *goanalysis.Linter { + var cfg recvcheck.Settings + + if settings != nil { + cfg.DisableBuiltin = settings.DisableBuiltin + cfg.Exclusions = settings.Exclusions + } + + a := recvcheck.NewAnalyzer(cfg) return goanalysis.NewLinter( a.Name, diff --git a/pkg/lint/lintersdb/builder_linter.go b/pkg/lint/lintersdb/builder_linter.go index 1bf8c402c790..f859fcdd57d5 100644 --- a/pkg/lint/lintersdb/builder_linter.go +++ b/pkg/lint/lintersdb/builder_linter.go @@ -672,7 +672,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) { WithLoadForGoAnalysis(). WithURL("https://github.com/curioswitch/go-reassign"), - linter.NewConfig(recvcheck.New()). + linter.NewConfig(recvcheck.New(&cfg.LintersSettings.Recvcheck)). WithSince("v1.62.0"). WithPresets(linter.PresetBugs). WithLoadForGoAnalysis().