Skip to content

Commit 43aeaf3

Browse files
committed
review
1 parent 146d15c commit 43aeaf3

File tree

8 files changed

+57
-57
lines changed

8 files changed

+57
-57
lines changed

.golangci.next.reference.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ linters:
6868
- goprintffuncname
6969
- gosec
7070
- gosmopolitan
71-
- unqueryvet
7271
- govet
7372
- grouper
7473
- iface
@@ -121,6 +120,7 @@ linters:
121120
- tparallel
122121
- unconvert
123122
- unparam
123+
- unqueryvet
124124
- unused
125125
- usestdlibvars
126126
- usetesting
@@ -182,7 +182,6 @@ linters:
182182
- goprintffuncname
183183
- gosec
184184
- gosmopolitan
185-
- unqueryvet
186185
- govet
187186
- grouper
188187
- iface
@@ -235,6 +234,7 @@ linters:
235234
- tparallel
236235
- unconvert
237236
- unparam
237+
- unqueryvet
238238
- unused
239239
- usestdlibvars
240240
- usetesting
@@ -1679,21 +1679,6 @@ linters:
16791679
- Hiragana
16801680
- Katakana
16811681

1682-
unqueryvet:
1683-
# Enable SQL builder checking.
1684-
# Default: true
1685-
check-sql-builders: false
1686-
# Regex patterns for acceptable SELECT * usage.
1687-
# Default:
1688-
# - "SELECT \\* FROM information_schema\\..*"
1689-
# - "SELECT \\* FROM pg_catalog\\..*"
1690-
# - "SELECT COUNT\\(\\*\\)"
1691-
# - "SELECT MAX\\(\\*\\)"
1692-
# - "SELECT MIN\\(\\*\\)"
1693-
allowed-patterns:
1694-
- "SELECT \\* FROM temp_.*"
1695-
- "SELECT \\* FROM.*-- migration"
1696-
16971682
govet:
16981683
# Disable all analyzers.
16991684
# Default: false
@@ -3901,6 +3886,21 @@ linters:
39013886
# Default: false
39023887
check-exported: true
39033888

3889+
unqueryvet:
3890+
# Enable SQL builder checking.
3891+
# Default: true
3892+
check-sql-builders: false
3893+
# Regex patterns for acceptable SELECT * usage.
3894+
# Default:
3895+
# - "SELECT \\* FROM information_schema\\..*"
3896+
# - "SELECT \\* FROM pg_catalog\\..*"
3897+
# - "SELECT COUNT\\(\\*\\)"
3898+
# - "SELECT MAX\\(\\*\\)"
3899+
# - "SELECT MIN\\(\\*\\)"
3900+
allowed-patterns:
3901+
- "SELECT \\* FROM temp_.*"
3902+
- "SELECT \\* FROM.*-- migration"
3903+
39043904
unused:
39053905
# Mark all struct fields that have been written to as used.
39063906
# Default: true

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ require (
1515
github.com/Antonboom/testifylint v1.6.4
1616
github.com/BurntSushi/toml v1.5.0
1717
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24
18+
github.com/MirrexOne/unqueryvet v1.2.1
1819
github.com/OpenPeeDeeP/depguard/v2 v2.2.1
1920
github.com/alecthomas/chroma/v2 v2.20.0
2021
github.com/alecthomas/go-check-sumtype v0.3.1
@@ -149,7 +150,6 @@ require (
149150
codeberg.org/chavacava/garif v0.2.0 // indirect
150151
dev.gaijin.team/go/golib v0.6.0 // indirect
151152
github.com/Masterminds/semver/v3 v3.3.1 // indirect
152-
github.com/MirrexOne/unqueryvet v1.2.1
153153
github.com/alfatraining/structtag v1.0.0 // indirect
154154
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
155155
github.com/beorn7/perks v1.0.1 // indirect
@@ -225,5 +225,3 @@ require (
225225
gopkg.in/ini.v1 v1.67.0 // indirect
226226
gopkg.in/yaml.v2 v2.4.0 // indirect
227227
)
228-
229-
replace github.com/MirrexOne/unqueryvet => ../unqueryvet

go.sum

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsonschema/golangci.next.jsonschema.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2342,24 +2342,6 @@
23422342
}
23432343
}
23442344
},
2345-
"unqueryvetSettings": {
2346-
"type": "object",
2347-
"additionalProperties": false,
2348-
"properties": {
2349-
"check-sql-builders": {
2350-
"description": "Enable SQL builder checking.",
2351-
"type": "boolean",
2352-
"default": true
2353-
},
2354-
"allowed-patterns": {
2355-
"description": "Regex patterns for acceptable SELECT * usage.",
2356-
"type": "array",
2357-
"items": {
2358-
"type": "string"
2359-
}
2360-
}
2361-
}
2362-
},
23632345
"govetSettings": {
23642346
"type": "object",
23652347
"additionalProperties": false,
@@ -4018,6 +4000,24 @@
40184000
}
40194001
}
40204002
},
4003+
"unqueryvetSettings": {
4004+
"type": "object",
4005+
"additionalProperties": false,
4006+
"properties": {
4007+
"check-sql-builders": {
4008+
"description": "Enable SQL builder checking.",
4009+
"type": "boolean",
4010+
"default": true
4011+
},
4012+
"allowed-patterns": {
4013+
"description": "Regex patterns for acceptable SELECT * usage.",
4014+
"type": "array",
4015+
"items": {
4016+
"type": "string"
4017+
}
4018+
}
4019+
}
4020+
},
40214021
"unusedSettings": {
40224022
"type": "object",
40234023
"additionalProperties": false,
@@ -4685,9 +4685,6 @@
46854685
"gosmopolitan": {
46864686
"$ref": "#/definitions/settings/definitions/gosmopolitanSettings"
46874687
},
4688-
"unqueryvet": {
4689-
"$ref": "#/definitions/settings/definitions/unqueryvetSettings"
4690-
},
46914688
"govet": {
46924689
"$ref": "#/definitions/settings/definitions/govetSettings"
46934690
},
@@ -4817,6 +4814,9 @@
48174814
"unparam": {
48184815
"$ref": "#/definitions/settings/definitions/unparamSettings"
48194816
},
4817+
"unqueryvet": {
4818+
"$ref": "#/definitions/settings/definitions/unqueryvetSettings"
4819+
},
48204820
"unused": {
48214821
"$ref": "#/definitions/settings/definitions/unusedSettings"
48224822
},

pkg/config/linters_settings.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ var defaultLintersSettings = LintersSettings{
8686
EscapeHatches: []string{},
8787
WatchForScripts: []string{"Han"},
8888
},
89-
Unqueryvet: UnqueryvetSettings{
90-
CheckSQLBuilders: true,
91-
},
9289
Inamedparam: INamedParamSettings{
9390
SkipSingleParam: false,
9491
},
@@ -165,6 +162,9 @@ var defaultLintersSettings = LintersSettings{
165162
SkipRegexp: `(export|internal)_test\.go`,
166163
AllowPackages: []string{"main"},
167164
},
165+
Unqueryvet: UnqueryvetSettings{
166+
CheckSQLBuilders: true,
167+
},
168168
Unused: UnusedSettings{
169169
FieldWritesAreUses: true,
170170
PostStatementsAreReads: false,
@@ -253,7 +253,7 @@ type LintersSettings struct {
253253
Gomodguard GoModGuardSettings `mapstructure:"gomodguard"`
254254
Gosec GoSecSettings `mapstructure:"gosec"`
255255
Gosmopolitan GosmopolitanSettings `mapstructure:"gosmopolitan"`
256-
Unqueryvet UnqueryvetSettings `mapstructure:"unqueryvet"`
256+
Unqueryvet UnqueryvetSettings `mapstructure:"unqueryvet"`
257257
Govet GovetSettings `mapstructure:"govet"`
258258
Grouper GrouperSettings `mapstructure:"grouper"`
259259
Iface IfaceSettings `mapstructure:"iface"`
@@ -614,11 +614,6 @@ type GosmopolitanSettings struct {
614614
WatchForScripts []string `mapstructure:"watch-for-scripts"`
615615
}
616616

617-
type UnqueryvetSettings struct {
618-
CheckSQLBuilders bool `mapstructure:"check-sql-builders"`
619-
AllowedPatterns []string `mapstructure:"allowed-patterns"`
620-
}
621-
622617
type GovetSettings struct {
623618
Go string `mapstructure:"-"`
624619

@@ -1013,6 +1008,11 @@ type UnparamSettings struct {
10131008
CheckExported bool `mapstructure:"check-exported"`
10141009
}
10151010

1011+
type UnqueryvetSettings struct {
1012+
CheckSQLBuilders bool `mapstructure:"check-sql-builders"`
1013+
AllowedPatterns []string `mapstructure:"allowed-patterns"`
1014+
}
1015+
10161016
type UnusedSettings struct {
10171017
FieldWritesAreUses bool `mapstructure:"field-writes-are-uses"`
10181018
PostStatementsAreReads bool `mapstructure:"post-statements-are-reads"`

pkg/golinters/unqueryvet/unqueryvet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ func New(settings *config.UnqueryvetSettings) *goanalysis.Linter {
2121
return goanalysis.
2222
NewLinterFromAnalyzer(unqueryvet.NewWithConfig(&cfg)).
2323
WithLoadMode(goanalysis.LoadModeSyntax)
24-
}
24+
}

pkg/golinters/unqueryvet/unqueryvet_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ import (
88

99
func TestFromTestdata(t *testing.T) {
1010
integration.RunTestdata(t)
11-
}
11+
}

pkg/lint/lintersdb/builder_linter.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ import (
5656
"github.com/golangci/golangci-lint/v2/pkg/golinters/goprintffuncname"
5757
"github.com/golangci/golangci-lint/v2/pkg/golinters/gosec"
5858
"github.com/golangci/golangci-lint/v2/pkg/golinters/gosmopolitan"
59-
"github.com/golangci/golangci-lint/v2/pkg/golinters/unqueryvet"
6059
"github.com/golangci/golangci-lint/v2/pkg/golinters/govet"
6160
"github.com/golangci/golangci-lint/v2/pkg/golinters/grouper"
6261
"github.com/golangci/golangci-lint/v2/pkg/golinters/iface"
@@ -110,6 +109,7 @@ import (
110109
"github.com/golangci/golangci-lint/v2/pkg/golinters/tparallel"
111110
"github.com/golangci/golangci-lint/v2/pkg/golinters/unconvert"
112111
"github.com/golangci/golangci-lint/v2/pkg/golinters/unparam"
112+
"github.com/golangci/golangci-lint/v2/pkg/golinters/unqueryvet"
113113
"github.com/golangci/golangci-lint/v2/pkg/golinters/unused"
114114
"github.com/golangci/golangci-lint/v2/pkg/golinters/usestdlibvars"
115115
"github.com/golangci/golangci-lint/v2/pkg/golinters/usetesting"
@@ -404,10 +404,6 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
404404
WithLoadForGoAnalysis().
405405
WithURL("https://github.com/xen0n/gosmopolitan"),
406406

407-
linter.NewConfig(unqueryvet.New(&cfg.Linters.Settings.Unqueryvet)).
408-
WithSince("v2.5.0").
409-
WithURL("https://github.com/MirrexOne/unqueryvet"),
410-
411407
linter.NewConfig(govet.New(&cfg.Linters.Settings.Govet)).
412408
WithGroups(config.GroupStandard).
413409
WithSince("v1.0.0").
@@ -667,6 +663,10 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
667663
WithLoadForGoAnalysis().
668664
WithURL("https://github.com/mvdan/unparam"),
669665

666+
linter.NewConfig(unqueryvet.New(&cfg.Linters.Settings.Unqueryvet)).
667+
WithSince("v2.5.0").
668+
WithURL("https://github.com/MirrexOne/unqueryvet"),
669+
670670
linter.NewConfig(unused.New(&cfg.Linters.Settings.Unused)).
671671
WithGroups(config.GroupStandard).
672672
WithSince("v1.20.0").

0 commit comments

Comments
 (0)