Skip to content

Commit 7611c76

Browse files
authored
feat: remove compatibility layer for formatters configuration (#5446)
1 parent 76d896a commit 7611c76

File tree

10 files changed

+762
-410
lines changed

10 files changed

+762
-410
lines changed

.golangci.next.reference.yml

+94-65
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ linters:
1010
# Disable all linters.
1111
# Default: false
1212
disable-all: true
13-
# Enable specific linter
13+
# Enable specific linter.
1414
# https://golangci-lint.run/usage/linters/#enabled-by-default
1515
enable:
1616
- asasalint
@@ -276,6 +276,99 @@ linters:
276276
fast: true
277277

278278

279+
formatters:
280+
# Enable specific formatter.
281+
# Default: [] (uses standard Go formatting)
282+
enable:
283+
- gci
284+
- gofmt
285+
- gofumpt
286+
- goimports
287+
- golines
288+
289+
# Formatters settings.
290+
settings:
291+
gci:
292+
# Section configuration to compare against.
293+
# Section names are case-insensitive and may contain parameters in ().
294+
# The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`,
295+
# If `custom-order` is `true`, it follows the order of `sections` option.
296+
# Default: ["standard", "default"]
297+
sections:
298+
- standard # Standard section: captures all standard packages.
299+
- default # Default section: contains all imports that could not be matched to another section type.
300+
- prefix(github.com/org/project) # Custom section: groups all imports with the specified Prefix.
301+
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
302+
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
303+
- alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
304+
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
305+
306+
# Checks that no inline comments are present.
307+
# Default: false
308+
no-inline-comments: true
309+
310+
# Checks that no prefix comments (comment lines above an import) are present.
311+
# Default: false
312+
no-prefix-comments: true
313+
314+
# Skip generated files.
315+
# Default: true
316+
skip-generated: false
317+
318+
# Enable custom order of sections.
319+
# If `true`, make the section order the same as the order of `sections`.
320+
# Default: false
321+
custom-order: true
322+
323+
# Drops lexical ordering for custom sections.
324+
# Default: false
325+
no-lex-order: true
326+
327+
gofmt:
328+
# Simplify code: gofmt with `-s` option.
329+
# Default: true
330+
simplify: false
331+
# Apply the rewrite rules to the source before reformatting.
332+
# https://pkg.go.dev/cmd/gofmt
333+
# Default: []
334+
rewrite-rules:
335+
- pattern: 'interface{}'
336+
replacement: 'any'
337+
- pattern: 'a[b:len(a)]'
338+
replacement: 'a[b:]'
339+
340+
gofumpt:
341+
# Module path which contains the source code being formatted.
342+
# Default: ""
343+
module-path: github.com/org/project
344+
345+
# Choose whether to use the extra rules.
346+
# Default: false
347+
extra-rules: true
348+
349+
goimports:
350+
# A comma-separated list of prefixes, which, if set, checks import paths
351+
# with the given prefixes are grouped after 3rd-party packages.
352+
# Default: ""
353+
local-prefixes: github.com/org/project
354+
355+
golines:
356+
# Target maximum line length.
357+
# Default: 100
358+
max-len: 200
359+
# Length of a tabulation.
360+
# Default: 4
361+
tab-len: 8
362+
# Shorten single-line comments.
363+
# Default: false
364+
shorten-comments: true
365+
# Default: true
366+
reformat-tags: false
367+
# Split chained methods on the dots as opposed to the arguments.
368+
# Default: true
369+
chain-split-dots: false
370+
371+
279372
# All available settings of specific linters.
280373
linters-settings:
281374
asasalint:
@@ -596,42 +689,6 @@ linters-settings:
596689
# Default false
597690
ignore-comments: true
598691

599-
gci:
600-
# Section configuration to compare against.
601-
# Section names are case-insensitive and may contain parameters in ().
602-
# The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`,
603-
# If `custom-order` is `true`, it follows the order of `sections` option.
604-
# Default: ["standard", "default"]
605-
sections:
606-
- standard # Standard section: captures all standard packages.
607-
- default # Default section: contains all imports that could not be matched to another section type.
608-
- prefix(github.com/org/project) # Custom section: groups all imports with the specified Prefix.
609-
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
610-
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
611-
- alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
612-
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
613-
614-
# Checks that no inline Comments are present.
615-
# Default: false
616-
no-inline-comments: true
617-
618-
# Checks that no prefix Comments(comment lines above an import) are present.
619-
# Default: false
620-
no-prefix-comments: true
621-
622-
# Skip generated files.
623-
# Default: true
624-
skip-generated: false
625-
626-
# Enable custom order of sections.
627-
# If `true`, make the section order the same as the order of `sections`.
628-
# Default: false
629-
custom-order: true
630-
631-
# Drops lexical ordering for custom sections.
632-
# Default: false
633-
no-lex-order: true
634-
635692
ginkgolinter:
636693
# Suppress the wrong length assertion warning.
637694
# Default: false
@@ -1313,28 +1370,6 @@ linters-settings:
13131370
- OPTIMIZE # marks code that should be optimized before merging
13141371
- HACK # marks hack-around that should be removed before merging
13151372

1316-
gofmt:
1317-
# Simplify code: gofmt with `-s` option.
1318-
# Default: true
1319-
simplify: false
1320-
# Apply the rewrite rules to the source before reformatting.
1321-
# https://pkg.go.dev/cmd/gofmt
1322-
# Default: []
1323-
rewrite-rules:
1324-
- pattern: 'interface{}'
1325-
replacement: 'any'
1326-
- pattern: 'a[b:len(a)]'
1327-
replacement: 'a[b:]'
1328-
1329-
gofumpt:
1330-
# Module path which contains the source code being formatted.
1331-
# Default: ""
1332-
module-path: github.com/org/project
1333-
1334-
# Choose whether to use the extra rules.
1335-
# Default: false
1336-
extra-rules: true
1337-
13381373
goheader:
13391374
# Supports two types 'const` and `regexp`.
13401375
# Values can be used recursively.
@@ -1374,12 +1409,6 @@ linters-settings:
13741409
# Default: ""
13751410
template-path: /path/to/my/template.tmpl
13761411

1377-
goimports:
1378-
# A comma-separated list of prefixes, which, if set, checks import paths
1379-
# with the given prefixes are grouped after 3rd-party packages.
1380-
# Default: ""
1381-
local-prefixes: github.com/org/project
1382-
13831412
gomoddirectives:
13841413
# Allow local `replace` directives.
13851414
# Default: false

0 commit comments

Comments
 (0)