build(deps): bump github.com/daixiang0/gci from 0.3.4 to 0.4.0 (#2965)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
parent
9317da6cf0
commit
b8f1e2a549
@ -341,28 +341,17 @@ linters-settings:
|
|||||||
# DEPRECATED: use `sections` and `prefix(github.com/org/project)` instead.
|
# DEPRECATED: use `sections` and `prefix(github.com/org/project)` instead.
|
||||||
local-prefixes: github.com/org/project
|
local-prefixes: github.com/org/project
|
||||||
|
|
||||||
# Checks that no inline Comments are present.
|
|
||||||
# Default: false
|
|
||||||
no-inline-comments: true
|
|
||||||
|
|
||||||
# Checks that no prefix Comments(comment lines above an import) are present.
|
|
||||||
# Default: false
|
|
||||||
no-prefix-comments: true
|
|
||||||
|
|
||||||
# Section configuration to compare against.
|
# Section configuration to compare against.
|
||||||
# Section names are case-insensitive and may contain parameters in ().
|
# Section names are case-insensitive and may contain parameters in ().
|
||||||
# Default: ["standard", "default"]
|
# Default: ["standard", "default"]
|
||||||
sections:
|
sections:
|
||||||
- standard # Captures all standard packages if they do not match another section.
|
- standard # Captures all standard packages if they do not match another section.
|
||||||
- default # Contains all imports that could not be matched to another section type.
|
- default # Contains all imports that could not be matched to another section type.
|
||||||
- comment(your text here) # Prints the specified indented comment.
|
|
||||||
- newLine # Prints an empty line
|
|
||||||
- prefix(github.com/org/project) # Groups all imports with the specified Prefix.
|
- prefix(github.com/org/project) # Groups all imports with the specified Prefix.
|
||||||
|
|
||||||
# Separators that should be present between sections.
|
# Skip generated files.
|
||||||
# Default: ["newLine"]
|
# Default: true
|
||||||
section-separators:
|
skip-generated: false
|
||||||
- newLine
|
|
||||||
|
|
||||||
gocognit:
|
gocognit:
|
||||||
# Minimal code complexity to report
|
# Minimal code complexity to report
|
||||||
|
2
go.mod
2
go.mod
@ -20,7 +20,7 @@ require (
|
|||||||
github.com/breml/errchkjson v0.3.0
|
github.com/breml/errchkjson v0.3.0
|
||||||
github.com/butuzov/ireturn v0.1.1
|
github.com/butuzov/ireturn v0.1.1
|
||||||
github.com/charithe/durationcheck v0.0.9
|
github.com/charithe/durationcheck v0.0.9
|
||||||
github.com/daixiang0/gci v0.3.4
|
github.com/daixiang0/gci v0.4.0
|
||||||
github.com/denis-tingaikin/go-header v0.4.3
|
github.com/denis-tingaikin/go-header v0.4.3
|
||||||
github.com/esimonov/ifshort v1.0.4
|
github.com/esimonov/ifshort v1.0.4
|
||||||
github.com/fatih/color v1.13.0
|
github.com/fatih/color v1.13.0
|
||||||
|
5
go.sum
generated
5
go.sum
generated
@ -129,8 +129,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr
|
|||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/daixiang0/gci v0.3.4 h1:+EZ83znNs73C9ZBTM7xhNagMP6gJs5wlptiFiuce5BM=
|
github.com/daixiang0/gci v0.4.0 h1:WKWAjTsU05SQjDRpeyiJdYo4Jfh8nWpgctffJuqBXmc=
|
||||||
github.com/daixiang0/gci v0.3.4/go.mod h1:pB1j339Q+2sv/EyKd4dgvGXcaBGIErim+dlhLDtqeW4=
|
github.com/daixiang0/gci v0.4.0/go.mod h1:d0f+IJhr9loBtIq+ebwhRoTt1LGbPH96ih8bKlsRT9E=
|
||||||
github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
@ -681,6 +681,7 @@ github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw=
|
|||||||
github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8=
|
github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8=
|
||||||
github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 h1:kl4KhGNsJIbDHS9/4U9yQo1UcPQM0kOMJHn29EoH/Ro=
|
github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 h1:kl4KhGNsJIbDHS9/4U9yQo1UcPQM0kOMJHn29EoH/Ro=
|
||||||
github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk=
|
github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk=
|
||||||
|
github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk=
|
||||||
github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw=
|
github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw=
|
||||||
github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk=
|
github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk=
|
||||||
github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o=
|
github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o=
|
||||||
|
@ -31,8 +31,8 @@ var defaultLintersSettings = LintersSettings{
|
|||||||
ExcludeGodocExamples: true,
|
ExcludeGodocExamples: true,
|
||||||
},
|
},
|
||||||
Gci: GciSettings{
|
Gci: GciSettings{
|
||||||
Sections: []string{"standard", "default"},
|
Sections: []string{"standard", "default"},
|
||||||
SectionSeparator: []string{"newline"},
|
SkipGenerated: true,
|
||||||
},
|
},
|
||||||
Gocognit: GocognitSettings{
|
Gocognit: GocognitSettings{
|
||||||
MinComplexity: 30,
|
MinComplexity: 30,
|
||||||
@ -275,11 +275,9 @@ type FunlenSettings struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GciSettings struct {
|
type GciSettings struct {
|
||||||
LocalPrefixes string `mapstructure:"local-prefixes"` // Deprecated
|
LocalPrefixes string `mapstructure:"local-prefixes"` // Deprecated
|
||||||
NoInlineComments bool `mapstructure:"no-inline-comments"`
|
Sections []string `mapstructure:"sections"`
|
||||||
NoPrefixComments bool `mapstructure:"no-prefix-comments"`
|
SkipGenerated bool `mapstructure:"skip-generated"`
|
||||||
Sections []string `mapstructure:"sections"`
|
|
||||||
SectionSeparator []string `mapstructure:"section-separators"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type GocognitSettings struct {
|
type GocognitSettings struct {
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
gcicfg "github.com/daixiang0/gci/pkg/configuration"
|
gcicfg "github.com/daixiang0/gci/pkg/config"
|
||||||
"github.com/daixiang0/gci/pkg/gci"
|
"github.com/daixiang0/gci/pkg/gci"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/tools/go/analysis"
|
"golang.org/x/tools/go/analysis"
|
||||||
@ -27,15 +27,13 @@ func NewGci(settings *config.GciSettings) *goanalysis.Linter {
|
|||||||
Run: goanalysis.DummyRun,
|
Run: goanalysis.DummyRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
var cfg *gci.GciConfiguration
|
var cfg *gcicfg.Config
|
||||||
if settings != nil {
|
if settings != nil {
|
||||||
rawCfg := gci.GciStringConfiguration{
|
rawCfg := gcicfg.YamlConfig{
|
||||||
Cfg: gcicfg.FormatterConfiguration{
|
Cfg: gcicfg.BoolConfig{
|
||||||
NoInlineComments: settings.NoInlineComments,
|
SkipGenerated: settings.SkipGenerated,
|
||||||
NoPrefixComments: settings.NoPrefixComments,
|
|
||||||
},
|
},
|
||||||
SectionStrings: settings.Sections,
|
SectionStrings: settings.Sections,
|
||||||
SectionSeparatorStrings: settings.SectionSeparator,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if settings.LocalPrefixes != "" {
|
if settings.LocalPrefixes != "" {
|
||||||
@ -75,7 +73,7 @@ func NewGci(settings *config.GciSettings) *goanalysis.Linter {
|
|||||||
}).WithLoadMode(goanalysis.LoadModeSyntax)
|
}).WithLoadMode(goanalysis.LoadModeSyntax)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runGci(pass *analysis.Pass, lintCtx *linter.Context, cfg *gci.GciConfiguration, lock *sync.Mutex) ([]goanalysis.Issue, error) {
|
func runGci(pass *analysis.Pass, lintCtx *linter.Context, cfg *gcicfg.Config, lock *sync.Mutex) ([]goanalysis.Issue, error) {
|
||||||
var fileNames []string
|
var fileNames []string
|
||||||
for _, f := range pass.Files {
|
for _, f := range pass.Files {
|
||||||
pos := pass.Fset.PositionFor(f.Pos(), false)
|
pos := pass.Fset.PositionFor(f.Pos(), false)
|
||||||
@ -111,28 +109,20 @@ func runGci(pass *analysis.Pass, lintCtx *linter.Context, cfg *gci.GciConfigurat
|
|||||||
func getErrorTextForGci(settings config.GciSettings) string {
|
func getErrorTextForGci(settings config.GciSettings) string {
|
||||||
text := "File is not `gci`-ed"
|
text := "File is not `gci`-ed"
|
||||||
|
|
||||||
hasOptions := settings.NoInlineComments || settings.NoPrefixComments || len(settings.Sections) > 0 || len(settings.SectionSeparator) > 0
|
hasOptions := settings.SkipGenerated || len(settings.Sections) > 0
|
||||||
if !hasOptions {
|
if !hasOptions {
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
|
||||||
text += " with"
|
text += " with"
|
||||||
|
|
||||||
if settings.NoInlineComments {
|
if settings.SkipGenerated {
|
||||||
text += " -NoInlineComments"
|
text += " -skip-generated"
|
||||||
}
|
|
||||||
|
|
||||||
if settings.NoPrefixComments {
|
|
||||||
text += " -NoPrefixComments"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(settings.Sections) > 0 {
|
if len(settings.Sections) > 0 {
|
||||||
text += " -s " + strings.Join(settings.Sections, ",")
|
text += " -s " + strings.Join(settings.Sections, ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(settings.SectionSeparator) > 0 {
|
|
||||||
text += " -x " + strings.Join(settings.SectionSeparator, ",")
|
|
||||||
}
|
|
||||||
|
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user