Skip to content

build(deps): bump github.com/daixiang0/gci from 0.13.4 to 0.13.5 #4975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,10 @@ linters-settings:
# Default: false
custom-order: true

# Drops lexical ordering for custom sections.
# Default: false
no-lex-order: true

ginkgolinter:
# Suppress the wrong length assertion warning.
# Default: false
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
github.com/charithe/durationcheck v0.0.10
github.com/ckaznocha/intrange v0.1.2
github.com/curioswitch/go-reassign v0.2.0
github.com/daixiang0/gci v0.13.4
github.com/daixiang0/gci v0.13.5
github.com/denis-tingaikin/go-header v0.5.0
github.com/fatih/color v1.17.0
github.com/firefart/nonamedreturns v1.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,11 @@
"description": "Enable custom order of sections.",
"type": "boolean",
"default": false
},
"no-lex-order": {
"description": "Drops lexical ordering for custom sections.",
"type": "boolean",
"default": false
}
}
},
Expand Down
1 change: 1 addition & 0 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ type GciSettings struct {
Sections []string `mapstructure:"sections"`
SkipGenerated bool `mapstructure:"skip-generated"`
CustomOrder bool `mapstructure:"custom-order"`
NoLexOrder bool `mapstructure:"no-lex-order"`

// Deprecated: use Sections instead.
LocalPrefixes string `mapstructure:"local-prefixes"`
Expand Down
10 changes: 6 additions & 4 deletions pkg/golinters/gci/gci.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func New(settings *config.GciSettings) *goanalysis.Linter {
Cfg: gcicfg.BoolConfig{
SkipGenerated: settings.SkipGenerated,
CustomOrder: settings.CustomOrder,
NoLexOrder: settings.NoLexOrder,
},
SectionStrings: settings.Sections,
}
Expand Down Expand Up @@ -195,7 +196,7 @@ func diffFormattedFilesToArray(paths []string, cfg gcicfg.Config, diffs *[]strin
}

// Code below this comment is borrowed and modified from gci.
// https://github.com/daixiang0/gci/blob/4725b0c101801e7449530eee2ddb0c72592e3405/pkg/config/config.go
// https://github.com/daixiang0/gci/blob/v0.13.5/pkg/config/config.go

var defaultOrder = map[string]int{
section.StandardType: 0,
Expand Down Expand Up @@ -229,10 +230,11 @@ func (g YamlConfig) Parse() (*gcicfg.Config, error) {
sort.Slice(sections, func(i, j int) bool {
sectionI, sectionJ := sections[i].Type(), sections[j].Type()

if strings.Compare(sectionI, sectionJ) == 0 {
return strings.Compare(sections[i].String(), sections[j].String()) < 0
if g.origin.Cfg.NoLexOrder || strings.Compare(sectionI, sectionJ) != 0 {
return defaultOrder[sectionI] < defaultOrder[sectionJ]
}
return defaultOrder[sectionI] < defaultOrder[sectionJ]

return strings.Compare(sections[i].String(), sections[j].String()) < 0
})
}

Expand Down
Loading