Skip to content

Commit

Permalink
build(deps): bump github.com/Antonboom/testifylint from 1.2.0 to 1.3.0 (
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonboom committed May 19, 2024
1 parent be1bb6d commit 73110df
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 25 deletions.
12 changes: 9 additions & 3 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2176,9 +2176,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 @@ -2192,7 +2193,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 @@ -2202,9 +2203,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 @@ -2220,6 +2222,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 @@ -2779,16 +2779,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 @@ -2811,20 +2801,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 @@ -2835,25 +2844,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 @@ -2862,8 +2898,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 @@ -2874,7 +2911,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 @@ -882,6 +882,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)
}
}

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

0 comments on commit 73110df

Please sign in to comment.