aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/ultraware/funlen/main.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-09-15 18:05:35 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-09-15 19:34:30 +0200
commit712de1c63d9db97c81af68cd0dc4372c53d2e57a (patch)
treeae1761fec52c3ae4ddd003a4130ddbda8d0a2d69 /vendor/github.com/ultraware/funlen/main.go
parent298a69c38dd5c8a9bbd7a022e88f4ddbcf885e16 (diff)
vendor/github.com/golangci/golangci-lint: update to v1.31
Diffstat (limited to 'vendor/github.com/ultraware/funlen/main.go')
-rw-r--r--vendor/github.com/ultraware/funlen/main.go20
1 files changed, 13 insertions, 7 deletions
diff --git a/vendor/github.com/ultraware/funlen/main.go b/vendor/github.com/ultraware/funlen/main.go
index 19e48e2ff..2ba353002 100644
--- a/vendor/github.com/ultraware/funlen/main.go
+++ b/vendor/github.com/ultraware/funlen/main.go
@@ -7,8 +7,10 @@ import (
"reflect"
)
-const defaultLineLimit = 60
-const defaultStmtLimit = 40
+const (
+ defaultLineLimit = 60
+ defaultStmtLimit = 40
+)
// Run runs this linter on the provided code
func Run(file *ast.File, fset *token.FileSet, lineLimit, stmtLimit int) []Message {
@@ -26,13 +28,17 @@ func Run(file *ast.File, fset *token.FileSet, lineLimit, stmtLimit int) []Messag
continue
}
- if stmts := parseStmts(decl.Body.List); stmts > stmtLimit {
- msgs = append(msgs, makeStmtMessage(fset, decl.Name, stmts, stmtLimit))
- continue
+ if stmtLimit > 0 {
+ if stmts := parseStmts(decl.Body.List); stmts > stmtLimit {
+ msgs = append(msgs, makeStmtMessage(fset, decl.Name, stmts, stmtLimit))
+ continue
+ }
}
- if lines := getLines(fset, decl); lines > lineLimit {
- msgs = append(msgs, makeLineMessage(fset, decl.Name, lines, lineLimit))
+ if lineLimit > 0 {
+ if lines := getLines(fset, decl); lines > lineLimit {
+ msgs = append(msgs, makeLineMessage(fset, decl.Name, lines, lineLimit))
+ }
}
}