Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump github.com/Antonboom/testifylint from 1.2.0 to 1.3.0 #4729

Merged
merged 1 commit into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2159,9 +2159,10 @@ linters-settings:
- error-is-as
- error-nil
- expected-actual
- go-require
- float-compare
- go-require
- len
- negative-positive
- nil-compare
- require-error
- suite-dont-use-pkg
Expand All @@ -2175,7 +2176,7 @@ linters-settings:
# Enable checkers by name
# (in addition to default
# blank-import, bool-compare, compares, empty, error-is-as, error-nil, expected-actual, go-require, float-compare,
# len, nil-compare, require-error, suite-dont-use-pkg, suite-extra-assert-call, useless-assert
# len, negative-positive, nil-compare, require-error, suite-dont-use-pkg, suite-extra-assert-call, useless-assert
# ).
enable:
- blank-import
Expand All @@ -2185,9 +2186,10 @@ linters-settings:
- error-is-as
- error-nil
- expected-actual
- go-require
- float-compare
- go-require
- len
- negative-positive
- nil-compare
- require-error
- suite-dont-use-pkg
Expand All @@ -2203,6 +2205,10 @@ linters-settings:
# Regexp for expected variable name.
# Default: (^(exp(ected)?|want(ed)?)([A-Z]\w*)?$)|(^(\w*[a-z])?(Exp(ected)?|Want(ed)?)$)
pattern: ^expected
go-require:
# To ignore HTTP handlers (like http.HandlerFunc).
# Default: false
ignore-http-handlers: true
require-error:
# Regexp for assertions to analyze. If defined, then only matched error assertions will be reported.
# Default: ""
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/Abirdcfly/dupword v0.0.14
github.com/Antonboom/errname v0.1.13
github.com/Antonboom/nilnil v0.1.9
github.com/Antonboom/testifylint v1.2.0
github.com/Antonboom/testifylint v1.3.0
github.com/BurntSushi/toml v1.3.2
github.com/Crocmagnon/fatcontext v0.2.2
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 56 additions & 18 deletions jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2772,16 +2772,6 @@
"type": "object",
"additionalProperties": false,
"properties": {
"bool-compare": {
"type": "object",
"additionalProperties": false,
"properties": {
"ignore-custom-types": {
"type": "boolean",
"default": false
}
}
},
"enable-all": {
"description": "Enable all checkers.",
"type": "boolean",
Expand All @@ -2804,20 +2794,39 @@
"error-is-as",
"error-nil",
"expected-actual",
"go-require",
"float-compare",
"go-require",
"len",
"negative-positive",
"nil-compare",
"require-error",
"suite-dont-use-pkg",
"suite-extra-assert-call",
"suite-thelper",
"useless-assert"
]
}
},
"default": [
"blank-import",
"bool-compare",
"compares",
"empty",
"error-is-as",
"error-nil",
"expected-actual",
"float-compare",
"go-require",
"len",
"negative-positive",
"nil-compare",
"require-error",
"suite-dont-use-pkg",
"suite-extra-assert-call",
"useless-assert"
]
},
"disable": {
"description": "Enable specific checkers.",
"description": "Disable specific checkers.",
"type": "array",
"items": {
"enum": [
Expand All @@ -2828,25 +2837,52 @@
"error-is-as",
"error-nil",
"expected-actual",
"go-require",
"float-compare",
"go-require",
"len",
"negative-positive",
"nil-compare",
"require-error",
"suite-dont-use-pkg",
"suite-extra-assert-call",
"suite-thelper",
"useless-assert"
],
"default": [
"suite-thelper"
]
}
},
"bool-compare": {
"type": "object",
"additionalProperties": false,
"properties": {
"ignore-custom-types": {
"description": "To ignore user defined types (over builtin bool).",
"type": "boolean",
"default": false
}
}
},
"expected-actual": {
"type": "object",
"additionalProperties": false,
"properties": {
"pattern": {
"description": "Regexp for expected variable name.",
"type": "string"
"type": "string",
"default": "(^(exp(ected)?|want(ed)?)([A-Z]\\w*)?$)|(^(\\w*[a-z])?(Exp(ected)?|Want(ed)?)$)"
}
}
},
"go-require": {
"type": "object",
"additionalProperties": false,
"properties": {
"ignore-http-handlers": {
"description": "To ignore HTTP handlers (like http.HandlerFunc).",
"type": "boolean",
"default": false
}
}
},
Expand All @@ -2855,8 +2891,9 @@
"additionalProperties": false,
"properties": {
"fn-pattern": {
"description": "Regexp for expected variable name.",
"type": "string"
"description": "Regexp for assertions to analyze. If defined, then only matched error assertions will be reported.",
"type": "string",
"default": ""
}
}
},
Expand All @@ -2867,7 +2904,8 @@
"mode": {
"description": "To require or remove extra Assert() call?",
"type": "string",
"enum": ["remove", "require"]
"enum": ["remove", "require"],
"default": "remove"
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,10 @@ type TestifylintSettings struct {
ExpVarPattern string `mapstructure:"pattern"`
} `mapstructure:"expected-actual"`

GoRequire struct {
IgnoreHTTPHandlers bool `mapstructure:"ignore-http-handlers"`
} `mapstructure:"go-require"`

RequireError struct {
FnPattern string `mapstructure:"fn-pattern"`
} `mapstructure:"require-error"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/goanalysis/linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (*Linter) configureAnalyzer(a *analysis.Analyzer, cfg map[string]any) error
}

if err := f.Value.Set(valueToString(v)); err != nil {
return fmt.Errorf("failed to set analyzer setting %q with value %v: %w", k, v, err)
return fmt.Errorf("failed to set analyzer setting %q with value %q: %w", k, v, err)
ldez marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/golinters/testifylint/testifylint.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func New(settings *config.TestifylintSettings) *goanalysis.Linter {
"disable-all": settings.DisableAll,

"bool-compare.ignore-custom-types": settings.BoolCompare.IgnoreCustomTypes,
"go-require.ignore-http-handlers": settings.GoRequire.IgnoreHTTPHandlers,
}
if len(settings.EnabledCheckers) > 0 {
cfg[a.Name]["enable"] = settings.EnabledCheckers
Expand Down
Loading