Skip to content

Commit 6cbdf61

Browse files
committed
review
1 parent d35e0d4 commit 6cbdf61

File tree

6 files changed

+78
-1
lines changed

6 files changed

+78
-1
lines changed

pkg/commands/internal/migrate/migrate_linter_names.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,10 @@ func convertAlternativeNames(names []string) []string {
927927
var results []string
928928

929929
for _, name := range names {
930+
if name == "typecheck" {
931+
continue
932+
}
933+
930934
if n, ok := altNames[name]; ok {
931935
results = append(results, n)
932936
continue

pkg/commands/internal/migrate/migrate_severity.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ func toSeverity(old *versionone.Config) versiontwo.Severity {
99
var rules []versiontwo.SeverityRule
1010

1111
for _, rule := range old.Severity.Rules {
12+
names := convertStaticcheckLinterNames(convertAlternativeNames(rule.Linters))
13+
if len(rule.Linters) > 0 && len(names) == 0 {
14+
continue
15+
}
16+
1217
rules = append(rules, versiontwo.SeverityRule{
1318
BaseRule: versiontwo.BaseRule{
14-
Linters: convertStaticcheckLinterNames(convertAlternativeNames(rule.Linters)),
19+
Linters: names,
1520
Path: rule.Path,
1621
PathExcept: rule.PathExcept,
1722
Text: rule.Text,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version: "2"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
issues:
2+
# Only to not generate unrelated elements inside golden.
3+
exclude-use-default: false
4+
# Only to not generate unrelated elements inside golden.
5+
exclude-generated: strict
6+
# Only to not generate unrelated elements inside golden.
7+
exclude-dirs-use-default: false
8+
9+
exclude-case-sensitive: true
10+
11+
exclude-rules:
12+
- path: _test\.go
13+
linters:
14+
- typecheck
15+
16+
- path-except: _test\.go
17+
linters:
18+
- typecheck
19+
20+
- path: internal/hmac/
21+
text: "weak cryptographic primitive"
22+
linters:
23+
- typecheck
24+
25+
- linters:
26+
- typecheck
27+
text: "SA9003:"
28+
29+
- linters:
30+
- typecheck
31+
source: "foo"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version: "2"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
issues:
2+
# Only to not generate unrelated elements inside golden.
3+
exclude-use-default: false
4+
# Only to not generate unrelated elements inside golden.
5+
exclude-generated: strict
6+
# Only to not generate unrelated elements inside golden.
7+
exclude-dirs-use-default: false
8+
9+
severity:
10+
rules:
11+
- path: _test\.go
12+
severity: info
13+
linters:
14+
- typecheck
15+
16+
- path-except: _test\.go
17+
severity: info
18+
linters:
19+
- typecheck
20+
21+
- path: internal/hmac/
22+
severity: info
23+
text: "weak cryptographic primitive"
24+
linters:
25+
- typecheck
26+
27+
- linters:
28+
- typecheck
29+
text: "SA9003:"
30+
severity: info
31+
32+
- linters:
33+
- typecheck
34+
source: "foo"
35+
severity: info

0 commit comments

Comments
 (0)