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 {
1919 paths = slices .Concat (old .Issues .ExcludeFiles , old .Issues .ExcludeDirs )
2020 }
2121
22+ paths = append (paths , toFormattersPathsFromRules (old .Issues )... )
23+
2224 return versiontwo.Formatters {
2325 Enable : formatterNames ,
2426 Settings : versiontwo.FormatterSettings {
@@ -34,6 +36,27 @@ func toFormatters(old *versionone.Config) versiontwo.Formatters {
3436 }
3537}
3638
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+
3760func toGciSettings (old versionone.GciSettings ) versiontwo.GciSettings {
3861 return versiontwo.GciSettings {
3962 Sections : old .Sections ,
Original file line number Diff line number Diff line change @@ -64,9 +64,14 @@ func toExclusionRules(old *versionone.Config) []versiontwo.ExcludeRule {
6464 var results []versiontwo.ExcludeRule
6565
6666 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+
6772 results = append (results , versiontwo.ExcludeRule {
6873 BaseRule : versiontwo.BaseRule {
69- Linters : onlyLinterNames ( convertStaticcheckLinterNames ( convertAlternativeNames ( rule . Linters ))) ,
74+ Linters : names ,
7075 Path : rule .Path ,
7176 PathExcept : rule .PathExcept ,
7277 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