File tree Expand file tree Collapse file tree 4 files changed +71
-0
lines changed Expand file tree Collapse file tree 4 files changed +71
-0
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,10 @@ var defaultLintersSettings = LintersSettings{
122122 Unparam : UnparamSettings {
123123 Algo : "cha" ,
124124 },
125+ UseStdlibVars : UseStdlibVarsSettings {
126+ HTTPMethod : true ,
127+ HTTPStatusCode : true ,
128+ },
125129 Varnamelen : VarnamelenSettings {
126130 MaxDistance : 5 ,
127131 MinNameLength : 3 ,
Original file line number Diff line number Diff line change @@ -252,6 +252,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
252252 thelperCfg = & m .cfg .LintersSettings .Thelper
253253 unparamCfg = & m .cfg .LintersSettings .Unparam
254254 unusedCfg = new (config.StaticCheckSettings )
255+ usestdlibvars = & m .cfg .LintersSettings .UseStdlibVars
255256 varcheckCfg = & m .cfg .LintersSettings .Varcheck
256257 varnamelenCfg = & m .cfg .LintersSettings .Varnamelen
257258 whitespaceCfg = & m .cfg .LintersSettings .Whitespace
Original file line number Diff line number Diff line change 1+ linters-settings :
2+ usestdlibvars :
3+ http-method : false
4+ http-status-code : false
5+ time-weekday : true
6+ time-month : true
7+ time-layout : true
8+ crypto-hash : true
9+ default-rpc-path : true
10+ sql-isolation-level : true
11+ tls-signature-scheme : true
12+ constant-kind : true
Original file line number Diff line number Diff line change 1+ //golangcitest:args -Eusestdlibvars
2+ //golangcitest:config_path testdata/configs/usestdlibvars_non_default.yml
3+ package testdata
4+
5+ import "net/http"
6+
7+ func _200 () {
8+ _ = 200
9+ }
10+
11+ func _200_1 () {
12+ var w http.ResponseWriter
13+ w .WriteHeader (200 )
14+ }
15+
16+ const (
17+ _ = "Bool" // want `"Bool" can be replaced by constant\.Bool\.String\(\)`
18+ _ = "Complex" // want `"Complex" can be replaced by constant\.Complex\.String\(\)`
19+ )
20+
21+ const (
22+ _ = "BLAKE2b-256" // want `"BLAKE2b-256" can be replaced by crypto\.BLAKE2b_256\.String\(\)`
23+ _ = "BLAKE2b-384" // want `"BLAKE2b-384" can be replaced by crypto\.BLAKE2b_384\.String\(\)`
24+ )
25+
26+ const (
27+ _ = "/_goRPC_" // want `"/_goRPC_" can be replaced by rpc\.DefaultRPCPath`
28+ _ = "/debug/rpc" // want `"/debug/rpc" can be replaced by rpc\.DefaultDebugPath`
29+ )
30+
31+ const (
32+ _ = "Read Committed" // want `"Read Committed" can be replaced by sql\.LevelReadCommitted\.String\(\)`
33+ _ = "Read Uncommitted" // want `"Read Uncommitted" can be replaced by sql\.LevelReadUncommitted\.String\(\)`
34+ )
35+
36+ const (
37+ _ = "01/02 03:04:05PM '06 -0700" // want `"01/02 03:04:05PM '06 -0700" can be replaced by time\.Layout`
38+ _ = "02 Jan 06 15:04 -0700" // want `"02 Jan 06 15:04 -0700" can be replaced by time\.RFC822Z`
39+ )
40+
41+ const (
42+ _ = "April" // want `"April" can be replaced by time\.April\.String\(\)`
43+ _ = "August" // want `"August" can be replaced by time\.August\.String\(\)`
44+ )
45+
46+ const (
47+ _ = "Friday" // want `"Friday" can be replaced by time\.Friday\.String\(\)`
48+ _ = "Monday" // want `"Monday" can be replaced by time\.Monday\.String\(\)`
49+ )
50+
51+ const (
52+ _ = "ECDSAWithP256AndSHA256" // want `"ECDSAWithP256AndSHA256" can be replaced by tls\.ECDSAWithP256AndSHA256\.String\(\)`
53+ _ = "ECDSAWithP384AndSHA384" // want `"ECDSAWithP384AndSHA384" can be replaced by tls\.ECDSAWithP384AndSHA384\.String\(\)`
54+ )
You can’t perform that action at this time.
0 commit comments