aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/fzipp
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2022-09-05 14:27:54 +0200
committerGitHub <noreply@github.com>2022-09-05 12:27:54 +0000
commitb2f2446b46bf02821d90ebedadae2bf7ae0e880e (patch)
tree923cf42842918d6bebca1d6bbdc08abed54d274d /vendor/github.com/fzipp
parente6654faff4bcca4be92e9a8596fd4b77f747c39e (diff)
go.mod, vendor: update (#3358)
* go.mod, vendor: remove unnecessary dependencies Commands: 1. go mod tidy 2. go mod vendor * go.mod, vendor: update cloud.google.com/go Commands: 1. go get -u cloud.google.com/go 2. go mod tidy 3. go mod vendor * go.mod, vendor: update cloud.google.com/* Commands: 1. go get -u cloud.google.com/storage cloud.google.com/logging 2. go mod tidy 3. go mod vendor * go.mod, .golangci.yml, vendor: update *lint* Commands: 1. go get -u golang.org/x/tools github.com/golangci/golangci-lint@v1.47.0 2. go mod tidy 3. go mod vendor 4. edit .golangci.yml to suppress new errors (resolved in the same PR later) * all: fix lint errors hash.go: copy() recommended by gosimple parse.go: ent is never nil verifier.go: signal.Notify() with unbuffered channel is bad. Have no idea why. * .golangci.yml: adjust godot rules check-all is deprecated, but still work if you're hesitating too - I'll remove this commit
Diffstat (limited to 'vendor/github.com/fzipp')
-rw-r--r--vendor/github.com/fzipp/gocyclo/CHANGELOG.md22
-rw-r--r--vendor/github.com/fzipp/gocyclo/README.md5
-rw-r--r--vendor/github.com/fzipp/gocyclo/analyze.go35
-rw-r--r--vendor/github.com/fzipp/gocyclo/go.mod2
-rw-r--r--vendor/github.com/fzipp/gocyclo/recv.go26
-rw-r--r--vendor/github.com/fzipp/gocyclo/recv_pre118.go24
-rw-r--r--vendor/github.com/fzipp/gocyclo/stats.go2
7 files changed, 94 insertions, 22 deletions
diff --git a/vendor/github.com/fzipp/gocyclo/CHANGELOG.md b/vendor/github.com/fzipp/gocyclo/CHANGELOG.md
index 3959a62a5..c9bedfb3b 100644
--- a/vendor/github.com/fzipp/gocyclo/CHANGELOG.md
+++ b/vendor/github.com/fzipp/gocyclo/CHANGELOG.md
@@ -4,7 +4,27 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [0.3.1]
+## [0.6.0] - 2022-06-15
+### Changed
+- Breaking: remove meaningless `-total` and `-total-short` options
+
+## [0.5.1] - 2022-04-06
+### Fixed
+- Don't skip directories `.` and `..`
+
+## [0.5.0] - 2022-03-22
+### Changed
+- Ignore `vendor` and `testdata` directories and directories with names
+ that begin with `.` or `_`
+
+## [0.4.0] - 2021-12-19
+### Added
+- Support method receivers with type parameters introduced in Go 1.18
+
+### Changed
+- Use more efficient filepath.WalkDir instead of filepath.Walk
+
+## [0.3.1] - 2020-10-20
### Added
- Test coverage
diff --git a/vendor/github.com/fzipp/gocyclo/README.md b/vendor/github.com/fzipp/gocyclo/README.md
index f1056934c..d357b8ef7 100644
--- a/vendor/github.com/fzipp/gocyclo/README.md
+++ b/vendor/github.com/fzipp/gocyclo/README.md
@@ -1,6 +1,7 @@
# gocyclo
[![PkgGoDev](https://pkg.go.dev/badge/github.com/fzipp/gocyclo)](https://pkg.go.dev/github.com/fzipp/gocyclo)
+![Build Status](https://github.com/fzipp/gocyclo/workflows/build/badge.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/fzipp/gocyclo)](https://goreportcard.com/report/github.com/fzipp/gocyclo)
Gocyclo calculates
@@ -31,7 +32,7 @@ to smaller functions.
To install the `gocyclo` command, run
```
-$ go get github.com/fzipp/gocyclo/cmd/gocyclo
+$ go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
```
and put the resulting binary in one of your PATH directories if
@@ -50,8 +51,6 @@ Flags:
-top N show the top N most complex functions only
-avg, -avg-short show the average complexity over all functions;
the short option prints the value without a label
- -total, -total-short show the total complexity for all functions;
- the short option prints the value without a label
-ignore REGEX exclude files matching the given regular expression
The output fields for each line are:
diff --git a/vendor/github.com/fzipp/gocyclo/analyze.go b/vendor/github.com/fzipp/gocyclo/analyze.go
index c053e83e6..2d8bcff25 100644
--- a/vendor/github.com/fzipp/gocyclo/analyze.go
+++ b/vendor/github.com/fzipp/gocyclo/analyze.go
@@ -9,6 +9,7 @@ import (
"go/ast"
"go/parser"
"go/token"
+ "io/fs"
"log"
"os"
"path/filepath"
@@ -39,8 +40,11 @@ func Analyze(paths []string, ignore *regexp.Regexp) Stats {
}
func analyzeDir(dirname string, ignore *regexp.Regexp, stats Stats) Stats {
- filepath.Walk(dirname, func(path string, info os.FileInfo, err error) error {
- if err == nil && isGoFile(info) {
+ filepath.WalkDir(dirname, func(path string, entry fs.DirEntry, err error) error {
+ if isSkipDir(entry) {
+ return filepath.SkipDir
+ }
+ if err == nil && isGoFile(entry) {
stats = analyzeFile(path, ignore, stats)
}
return err
@@ -48,8 +52,19 @@ func analyzeDir(dirname string, ignore *regexp.Regexp, stats Stats) Stats {
return stats
}
-func isGoFile(f os.FileInfo) bool {
- return !f.IsDir() && strings.HasSuffix(f.Name(), ".go")
+var skipDirs = map[string]bool{
+ "testdata": true,
+ "vendor": true,
+}
+
+func isSkipDir(entry fs.DirEntry) bool {
+ return entry.IsDir() && (skipDirs[entry.Name()] ||
+ (strings.HasPrefix(entry.Name(), ".") && entry.Name() != "." && entry.Name() != "..") ||
+ strings.HasPrefix(entry.Name(), "_"))
+}
+
+func isGoFile(entry fs.DirEntry) bool {
+ return !entry.IsDir() && strings.HasSuffix(entry.Name(), ".go")
}
func analyzeFile(path string, ignore *regexp.Regexp, stats Stats) Stats {
@@ -137,15 +152,3 @@ func funcName(fn *ast.FuncDecl) string {
}
return fn.Name.Name
}
-
-// recvString returns a string representation of recv of the
-// form "T", "*T", or "BADRECV" (if not a proper receiver type).
-func recvString(recv ast.Expr) string {
- switch t := recv.(type) {
- case *ast.Ident:
- return t.Name
- case *ast.StarExpr:
- return "*" + recvString(t.X)
- }
- return "BADRECV"
-}
diff --git a/vendor/github.com/fzipp/gocyclo/go.mod b/vendor/github.com/fzipp/gocyclo/go.mod
index c80982786..1266f2f0d 100644
--- a/vendor/github.com/fzipp/gocyclo/go.mod
+++ b/vendor/github.com/fzipp/gocyclo/go.mod
@@ -1,3 +1,3 @@
module github.com/fzipp/gocyclo
-go 1.15
+go 1.18
diff --git a/vendor/github.com/fzipp/gocyclo/recv.go b/vendor/github.com/fzipp/gocyclo/recv.go
new file mode 100644
index 000000000..a5c82fef5
--- /dev/null
+++ b/vendor/github.com/fzipp/gocyclo/recv.go
@@ -0,0 +1,26 @@
+// Copyright 2021 Frederik Zipp. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build go1.18
+// +build go1.18
+
+package gocyclo
+
+import "go/ast"
+
+// recvString returns a string representation of recv of the
+// form "T", "*T", or "BADRECV" (if not a proper receiver type).
+func recvString(recv ast.Expr) string {
+ switch t := recv.(type) {
+ case *ast.Ident:
+ return t.Name
+ case *ast.StarExpr:
+ return "*" + recvString(t.X)
+ case *ast.IndexExpr:
+ return recvString(t.X)
+ case *ast.IndexListExpr:
+ return recvString(t.X)
+ }
+ return "BADRECV"
+}
diff --git a/vendor/github.com/fzipp/gocyclo/recv_pre118.go b/vendor/github.com/fzipp/gocyclo/recv_pre118.go
new file mode 100644
index 000000000..2fe2d0cdb
--- /dev/null
+++ b/vendor/github.com/fzipp/gocyclo/recv_pre118.go
@@ -0,0 +1,24 @@
+// Copyright 2021 Frederik Zipp. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !go1.18
+// +build !go1.18
+
+package gocyclo
+
+import "go/ast"
+
+// recvString returns a string representation of recv of the
+// form "T", "*T", or "BADRECV" (if not a proper receiver type).
+func recvString(recv ast.Expr) string {
+ switch t := recv.(type) {
+ case *ast.Ident:
+ return t.Name
+ case *ast.StarExpr:
+ return "*" + recvString(t.X)
+ case *ast.IndexExpr:
+ return recvString(t.X)
+ }
+ return "BADRECV"
+}
diff --git a/vendor/github.com/fzipp/gocyclo/stats.go b/vendor/github.com/fzipp/gocyclo/stats.go
index 90f5eefc2..0a377e4b6 100644
--- a/vendor/github.com/fzipp/gocyclo/stats.go
+++ b/vendor/github.com/fzipp/gocyclo/stats.go
@@ -52,7 +52,7 @@ func (s Stats) TotalComplexity() uint64 {
func (s Stats) SortAndFilter(top, over int) Stats {
result := make(Stats, len(s))
copy(result, s)
- sort.Sort(byComplexityDesc(result))
+ sort.Stable(byComplexityDesc(result))
for i, stat := range result {
if i == top {
return result[:i]