Skip to content

Commit 222c54a

Browse files
committed
feat: updating funcorder to v0.3.0, support for alphabetical.
1 parent 7326c96 commit 222c54a

12 files changed

+624
-175
lines changed

.golangci.next.reference.yml

Lines changed: 96 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,9 @@ linters:
539539
# Checks if the exported methods of a structure are placed before the non-exported ones.
540540
# Default: true
541541
struct-method: false
542+
# Checks if the constructors and/or structure methods are sorted alphabetically.
543+
# Default: false
544+
alphabetical: true
542545

543546
funlen:
544547
# Checks the number of lines in a function.
@@ -642,7 +645,7 @@ linters:
642645
# Exclude strings matching the given regular expression.
643646
# Default: ""
644647
ignore-string-values:
645-
- 'foo.+'
648+
- "foo.+"
646649
# Detects constants with identical values.
647650
# Default: false
648651
find-duplicates: true
@@ -1167,7 +1170,7 @@ linters:
11671170
#
11681171
# The option is passed to the ruleguard 'debug-group' argument.
11691172
# Default: ""
1170-
debug: 'emptyDecl'
1173+
debug: "emptyDecl"
11711174
# Determines the behavior when an error occurs while parsing ruleguard files.
11721175
# If flag is not set, log error and skip rule files that contain an error.
11731176
# If flag is set, the value must be a comma-separated list of error conditions.
@@ -1182,7 +1185,7 @@ linters:
11821185
# The placeholder '${config-path}' is substituted with a path relative to the configuration file.
11831186
# Glob patterns such as 'rules-*.go' may be specified.
11841187
# Default: ""
1185-
rules: '${base-path}/ruleguard/rules-*.go,${base-path}/myrule1.go'
1188+
rules: "${base-path}/ruleguard/rules-*.go,${base-path}/myrule1.go"
11861189
# Comma-separated list of enabled groups or skip empty to enable everything.
11871190
# Tags can be defined with # character prefix.
11881191
# Default: "<all>"
@@ -1533,11 +1536,11 @@ linters:
15331536
#
15341537
# Default: []
15351538
escape-hatches:
1536-
- 'github.com/nicksnyder/go-i18n/v2/i18n.Message'
1537-
- 'example.com/your/project/i18n/markers.Raw'
1538-
- 'example.com/your/project/i18n/markers.OK'
1539-
- 'example.com/your/project/i18n/markers.TODO'
1540-
- 'command-line-arguments.Simple'
1539+
- "github.com/nicksnyder/go-i18n/v2/i18n.Message"
1540+
- "example.com/your/project/i18n/markers.Raw"
1541+
- "example.com/your/project/i18n/markers.OK"
1542+
- "example.com/your/project/i18n/markers.TODO"
1543+
- "command-line-arguments.Simple"
15411544
# List of Unicode scripts to watch for any usage in string literals.
15421545
# https://pkg.go.dev/unicode#pkg-variables
15431546
#
@@ -1886,9 +1889,9 @@ linters:
18861889
# For example: https://github.com/timonwong/loggercheck/blob/7395ab86595781e33f7afba27ad7b55e6956ebcd/testdata/custom-rules.txt
18871890
# Default: empty
18881891
rules:
1889-
- k8s.io/klog/v2.InfoS # package level exported functions
1890-
- (github.com/go-logr/logr.Logger).Error # "Methods"
1891-
- (*go.uber.org/zap.SugaredLogger).With # Also "Methods", but with a pointer receiver
1892+
- k8s.io/klog/v2.InfoS # package level exported functions
1893+
- (github.com/go-logr/logr.Logger).Error # "Methods"
1894+
- (*go.uber.org/zap.SugaredLogger).With # Also "Methods", but with a pointer receiver
18921895

18931896
maintidx:
18941897
# Show functions with maintainability index lower than N.
@@ -1941,9 +1944,9 @@ linters:
19411944
# Values always ignored: "1", "1.0", "0" and "0.0".
19421945
# Default: []
19431946
ignored-numbers:
1944-
- '0666'
1945-
- '0755'
1946-
- '42'
1947+
- "0666"
1948+
- "0755"
1949+
- "42"
19471950
# List of file patterns to exclude from analysis.
19481951
# Values always ignored: `.+_test.go`.
19491952
# Default: []
@@ -2011,7 +2014,7 @@ linters:
20112014
allow-unused: true
20122015
# Exclude following linters from requiring an explanation.
20132016
# Default: []
2014-
allow-no-explanation: [ ]
2017+
allow-no-explanation: []
20152018
# Enable to require an explanation of nonzero length after each nolint directive.
20162019
# Default: false
20172020
require-explanation: true
@@ -2199,7 +2202,7 @@ linters:
21992202
severity: warning
22002203
disabled: false
22012204
exclude: [""]
2202-
arguments: [ 4 ]
2205+
arguments: [4]
22032206
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#atomic
22042207
- name: atomic
22052208
severity: warning
@@ -2210,7 +2213,7 @@ linters:
22102213
severity: warning
22112214
disabled: false
22122215
exclude: [""]
2213-
arguments: [ "Ω","Σ","σ", "7" ]
2216+
arguments: ["Ω", "Σ", "σ", "7"]
22142217
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#bare-return
22152218
- name: bare-return
22162219
severity: warning
@@ -2236,7 +2239,7 @@ linters:
22362239
severity: warning
22372240
disabled: false
22382241
exclude: [""]
2239-
arguments: [ 7 ]
2242+
arguments: [7]
22402243
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#comment-spacings
22412244
- name: comment-spacings
22422245
severity: warning
@@ -2250,7 +2253,7 @@ linters:
22502253
severity: warning
22512254
disabled: false
22522255
exclude: [""]
2253-
arguments: [ 15 ]
2256+
arguments: [15]
22542257
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#confusing-naming
22552258
- name: confusing-naming
22562259
severity: warning
@@ -2283,7 +2286,7 @@ linters:
22832286
severity: warning
22842287
disabled: false
22852288
exclude: [""]
2286-
arguments: [ 3 ]
2289+
arguments: [3]
22872290
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#datarace
22882291
- name: datarace
22892292
severity: warning
@@ -2312,7 +2315,8 @@ linters:
23122315
disabled: false
23132316
exclude: [""]
23142317
arguments:
2315-
- allowed-packages: ["github.com/onsi/ginkgo/v2", "github.com/onsi/gomega"]
2318+
- allowed-packages:
2319+
["github.com/onsi/ginkgo/v2", "github.com/onsi/gomega"]
23162320
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#duplicated-imports
23172321
- name: duplicated-imports
23182322
severity: warning
@@ -2430,13 +2434,13 @@ linters:
24302434
severity: warning
24312435
disabled: false
24322436
exclude: [""]
2433-
arguments: [ 10, 0 ]
2437+
arguments: [10, 0]
24342438
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#function-result-limit
24352439
- name: function-result-limit
24362440
severity: warning
24372441
disabled: false
24382442
exclude: [""]
2439-
arguments: [ 3 ]
2443+
arguments: [3]
24402444
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#get-return
24412445
- name: get-return
24422446
severity: warning
@@ -2492,19 +2496,19 @@ linters:
24922496
severity: warning
24932497
disabled: false
24942498
exclude: [""]
2495-
arguments: [ 80 ]
2499+
arguments: [80]
24962500
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#max-control-nesting
24972501
- name: max-control-nesting
24982502
severity: warning
24992503
disabled: false
25002504
exclude: [""]
2501-
arguments: [ 3 ]
2505+
arguments: [3]
25022506
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#max-public-structs
25032507
- name: max-public-structs
25042508
severity: warning
25052509
disabled: false
25062510
exclude: [""]
2507-
arguments: [ 3 ]
2511+
arguments: [3]
25082512
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#modifies-parameter
25092513
- name: modifies-parameter
25102514
severity: warning
@@ -2578,10 +2582,10 @@ linters:
25782582
disabled: false
25792583
exclude: [""]
25802584
arguments:
2581-
- - 'core.WriteError[1].Message'
2582-
- '/^([^A-Z]|$)/'
2585+
- - "core.WriteError[1].Message"
2586+
- "/^([^A-Z]|$)/"
25832587
- must not start with a capital letter
2584-
- - 'fmt.Errorf[0]'
2588+
- - "fmt.Errorf[0]"
25852589
- '/(^|[^\.!?])$/'
25862590
- must not end in punctuation
25872591
- - panic
@@ -2697,8 +2701,8 @@ linters:
26972701
disabled: false
26982702
exclude: [""]
26992703
arguments:
2700-
- [ "ID" ] # AllowList
2701-
- [ "VM" ] # DenyList
2704+
- ["ID"] # AllowList
2705+
- ["VM"] # DenyList
27022706
- - upper-case-const: true # Extra parameter (upper-case-const|skip-package-name-checks)
27032707
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#waitgroup-by-value
27042708
- name: waitgroup-by-value
@@ -2805,10 +2809,54 @@ linters:
28052809
- fmt
28062810
# https://staticcheck.dev/docs/configuration/options/#initialisms
28072811
# Default: ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS"]
2808-
initialisms: [ "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS" ]
2812+
initialisms:
2813+
[
2814+
"ACL",
2815+
"API",
2816+
"ASCII",
2817+
"CPU",
2818+
"CSS",
2819+
"DNS",
2820+
"EOF",
2821+
"GUID",
2822+
"HTML",
2823+
"HTTP",
2824+
"HTTPS",
2825+
"ID",
2826+
"IP",
2827+
"JSON",
2828+
"QPS",
2829+
"RAM",
2830+
"RPC",
2831+
"SLA",
2832+
"SMTP",
2833+
"SQL",
2834+
"SSH",
2835+
"TCP",
2836+
"TLS",
2837+
"TTL",
2838+
"UDP",
2839+
"UI",
2840+
"GID",
2841+
"UID",
2842+
"UUID",
2843+
"URI",
2844+
"URL",
2845+
"UTF8",
2846+
"VM",
2847+
"XML",
2848+
"XMPP",
2849+
"XSRF",
2850+
"XSS",
2851+
"SIP",
2852+
"RTP",
2853+
"AMQP",
2854+
"DB",
2855+
"TS",
2856+
]
28092857
# https://staticcheck.dev/docs/configuration/options/#http_status_code_whitelist
28102858
# Default: ["200", "400", "404", "500"]
2811-
http-status-code-whitelist: [ "200", "400", "404", "500" ]
2859+
http-status-code-whitelist: ["200", "400", "404", "500"]
28122860
# SAxxxx checks in https://staticcheck.dev/docs/configuration/options/#checks
28132861
# Example (to disable some checks): [ "all", "-SA1000", "-SA1001"]
28142862
# Default: ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022"]
@@ -3404,8 +3452,7 @@ linters:
34043452
# Overrides the default/root configuration.
34053453
# Default: []
34063454
overrides:
3407-
-
3408-
# The package path (uses `/` only as a separator).
3455+
- # The package path (uses `/` only as a separator).
34093456
# Required
34103457
pkg: foo/bar
34113458
# Default: empty or the same as the default/root configuration.
@@ -3835,12 +3882,12 @@ linters:
38353882

38363883
# A list of call idents that everything can be cuddled with.
38373884
# Defaults: [ "Lock", "RLock" ]
3838-
allow-cuddle-with-calls: [ "Foo", "Bar" ]
3885+
allow-cuddle-with-calls: ["Foo", "Bar"]
38393886

38403887
# AllowCuddleWithRHS is a list of right hand side variables that is allowed
38413888
# to be cuddled with anything.
38423889
# Defaults: [ "Unlock", "RUnlock" ]
3843-
allow-cuddle-with-rhs: [ "Foo", "Bar" ]
3890+
allow-cuddle-with-rhs: ["Foo", "Bar"]
38443891

38453892
# Allow cuddling with any block as long as the variable is used somewhere in
38463893
# the block.
@@ -3857,7 +3904,7 @@ linters:
38573904
# When force-err-cuddling is enabled this is a list of names
38583905
# used for error variables to check for in the conditional.
38593906
# Default: [ "err" ]
3860-
error-variable-names: [ "foo" ]
3907+
error-variable-names: ["foo"]
38613908

38623909
# Causes an error if a short declaration (:=) cuddles with anything other than
38633910
# another short declaration.
@@ -3979,13 +4026,13 @@ formatters:
39794026
# If `custom-order` is `true`, it follows the order of `sections` option.
39804027
# Default: ["standard", "default"]
39814028
sections:
3982-
- standard # Standard section: captures all standard packages.
3983-
- default # Default section: contains all imports that could not be matched to another section type.
4029+
- standard # Standard section: captures all standard packages.
4030+
- default # Default section: contains all imports that could not be matched to another section type.
39844031
- prefix(github.com/org/project) # Custom section: groups all imports with the specified Prefix.
3985-
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
3986-
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
3987-
- alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
3988-
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
4032+
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
4033+
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
4034+
- alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
4035+
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
39894036

39904037
# Checks that no inline comments are present.
39914038
# Default: false
@@ -4012,10 +4059,10 @@ formatters:
40124059
# https://pkg.go.dev/cmd/gofmt
40134060
# Default: []
40144061
rewrite-rules:
4015-
- pattern: 'interface{}'
4016-
replacement: 'any'
4017-
- pattern: 'a[b:len(a)]'
4018-
replacement: 'a[b:]'
4062+
- pattern: "interface{}"
4063+
replacement: "any"
4064+
- pattern: "a[b:len(a)]"
4065+
replacement: "a[b:]"
40194066

40204067
gofumpt:
40214068
# Module path which contains the source code being formatted.
@@ -4114,7 +4161,6 @@ issues:
41144161
# Default: false
41154162
fix: true
41164163

4117-
41184164
# Output configuration options.
41194165
output:
41204166
# The formats used to render issues.
@@ -4217,7 +4263,6 @@ output:
42174263
# Default: true
42184264
show-stats: false
42194265

4220-
42214266
# Options for analysis running.
42224267
run:
42234268
# Timeout for total work, e.g. 30s, 5m, 5m30s.
@@ -4273,14 +4318,13 @@ run:
42734318

42744319
# Define the Go version limit.
42754320
# Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.22.
4276-
go: '1.23'
4321+
go: "1.23"
42774322

42784323
# Number of operating system threads (`GOMAXPROCS`) that can execute golangci-lint simultaneously.
42794324
# Default: 0 (automatically set to match Linux container CPU quota and
42804325
# fall back to the number of logical CPUs in the machine)
42814326
concurrency: 4
42824327

4283-
42844328
severity:
42854329
# Set the default severity for issues.
42864330
#

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ require (
7474
github.com/ldez/usetesting v0.4.3
7575
github.com/leonklingele/grouper v1.1.2
7676
github.com/macabu/inamedparam v0.2.0
77-
github.com/manuelarte/funcorder v0.2.1
77+
github.com/manuelarte/funcorder v0.3.0
7878
github.com/maratori/testableexamples v1.0.0
7979
github.com/maratori/testpackage v1.1.1
8080
github.com/matoous/godox v1.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)