Skip to content

Commit a7201b4

Browse files
committed
chore: update implementation
1 parent f2d5ec2 commit a7201b4

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

.golangci.next.reference.yml

Lines changed: 3 additions & 0 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.

jsonschema/golangci.next.jsonschema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,11 @@
13171317
"description": "Checks if the exported methods of a structure are placed before the non-exported ones.",
13181318
"type": "boolean",
13191319
"default": true
1320+
},
1321+
"alphabetical": {
1322+
"description": "Checks if the constructors and/or structure methods are sorted alphabetically.",
1323+
"type": "boolean",
1324+
"default": false
13201325
}
13211326
}
13221327
},

pkg/config/linters_settings.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ type ForbidigoPattern struct {
428428
type FuncOrderSettings struct {
429429
Constructor bool `mapstructure:"constructor,omitempty"`
430430
StructMethod bool `mapstructure:"struct-method,omitempty"`
431+
Alphabetical bool `mapstructure:"alphabetical,omitempty"`
431432
}
432433

433434
type FunlenSettings struct {

pkg/golinters/funcorder/funcorder.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func New(settings *config.FuncOrderSettings) *goanalysis.Linter {
1717
cfg[a.Name] = map[string]any{
1818
analyzer.ConstructorCheckName: settings.Constructor,
1919
analyzer.StructMethodCheckName: settings.StructMethod,
20+
analyzer.AlphabeticalCheckName: settings.Alphabetical,
2021
}
2122
}
2223

0 commit comments

Comments
 (0)