aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/sashamelentyev/interfacebloat
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2025-01-22 16:07:17 +0100
committerTaras Madan <tarasmadan@google.com>2025-01-23 10:42:36 +0000
commit7b4377ad9d8a7205416df8d6217ef2b010f89481 (patch)
treee6fec4fd12ff807a16d847923f501075bf71d16c /vendor/github.com/sashamelentyev/interfacebloat
parent475a4c203afb8b7d3af51c4fd32bb170ff32a45e (diff)
vendor: delete
Diffstat (limited to 'vendor/github.com/sashamelentyev/interfacebloat')
-rw-r--r--vendor/github.com/sashamelentyev/interfacebloat/LICENSE21
-rw-r--r--vendor/github.com/sashamelentyev/interfacebloat/pkg/analyzer/analyzer.go57
2 files changed, 0 insertions, 78 deletions
diff --git a/vendor/github.com/sashamelentyev/interfacebloat/LICENSE b/vendor/github.com/sashamelentyev/interfacebloat/LICENSE
deleted file mode 100644
index a52602b3d..000000000
--- a/vendor/github.com/sashamelentyev/interfacebloat/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2022 Sasha Melentyev
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/sashamelentyev/interfacebloat/pkg/analyzer/analyzer.go b/vendor/github.com/sashamelentyev/interfacebloat/pkg/analyzer/analyzer.go
deleted file mode 100644
index 4a6afdf8c..000000000
--- a/vendor/github.com/sashamelentyev/interfacebloat/pkg/analyzer/analyzer.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package analyzer
-
-import (
- "flag"
- "go/ast"
-
- "golang.org/x/tools/go/analysis"
- "golang.org/x/tools/go/analysis/passes/inspect"
- "golang.org/x/tools/go/ast/inspector"
-)
-
-const InterfaceMaxMethodsFlag = "max"
-
-const defaultMaxMethods = 10
-
-// New returns new interfacebloat analyzer.
-func New() *analysis.Analyzer {
- return &analysis.Analyzer{
- Name: "interfacebloat",
- Doc: "A linter that checks the number of methods inside an interface.",
- Run: run,
- Flags: flags(),
- Requires: []*analysis.Analyzer{inspect.Analyzer},
- }
-}
-
-func flags() flag.FlagSet {
- flags := flag.NewFlagSet("", flag.ExitOnError)
- flags.Int(InterfaceMaxMethodsFlag, 10, "maximum number of methods")
- return *flags
-}
-
-func run(pass *analysis.Pass) (interface{}, error) {
- maxMethods, ok := pass.Analyzer.Flags.Lookup(InterfaceMaxMethodsFlag).Value.(flag.Getter).Get().(int)
- if !ok {
- maxMethods = defaultMaxMethods
- }
-
- insp := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
-
- filter := []ast.Node{
- (*ast.InterfaceType)(nil),
- }
-
- insp.Preorder(filter, func(node ast.Node) {
- i, ok := node.(*ast.InterfaceType)
- if !ok {
- return
- }
-
- if len(i.Methods.List) > maxMethods {
- pass.Reportf(node.Pos(), `the interface has more than %d methods: %d`, maxMethods, len(i.Methods.List))
- }
- })
-
- return nil, nil
-}