Skip to content

Commit 4d2f4d6

Browse files
authored
feat: drop v1 compatibility with exclude-dirs-use-default for fmt (#5520)
1 parent 6a37088 commit 4d2f4d6

8 files changed

+13
-4
lines changed

pkg/commands/internal/migrate/migrate_formatters.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func toFormatters(old *versionone.Config) versiontwo.Formatters {
1818
}
1919

2020
if old.Issues.UseDefaultExcludeDirs == nil || ptr.Deref(old.Issues.UseDefaultExcludeDirs) {
21-
paths = append(paths, "examples$")
21+
paths = append(paths, "third_party$", "builtin$", "examples$")
2222
}
2323

2424
paths = append(paths, toFormattersPathsFromRules(old.Issues)...)

pkg/commands/internal/migrate/testdata/json/empty.golden.json

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"exclusions": {
44
"generated": "lax",
55
"paths": [
6+
"third_party$",
7+
"builtin$",
68
"examples$"
79
]
810
}

pkg/commands/internal/migrate/testdata/toml/empty.golden.toml

+2
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ paths = [
1919
[formatters.exclusions]
2020
generated = 'lax'
2121
paths = [
22+
'third_party$',
23+
'builtin$',
2224
'examples$'
2325
]

pkg/commands/internal/migrate/testdata/yaml/empty.golden.yml

+2
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ formatters:
1515
exclusions:
1616
generated: lax
1717
paths:
18+
- third_party$
19+
- builtin$
1820
- examples$

pkg/commands/internal/migrate/testdata/yaml/issues_07_a.golden.yml

+2
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ linters:
88
formatters:
99
exclusions:
1010
paths:
11+
- third_party$
12+
- builtin$
1113
- examples$

pkg/commands/internal/migrate/testdata/yaml/issues_07_b.golden.yml

+2
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ formatters:
1111
- goimports
1212
exclusions:
1313
paths:
14+
- third_party$
15+
- builtin$
1416
- examples$

pkg/commands/internal/migrate/testdata/yaml/unknown-fields.golden.yml

+2
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ formatters:
1515
exclusions:
1616
generated: lax
1717
paths:
18+
- third_party$
19+
- builtin$
1820
- examples$

pkg/goformat/runner.go

-3
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,6 @@ func skipDir(name string) bool {
194194
case "vendor", "testdata", "node_modules":
195195
return true
196196

197-
case "third_party", "builtin": // For compatibility with `exclude-dirs-use-default`.
198-
return true
199-
200197
default:
201198
return strings.HasPrefix(name, ".")
202199
}

0 commit comments

Comments
 (0)