Skip to content

Commit 23b4b5f

Browse files
committed
Update linter's name
1 parent 50818d5 commit 23b4b5f

File tree

13 files changed

+59
-88
lines changed

13 files changed

+59
-88
lines changed

.golangci.next.reference.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ linters:
6767
- goprintffuncname
6868
- gosec
6969
- gosmopolitan
70-
- gounqvet
70+
- unqueryvet
7171
- govet
7272
- grouper
7373
- iface
@@ -180,7 +180,7 @@ linters:
180180
- goprintffuncname
181181
- gosec
182182
- gosmopolitan
183-
- gounqvet
183+
- unqueryvet
184184
- govet
185185
- grouper
186186
- iface
@@ -1609,7 +1609,7 @@ linters:
16091609
- Hiragana
16101610
- Katakana
16111611

1612-
gounqvet:
1612+
unqueryvet:
16131613
# Enable SQL builder checking.
16141614
# Default: true
16151615
check-sql-builders: false

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ require (
148148
codeberg.org/chavacava/garif v0.2.0 // indirect
149149
dev.gaijin.team/go/golib v0.6.0 // indirect
150150
github.com/Masterminds/semver/v3 v3.3.1 // indirect
151-
github.com/MirrexOne/gounqvet v1.2.0
151+
github.com/MirrexOne/unqueryvet v1.2.1
152152
github.com/alfatraining/structtag v1.0.0 // indirect
153153
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
154154
github.com/beorn7/perks v1.0.1 // indirect
@@ -224,3 +224,5 @@ require (
224224
gopkg.in/ini.v1 v1.67.0 // indirect
225225
gopkg.in/yaml.v2 v2.4.0 // indirect
226226
)
227+
228+
replace github.com/MirrexOne/unqueryvet => ../unqueryvet

go.sum

Lines changed: 0 additions & 2 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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,7 +2261,7 @@
22612261
}
22622262
}
22632263
},
2264-
"gounqvetSettings": {
2264+
"unqueryvetSettings": {
22652265
"type": "object",
22662266
"additionalProperties": false,
22672267
"properties": {
@@ -4601,8 +4601,8 @@
46014601
"gosmopolitan": {
46024602
"$ref": "#/definitions/settings/definitions/gosmopolitanSettings"
46034603
},
4604-
"gounqvet": {
4605-
"$ref": "#/definitions/settings/definitions/gounqvetSettings"
4604+
"unqueryvet": {
4605+
"$ref": "#/definitions/settings/definitions/unqueryvetSettings"
46064606
},
46074607
"govet": {
46084608
"$ref": "#/definitions/settings/definitions/govetSettings"

pkg/config/linters_settings.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ var defaultLintersSettings = LintersSettings{
8686
EscapeHatches: []string{},
8787
WatchForScripts: []string{"Han"},
8888
},
89-
Gounqvet: GounqvetSettings{
89+
Unqueryvet: UnqueryvetSettings{
9090
CheckSQLBuilders: true,
9191
},
9292
Inamedparam: INamedParamSettings{
@@ -252,7 +252,7 @@ type LintersSettings struct {
252252
Gomodguard GoModGuardSettings `mapstructure:"gomodguard"`
253253
Gosec GoSecSettings `mapstructure:"gosec"`
254254
Gosmopolitan GosmopolitanSettings `mapstructure:"gosmopolitan"`
255-
Gounqvet GounqvetSettings `mapstructure:"gounqvet"`
255+
Unqueryvet UnqueryvetSettings `mapstructure:"unqueryvet"`
256256
Govet GovetSettings `mapstructure:"govet"`
257257
Grouper GrouperSettings `mapstructure:"grouper"`
258258
Iface IfaceSettings `mapstructure:"iface"`
@@ -595,7 +595,7 @@ type GosmopolitanSettings struct {
595595
WatchForScripts []string `mapstructure:"watch-for-scripts"`
596596
}
597597

598-
type GounqvetSettings struct {
598+
type UnqueryvetSettings struct {
599599
CheckSQLBuilders bool `mapstructure:"check-sql-builders"`
600600
AllowedPatterns []string `mapstructure:"allowed-patterns"`
601601
}

pkg/golinters/gounqvet/testdata/gounqvet_custom.go

Lines changed: 0 additions & 51 deletions
This file was deleted.

pkg/golinters/gounqvet/testdata/gounqvet_custom.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//golangcitest:args -Egounqvet
1+
//golangcitest:args -Eunqueryvet
22
package testdata
33

44
import (
@@ -7,25 +7,21 @@ import (
77
"strconv"
88
)
99

10-
// badQueries
1110
func _() {
1211
query := "SELECT * FROM users" // want "avoid SELECT \\* - explicitly specify needed columns for better performance, maintainability and stability"
1312

1413
var db *sql.DB
1514
rows, _ := db.Query("SELECT * FROM orders WHERE status = ?", "active") // want "avoid SELECT \\* - explicitly specify needed columns for better performance, maintainability and stability"
1615
_ = rows
1716

18-
// This should not trigger because it's a COUNT function
1917
count := "SELECT COUNT(*) FROM users"
2018
_ = count
2119

22-
// Good queries (should not trigger)
2320
goodQuery := "SELECT id, name, email FROM users"
2421
_ = goodQuery
2522

2623
fmt.Println(query)
2724

28-
// Use strconv to satisfy std lib import requirement
2925
_ = strconv.Itoa(42)
3026
}
3127

@@ -36,15 +32,12 @@ type SQLBuilder interface {
3632
Query() string
3733
}
3834

39-
// badSQLBuilder
4035
func _(builder SQLBuilder) {
4136
query := builder.Select("*").From("products") // want "avoid SELECT \\* in SQL builder - explicitly specify columns to prevent unnecessary data transfer and schema change issues"
4237
_ = query
4338
}
4439

45-
// goodSQLBuilder
4640
func _(builder SQLBuilder) {
47-
// Good usage - should not trigger
4841
query := builder.Select("id", "name", "price").From("products")
4942
_ = query
5043
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//golangcitest:args -Eunqueryvet
2+
//golangcitest:config_path testdata/unqueryvet_custom.yml
3+
package testdata
4+
5+
import (
6+
"database/sql"
7+
"fmt"
8+
"strconv"
9+
)
10+
11+
func _() {
12+
query := "SELECT * FROM users" // want "avoid SELECT \\* - explicitly specify needed columns for better performance, maintainability and stability"
13+
14+
var db *sql.DB
15+
rows, _ := db.Query("SELECT * FROM orders WHERE status = ?", "active") // want "avoid SELECT \\* - explicitly specify needed columns for better performance, maintainability and stability"
16+
_ = rows
17+
18+
count := "SELECT COUNT(*) FROM users"
19+
_ = count
20+
21+
goodQuery := "SELECT id, name, email FROM users"
22+
_ = goodQuery
23+
24+
fmt.Println(query)
25+
26+
_ = strconv.Itoa(42)
27+
}
28+
29+
// Custom allowed patterns test - SELECT * from temp tables should be allowed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: "2"
2+
3+
linters:
4+
settings:
5+
unqueryvet:
6+
check-sql-builders: false

0 commit comments

Comments
 (0)