dev: enable funlen on repo (#668)

This commit is contained in:
Isaev Denis 2019-09-09 18:07:09 +03:00 committed by GitHub
parent 0b49095bae
commit 6864b2f764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 77 additions and 13 deletions

View File

@ -39,14 +39,43 @@ linters-settings:
disabled-checks:
- wrapperFunc
- dupImport # https://github.com/go-critic/go-critic/issues/845
funlen:
lines: 70
linters:
enable-all: true
disable:
- maligned
- prealloc
- gochecknoglobals
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dupl
- errcheck
- 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:
skip-dirs:

View File

@ -859,14 +859,43 @@ linters-settings:
disabled-checks:
- wrapperFunc
- dupImport # https://github.com/go-critic/go-critic/issues/845
funlen:
lines: 70
linters:
enable-all: true
disable:
- maligned
- prealloc
- gochecknoglobals
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dupl
- errcheck
- 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:
skip-dirs:

2
go.mod
View File

@ -51,8 +51,8 @@ require (
github.com/spf13/pflag v1.0.1
github.com/spf13/viper v1.0.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/ultraware/funlen v0.0.1
github.com/valyala/quicktemplate v1.1.1
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a // indirect
golang.org/x/sys v0.0.0-20190312061237-fead79001313 // indirect

View File

@ -45,6 +45,7 @@ func wh(text string) string {
return color.GreenString(text)
}
//nolint:funlen
func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager, isFinalInit bool) {
hideFlag := func(name string) {
if err := fs.MarkHidden(name); err != nil {

View File

@ -3,6 +3,7 @@ package golinters
import (
"context"
"go/token"
"strings"
"github.com/golangci/golangci-lint/pkg/lint/linter"
"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,
Line: i.Pos.Line,
},
Text: i.Message,
Text: strings.TrimRight(i.Message, "\n"),
FromLinter: f.Name(),
}
}

View File

@ -12,6 +12,7 @@ import (
"github.com/golangci/golangci-lint/pkg/lint/linter"
)
//nolint:funlen
func TestGetEnabledLintersSet(t *testing.T) {
type cs struct {
cfg config.Linters

View File

@ -77,6 +77,7 @@ func (Manager) GetMetaLinters() map[string]linter.MetaLinter {
return ret
}
//nolint:funlen
func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
var govetCfg *config.GovetSettings
if m.cfg != nil {

View File

@ -48,6 +48,7 @@ func getOkLogger(ctrl *gomock.Controller) *logutils.MockLog {
return log
}
//nolint:funlen
func TestNolint(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()

View File

@ -74,6 +74,7 @@ func getEnabledByDefaultFastLintersWith(with ...string) []string {
return ret
}
//nolint:funlen
func TestEnabledLinters(t *testing.T) {
type tc struct {
name string

View File

@ -22,7 +22,7 @@ import (
//
// Sources files are supplied as fullshort slice.
// 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) {
var errs []error
out := splitOutput(outStr, wantAuto)