From 7b4377ad9d8a7205416df8d6217ef2b010f89481 Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Wed, 22 Jan 2025 16:07:17 +0100 Subject: vendor: delete --- vendor/gitlab.com/bosi/decorder/.gitignore | 7 - .../gitlab.com/bosi/decorder/.gitlab-ci.params.yml | 15 -- vendor/gitlab.com/bosi/decorder/.gitlab-ci.yml | 63 ----- vendor/gitlab.com/bosi/decorder/LICENSE.md | 16 -- vendor/gitlab.com/bosi/decorder/Makefile | 7 - vendor/gitlab.com/bosi/decorder/README.md | 50 ---- vendor/gitlab.com/bosi/decorder/analyzer.go | 255 --------------------- vendor/gitlab.com/bosi/decorder/renovate.json | 7 - 8 files changed, 420 deletions(-) delete mode 100644 vendor/gitlab.com/bosi/decorder/.gitignore delete mode 100644 vendor/gitlab.com/bosi/decorder/.gitlab-ci.params.yml delete mode 100644 vendor/gitlab.com/bosi/decorder/.gitlab-ci.yml delete mode 100644 vendor/gitlab.com/bosi/decorder/LICENSE.md delete mode 100644 vendor/gitlab.com/bosi/decorder/Makefile delete mode 100644 vendor/gitlab.com/bosi/decorder/README.md delete mode 100644 vendor/gitlab.com/bosi/decorder/analyzer.go delete mode 100644 vendor/gitlab.com/bosi/decorder/renovate.json (limited to 'vendor/gitlab.com') diff --git a/vendor/gitlab.com/bosi/decorder/.gitignore b/vendor/gitlab.com/bosi/decorder/.gitignore deleted file mode 100644 index 48baa654b..000000000 --- a/vendor/gitlab.com/bosi/decorder/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/.idea -/.env -/.env.example -/decorder -/LICENSES-3RD-PARTY -/ytt -/yq \ No newline at end of file diff --git a/vendor/gitlab.com/bosi/decorder/.gitlab-ci.params.yml b/vendor/gitlab.com/bosi/decorder/.gitlab-ci.params.yml deleted file mode 100644 index fe6b85288..000000000 --- a/vendor/gitlab.com/bosi/decorder/.gitlab-ci.params.yml +++ /dev/null @@ -1,15 +0,0 @@ -#@data/values ---- - -app: - name: decorder - -code_quality: - enable_tests: true - enable_static_code_analyses: true - enable_license_check: true - -deployment: - enable_rc_handling: false - use_gitlab_container_registry: false - enable_image_build_and_deploy: false diff --git a/vendor/gitlab.com/bosi/decorder/.gitlab-ci.yml b/vendor/gitlab.com/bosi/decorder/.gitlab-ci.yml deleted file mode 100644 index 0e7ed1b7a..000000000 --- a/vendor/gitlab.com/bosi/decorder/.gitlab-ci.yml +++ /dev/null @@ -1,63 +0,0 @@ -############################### -# This file is auto-generated # -############################### - -variables: - APP_NAME: decorder - -stages: - - test - - build - - release - -test: - stage: test - image: golang:1.22.2@sha256:450e3822c7a135e1463cd83e51c8e2eb03b86a02113c89424e6f0f8344bb4168 - before_script: - - set -eu - - if [[ -f .env.pipeline ]];then cp .env.pipeline .env;fi - - mkdir -p ~/.ssh - - touch ~/.ssh/known_hosts - - ssh-keyscan gitlab.com > ~/.ssh/known_hosts - retry: 2 - script: - - '### run tests ###' - - make test - - make test-cover - -lint:source-code: - stage: test - image: golangci/golangci-lint:v1.55.2-alpine@sha256:22e4dd2bba6ad3c6ef918432b92329b51e82d55e470d268d315bfff6a160bceb - script: - - apk add make bash - - make settings - - '### run linter ###' - - golangci-lint run ./... - -license-check: - stage: test - image: golang:1.22.2@sha256:450e3822c7a135e1463cd83e51c8e2eb03b86a02113c89424e6f0f8344bb4168 - before_script: - - set -eu - - if [[ -f .env.pipeline ]];then cp .env.pipeline .env;fi - - mkdir -p ~/.ssh - - touch ~/.ssh/known_hosts - - ssh-keyscan gitlab.com > ~/.ssh/known_hosts - script: - - '### run license-check ###' - - make check-licenses - artifacts: - paths: - - LICENSES-3RD-PARTY - expire_in: 7 days - -pages: - stage: release - image: golang:1.22.2@sha256:450e3822c7a135e1463cd83e51c8e2eb03b86a02113c89424e6f0f8344bb4168 - only: - - tags - script: - - make gitlab-pages - artifacts: - paths: - - public/ diff --git a/vendor/gitlab.com/bosi/decorder/LICENSE.md b/vendor/gitlab.com/bosi/decorder/LICENSE.md deleted file mode 100644 index d46c30e18..000000000 --- a/vendor/gitlab.com/bosi/decorder/LICENSE.md +++ /dev/null @@ -1,16 +0,0 @@ -MIT License - -Copyright (c) 2021 Florian Bosdorff - -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. \ No newline at end of file diff --git a/vendor/gitlab.com/bosi/decorder/Makefile b/vendor/gitlab.com/bosi/decorder/Makefile deleted file mode 100644 index 8d4c05690..000000000 --- a/vendor/gitlab.com/bosi/decorder/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include project-templates/base.mk - -project-templates/base.mk: - @cp -ar ~/.dotfiles/projects/golang ./project-templates - -.env: - touch .env \ No newline at end of file diff --git a/vendor/gitlab.com/bosi/decorder/README.md b/vendor/gitlab.com/bosi/decorder/README.md deleted file mode 100644 index 5947e5ca2..000000000 --- a/vendor/gitlab.com/bosi/decorder/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# Decorder - -A declaration order linter for Go. In case of this tool declarations are `type`, `const`, `var` and `func`. - -## Rules - -This linter applies multiple rules where each can be disabled via cli parameter. - -| rule | description | cli-options | -|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| declaration order | Enforces the order of global declarations (e.g. all global constants are always defined before variables).
You can also define a subset of declarations if you don't want to enforce the order of all of them. | * disable all checks: `-disable-dec-order-check`
* disable type checks: `-disable-type-dec-order-check`
* disable const checks: `-disable-const-dec-order-check`
* disable var checks: `-disable-var-dec-order-check`
* custom order: `-dec-order var,const,func,type` | -| declaration number | Enforces that the statements const, var and type are only used once per file. You have to use parenthesis
to declare e.g multiple global types inside a file. | disable check: `-disable-dec-num-check` | -| init func first | Enforces the init func to be the first function in file. | disable check: `-disable-init-func-first-check` | - -You may find the implementation of the rules inside `analyzer.go`. - -Underscore var declarations can be ignored via `-ignore-underscore-vars`. - -## Installation - -```shell -go install gitlab.com/bosi/decorder/cmd/decorder -``` - -You can use the linter via golangci-lint as well: https://golangci-lint.run/usage/linters/#decorder. - -## Usage - -```shell -# with default options -decorder ./... - -# custom declaration order -decorder -dec-order var,const,func,type ./... - -# disable declaration order check -decorder -disable-dec-order-check ./... - -# disable check for multiple declarations statements -decorder -disable-dec-num-check ./... - -# disable check for multiple declarations (var only) statements -decorder -disable-var-dec-num-check ./... - -# disable check that init func is always first function -decorder -disable-init-func-first-check ./... - -# ignore underscore variables for all checks -decorder -ignore-underscore-vars ./... -``` \ No newline at end of file diff --git a/vendor/gitlab.com/bosi/decorder/analyzer.go b/vendor/gitlab.com/bosi/decorder/analyzer.go deleted file mode 100644 index 08f82ccc1..000000000 --- a/vendor/gitlab.com/bosi/decorder/analyzer.go +++ /dev/null @@ -1,255 +0,0 @@ -package decorder - -import ( - "fmt" - "go/ast" - "go/token" - "strings" - "sync" - - "golang.org/x/tools/go/analysis" -) - -type ( - decNumChecker struct { - tokenMap map[string]token.Token - tokenCounts map[token.Token]int - decOrder []string - funcPoss []funcPos - } - - options struct { - decOrder string - ignoreUnderscoreVars bool - disableDecNumCheck bool - disableTypeDecNumCheck bool - disableConstDecNumCheck bool - disableVarDecNumCheck bool - disableDecOrderCheck bool - disableInitFuncFirstCheck bool - } - - funcPos struct { - start token.Pos - end token.Pos - } -) - -const ( - Name = "decorder" - - FlagDo = "dec-order" - FlagIuv = "ignore-underscore-vars" - FlagDdnc = "disable-dec-num-check" - FlagDtdnc = "disable-type-dec-num-check" - FlagDcdnc = "disable-const-dec-num-check" - FlagDvdnc = "disable-var-dec-num-check" - FlagDdoc = "disable-dec-order-check" - FlagDiffc = "disable-init-func-first-check" - - defaultDecOrder = "type,const,var,func" -) - -var ( - Analyzer = &analysis.Analyzer{ - Name: Name, - Doc: "check declaration order and count of types, constants, variables and functions", - Run: run, - } - - opts = options{} - - tokens = []token.Token{token.TYPE, token.CONST, token.VAR, token.FUNC} - - decNumConf = map[token.Token]bool{ - token.TYPE: false, - token.CONST: false, - token.VAR: false, - } - decLock sync.Mutex -) - -//nolint:lll -func init() { - Analyzer.Flags.StringVar(&opts.decOrder, FlagDo, defaultDecOrder, "define the required order of types, constants, variables and functions declarations inside a file") - Analyzer.Flags.BoolVar(&opts.ignoreUnderscoreVars, FlagIuv, false, "option to ignore underscore vars for dec order and dec num check") - Analyzer.Flags.BoolVar(&opts.disableDecNumCheck, FlagDdnc, false, "option to disable (all) checks for number of declarations inside file") - Analyzer.Flags.BoolVar(&opts.disableTypeDecNumCheck, FlagDtdnc, false, "option to disable check for number of type declarations inside file") - Analyzer.Flags.BoolVar(&opts.disableConstDecNumCheck, FlagDcdnc, false, "option to disable check for number of const declarations inside file") - Analyzer.Flags.BoolVar(&opts.disableVarDecNumCheck, FlagDvdnc, false, "option to disable check for number of var declarations inside file") - Analyzer.Flags.BoolVar(&opts.disableDecOrderCheck, FlagDdoc, false, "option to disable check for order of declarations inside file") - Analyzer.Flags.BoolVar(&opts.disableInitFuncFirstCheck, FlagDiffc, false, "option to disable check that init function is always first function in file") -} - -func initDec() { - decLock.Lock() - decNumConf[token.TYPE] = opts.disableTypeDecNumCheck - decNumConf[token.CONST] = opts.disableConstDecNumCheck - decNumConf[token.VAR] = opts.disableVarDecNumCheck - decLock.Unlock() -} - -func run(pass *analysis.Pass) (interface{}, error) { - initDec() - - for _, f := range pass.Files { - ast.Inspect(f, runDeclNumAndDecOrderCheck(pass)) - - if !opts.disableInitFuncFirstCheck { - ast.Inspect(f, runInitFuncFirstCheck(pass)) - } - } - - return nil, nil -} - -func runInitFuncFirstCheck(pass *analysis.Pass) func(ast.Node) bool { - nonInitFound := false - - return func(n ast.Node) bool { - dec, ok := n.(*ast.FuncDecl) - if !ok { - return true - } - - if dec.Name.Name == "init" && dec.Recv == nil { - if nonInitFound { - pass.Reportf(dec.Pos(), "init func must be the first function in file") - } - } else { - nonInitFound = true - } - - return true - } -} - -func runDeclNumAndDecOrderCheck(pass *analysis.Pass) func(ast.Node) bool { - dnc := newDecNumChecker() - - if opts.disableDecNumCheck && opts.disableDecOrderCheck { - return func(n ast.Node) bool { - return true - } - } - - return func(n ast.Node) bool { - fd, ok := n.(*ast.FuncDecl) - if ok { - return dnc.handleFuncDec(fd, pass) - } - - gd, ok := n.(*ast.GenDecl) - if !ok { - return true - } - - if dnc.isInsideFunction(gd) { - return true - } - - dnc.handleGenDecl(gd, pass) - - if !opts.disableDecOrderCheck { - dnc.handleDecOrderCheck(gd, pass) - } - - return true - } -} - -func newDecNumChecker() decNumChecker { - dnc := decNumChecker{ - tokenMap: map[string]token.Token{}, - tokenCounts: map[token.Token]int{}, - decOrder: []string{}, - funcPoss: []funcPos{}, - } - - for _, t := range tokens { - dnc.tokenCounts[t] = 0 - dnc.tokenMap[t.String()] = t - } - - for _, do := range strings.Split(opts.decOrder, ",") { - dnc.decOrder = append(dnc.decOrder, strings.TrimSpace(do)) - } - - return dnc -} - -func (dnc decNumChecker) isToLate(t token.Token) (string, bool) { - for i, do := range dnc.decOrder { - if do == t.String() { - for j := i + 1; j < len(dnc.decOrder); j++ { - if dnc.tokenCounts[dnc.tokenMap[dnc.decOrder[j]]] > 0 { - return dnc.decOrder[j], false - } - } - return "", true - } - } - - return "", true -} - -func (dnc *decNumChecker) handleGenDecl(gd *ast.GenDecl, pass *analysis.Pass) { - for _, t := range tokens { - if gd.Tok == t { - if opts.ignoreUnderscoreVars && declName(gd) == "_" { - continue - } - - dnc.tokenCounts[t]++ - - if !opts.disableDecNumCheck && !decNumConf[t] && dnc.tokenCounts[t] > 1 { - pass.Reportf(gd.Pos(), "multiple \"%s\" declarations are not allowed; use parentheses instead", t.String()) - } - } - } -} - -func declName(gd *ast.GenDecl) string { - for _, spec := range gd.Specs { - s, ok := spec.(*ast.ValueSpec) - if ok && len(s.Names) > 0 && s.Names[0] != nil { - return s.Names[0].Name - } - } - return "" -} - -func (dnc decNumChecker) handleDecOrderCheck(gd *ast.GenDecl, pass *analysis.Pass) { - l, c := dnc.isToLate(gd.Tok) - if !c { - pass.Reportf(gd.Pos(), fmtWrongOrderMsg(gd.Tok.String(), l)) - } -} - -func (dnc decNumChecker) isInsideFunction(dn *ast.GenDecl) bool { - for _, poss := range dnc.funcPoss { - if poss.start < dn.Pos() && poss.end > dn.Pos() { - return true - } - } - return false -} - -func (dnc *decNumChecker) handleFuncDec(fd *ast.FuncDecl, pass *analysis.Pass) bool { - dnc.funcPoss = append(dnc.funcPoss, funcPos{start: fd.Pos(), end: fd.End()}) - - dnc.tokenCounts[token.FUNC]++ - - if !opts.disableDecOrderCheck { - l, c := dnc.isToLate(token.FUNC) - if !c { - pass.Reportf(fd.Pos(), fmtWrongOrderMsg(token.FUNC.String(), l)) - } - } - - return true -} - -func fmtWrongOrderMsg(target string, notAfter string) string { - return fmt.Sprintf("%s must not be placed after %s (desired order: %s)", target, notAfter, opts.decOrder) -} diff --git a/vendor/gitlab.com/bosi/decorder/renovate.json b/vendor/gitlab.com/bosi/decorder/renovate.json deleted file mode 100644 index 60041578c..000000000 --- a/vendor/gitlab.com/bosi/decorder/renovate.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "gitlab>bosi/renovate-configs//configs/golang", - "gitlab>bosi/renovate-configs//configs/automerge" - ] -} -- cgit mrf-deployment