File tree Expand file tree Collapse file tree 4 files changed +53
-1
lines changed
pkg/commands/internal/migrate Expand file tree Collapse file tree 4 files changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ func toFormatters(old *versionone.Config) versiontwo.Formatters {
19
19
paths = slices .Concat (old .Issues .ExcludeFiles , old .Issues .ExcludeDirs )
20
20
}
21
21
22
+ paths = append (paths , toFormattersPathsFromRules (old .Issues )... )
23
+
22
24
return versiontwo.Formatters {
23
25
Enable : formatterNames ,
24
26
Settings : versiontwo.FormatterSettings {
@@ -34,6 +36,27 @@ func toFormatters(old *versionone.Config) versiontwo.Formatters {
34
36
}
35
37
}
36
38
39
+ func toFormattersPathsFromRules (old versionone.Issues ) []string {
40
+ var results []string
41
+
42
+ for _ , rule := range old .ExcludeRules {
43
+ allNames := convertStaticcheckLinterNames (convertAlternativeNames (rule .Linters ))
44
+
45
+ names := onlyFormatterNames (allNames )
46
+ if len (names ) == 0 {
47
+ continue
48
+ }
49
+
50
+ if ptr .Deref (rule .Path ) == "" {
51
+ continue
52
+ }
53
+
54
+ results = append (results , ptr .Deref (rule .Path ))
55
+ }
56
+
57
+ return results
58
+ }
59
+
37
60
func toGciSettings (old versionone.GciSettings ) versiontwo.GciSettings {
38
61
return versiontwo.GciSettings {
39
62
Sections : old .Sections ,
Original file line number Diff line number Diff line change @@ -64,9 +64,14 @@ func toExclusionRules(old *versionone.Config) []versiontwo.ExcludeRule {
64
64
var results []versiontwo.ExcludeRule
65
65
66
66
for _ , rule := range old .Issues .ExcludeRules {
67
+ names := onlyLinterNames (convertStaticcheckLinterNames (convertAlternativeNames (rule .Linters )))
68
+ if len (rule .Linters ) > 0 && len (names ) == 0 {
69
+ continue
70
+ }
71
+
67
72
results = append (results , versiontwo.ExcludeRule {
68
73
BaseRule : versiontwo.BaseRule {
69
- Linters : onlyLinterNames ( convertStaticcheckLinterNames ( convertAlternativeNames ( rule . Linters ))) ,
74
+ Linters : names ,
70
75
Path : rule .Path ,
71
76
PathExcept : rule .PathExcept ,
72
77
Text : addPrefix (old .Issues , rule .Text ),
Original file line number Diff line number Diff line change
1
+ version : " 2"
2
+ linters :
3
+ default : none
4
+ formatters :
5
+ enable :
6
+ - goimports
7
+ exclusions :
8
+ paths :
9
+ - \.(generated\.deepcopy|pb)\.go$
Original file line number Diff line number Diff line change
1
+ issues :
2
+ # Only to not generate unrelated elements inside golden.
3
+ exclude-generated : strict
4
+ # Only to not generate unrelated elements inside golden.
5
+ exclude-dirs-use-default : false
6
+
7
+ exclude-rules :
8
+ - path : " \\ .(generated\\ .deepcopy|pb)\\ .go$"
9
+ linters :
10
+ - goimports
11
+
12
+ linters :
13
+ disable-all : true
14
+ enable :
15
+ - goimports
You can’t perform that action at this time.
0 commit comments