dev: enable funlen on repo (#668)
This commit is contained in:
parent
0b49095bae
commit
6864b2f764
@ -39,14 +39,43 @@ linters-settings:
|
|||||||
disabled-checks:
|
disabled-checks:
|
||||||
- wrapperFunc
|
- wrapperFunc
|
||||||
- dupImport # https://github.com/go-critic/go-critic/issues/845
|
- dupImport # https://github.com/go-critic/go-critic/issues/845
|
||||||
|
funlen:
|
||||||
|
lines: 70
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
enable-all: true
|
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
|
||||||
disable:
|
disable-all: true
|
||||||
- maligned
|
enable:
|
||||||
- prealloc
|
- bodyclose
|
||||||
- gochecknoglobals
|
- deadcode
|
||||||
|
- depguard
|
||||||
|
- dupl
|
||||||
|
- errcheck
|
||||||
- funlen
|
- funlen
|
||||||
|
- gochecknoinits
|
||||||
|
- goconst
|
||||||
|
- gocritic
|
||||||
|
- gocyclo
|
||||||
|
- gofmt
|
||||||
|
- goimports
|
||||||
|
- golint
|
||||||
|
- gosec
|
||||||
|
- gosimple
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
- interfacer
|
||||||
|
- lll
|
||||||
|
- misspell
|
||||||
|
- nakedret
|
||||||
|
- scopelint
|
||||||
|
- staticcheck
|
||||||
|
- structcheck
|
||||||
|
- stylecheck
|
||||||
|
- typecheck
|
||||||
|
- unconvert
|
||||||
|
- unparam
|
||||||
|
- unused
|
||||||
|
- varcheck
|
||||||
|
|
||||||
run:
|
run:
|
||||||
skip-dirs:
|
skip-dirs:
|
||||||
|
39
README.md
39
README.md
@ -859,14 +859,43 @@ linters-settings:
|
|||||||
disabled-checks:
|
disabled-checks:
|
||||||
- wrapperFunc
|
- wrapperFunc
|
||||||
- dupImport # https://github.com/go-critic/go-critic/issues/845
|
- dupImport # https://github.com/go-critic/go-critic/issues/845
|
||||||
|
funlen:
|
||||||
|
lines: 70
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
enable-all: true
|
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
|
||||||
disable:
|
disable-all: true
|
||||||
- maligned
|
enable:
|
||||||
- prealloc
|
- bodyclose
|
||||||
- gochecknoglobals
|
- deadcode
|
||||||
|
- depguard
|
||||||
|
- dupl
|
||||||
|
- errcheck
|
||||||
- funlen
|
- funlen
|
||||||
|
- gochecknoinits
|
||||||
|
- goconst
|
||||||
|
- gocritic
|
||||||
|
- gocyclo
|
||||||
|
- gofmt
|
||||||
|
- goimports
|
||||||
|
- golint
|
||||||
|
- gosec
|
||||||
|
- gosimple
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
- interfacer
|
||||||
|
- lll
|
||||||
|
- misspell
|
||||||
|
- nakedret
|
||||||
|
- scopelint
|
||||||
|
- staticcheck
|
||||||
|
- structcheck
|
||||||
|
- stylecheck
|
||||||
|
- typecheck
|
||||||
|
- unconvert
|
||||||
|
- unparam
|
||||||
|
- unused
|
||||||
|
- varcheck
|
||||||
|
|
||||||
run:
|
run:
|
||||||
skip-dirs:
|
skip-dirs:
|
||||||
|
2
go.mod
2
go.mod
@ -51,8 +51,8 @@ require (
|
|||||||
github.com/spf13/pflag v1.0.1
|
github.com/spf13/pflag v1.0.1
|
||||||
github.com/spf13/viper v1.0.2
|
github.com/spf13/viper v1.0.2
|
||||||
github.com/stretchr/testify v1.2.2
|
github.com/stretchr/testify v1.2.2
|
||||||
github.com/ultraware/funlen v0.0.1
|
|
||||||
github.com/timakin/bodyclose v0.0.0-00010101000000-87058b9bfcec
|
github.com/timakin/bodyclose v0.0.0-00010101000000-87058b9bfcec
|
||||||
|
github.com/ultraware/funlen v0.0.1
|
||||||
github.com/valyala/quicktemplate v1.1.1
|
github.com/valyala/quicktemplate v1.1.1
|
||||||
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a // indirect
|
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a // indirect
|
||||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313 // indirect
|
golang.org/x/sys v0.0.0-20190312061237-fead79001313 // indirect
|
||||||
|
@ -45,6 +45,7 @@ func wh(text string) string {
|
|||||||
return color.GreenString(text)
|
return color.GreenString(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:funlen
|
||||||
func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager, isFinalInit bool) {
|
func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager, isFinalInit bool) {
|
||||||
hideFlag := func(name string) {
|
hideFlag := func(name string) {
|
||||||
if err := fs.MarkHidden(name); err != nil {
|
if err := fs.MarkHidden(name); err != nil {
|
||||||
|
@ -3,6 +3,7 @@ package golinters
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"go/token"
|
"go/token"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/golangci/golangci-lint/pkg/lint/linter"
|
"github.com/golangci/golangci-lint/pkg/lint/linter"
|
||||||
"github.com/golangci/golangci-lint/pkg/result"
|
"github.com/golangci/golangci-lint/pkg/result"
|
||||||
@ -37,7 +38,7 @@ func (f Funlen) Run(ctx context.Context, lintCtx *linter.Context) ([]result.Issu
|
|||||||
Filename: i.Pos.Filename,
|
Filename: i.Pos.Filename,
|
||||||
Line: i.Pos.Line,
|
Line: i.Pos.Line,
|
||||||
},
|
},
|
||||||
Text: i.Message,
|
Text: strings.TrimRight(i.Message, "\n"),
|
||||||
FromLinter: f.Name(),
|
FromLinter: f.Name(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
"github.com/golangci/golangci-lint/pkg/lint/linter"
|
"github.com/golangci/golangci-lint/pkg/lint/linter"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//nolint:funlen
|
||||||
func TestGetEnabledLintersSet(t *testing.T) {
|
func TestGetEnabledLintersSet(t *testing.T) {
|
||||||
type cs struct {
|
type cs struct {
|
||||||
cfg config.Linters
|
cfg config.Linters
|
||||||
|
@ -77,6 +77,7 @@ func (Manager) GetMetaLinters() map[string]linter.MetaLinter {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:funlen
|
||||||
func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
|
func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
|
||||||
var govetCfg *config.GovetSettings
|
var govetCfg *config.GovetSettings
|
||||||
if m.cfg != nil {
|
if m.cfg != nil {
|
||||||
|
@ -48,6 +48,7 @@ func getOkLogger(ctrl *gomock.Controller) *logutils.MockLog {
|
|||||||
return log
|
return log
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:funlen
|
||||||
func TestNolint(t *testing.T) {
|
func TestNolint(t *testing.T) {
|
||||||
ctrl := gomock.NewController(t)
|
ctrl := gomock.NewController(t)
|
||||||
defer ctrl.Finish()
|
defer ctrl.Finish()
|
||||||
|
@ -74,6 +74,7 @@ func getEnabledByDefaultFastLintersWith(with ...string) []string {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:funlen
|
||||||
func TestEnabledLinters(t *testing.T) {
|
func TestEnabledLinters(t *testing.T) {
|
||||||
type tc struct {
|
type tc struct {
|
||||||
name string
|
name string
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
//
|
//
|
||||||
// Sources files are supplied as fullshort slice.
|
// Sources files are supplied as fullshort slice.
|
||||||
// It consists of pairs: full path to source file and its base name.
|
// It consists of pairs: full path to source file and its base name.
|
||||||
//nolint:gocyclo
|
//nolint:gocyclo,funlen
|
||||||
func errorCheck(outStr string, wantAuto bool, fullshort ...string) (err error) {
|
func errorCheck(outStr string, wantAuto bool, fullshort ...string) (err error) {
|
||||||
var errs []error
|
var errs []error
|
||||||
out := splitOutput(outStr, wantAuto)
|
out := splitOutput(outStr, wantAuto)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user