mirror of
https://github.com/foomo/posh-providers.git
synced 2025-10-16 12:35:41 +00:00
feat: fix lint errors
This commit is contained in:
parent
f3eb15e606
commit
cd827cd455
@ -40,7 +40,7 @@ linters:
|
|||||||
#- cyclop # checks function and package cyclomatic complexity [fast: false, auto-fix: false]
|
#- cyclop # checks function and package cyclomatic complexity [fast: false, auto-fix: false]
|
||||||
- decorder # check declaration order and count of types, constants, variables and functions [fast: true, auto-fix: false]
|
- decorder # check declaration order and count of types, constants, variables and functions [fast: true, auto-fix: false]
|
||||||
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
|
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
|
||||||
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
|
#- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
|
||||||
#- dupl # Tool for code clone detection [fast: true, auto-fix: false]
|
#- dupl # Tool for code clone detection [fast: true, auto-fix: false]
|
||||||
- dupword # Checks for duplicate words in the source code [fast: true, auto-fix: true]
|
- dupword # Checks for duplicate words in the source code [fast: true, auto-fix: true]
|
||||||
- durationcheck # check for two durations multiplied together [fast: false, auto-fix: false]
|
- durationcheck # check for two durations multiplied together [fast: false, auto-fix: false]
|
||||||
@ -79,7 +79,7 @@ linters:
|
|||||||
#- ireturn # Accept Interfaces, Return Concrete Types [fast: false, auto-fix: false]
|
#- ireturn # Accept Interfaces, Return Concrete Types [fast: false, auto-fix: false]
|
||||||
- loggercheck # Checks key valur pairs for common logger libraries (kitlog,klog,logr,zap). [fast: false, auto-fix: false]
|
- loggercheck # Checks key valur pairs for common logger libraries (kitlog,klog,logr,zap). [fast: false, auto-fix: false]
|
||||||
#- lll # Reports long lines [fast: true, auto-fix: false]
|
#- lll # Reports long lines [fast: true, auto-fix: false]
|
||||||
- maintidx # maintidx measures the maintainability index of each function. [fast: true, auto-fix: false]
|
#- maintidx # maintidx measures the maintainability index of each function. [fast: true, auto-fix: false]
|
||||||
- makezero # Finds slice declarations with non-zero initial length [fast: false, auto-fix: false]
|
- makezero # Finds slice declarations with non-zero initial length [fast: false, auto-fix: false]
|
||||||
- misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true]
|
- misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true]
|
||||||
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
|
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
|
||||||
|
|||||||
@ -20,6 +20,8 @@ import (
|
|||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const All = "all"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
Command struct {
|
Command struct {
|
||||||
l log.Logger
|
l log.Logger
|
||||||
@ -135,7 +137,7 @@ func NewCommand(l log.Logger, squadron *Squadron, kubectl *kubectl.Kubectl, op *
|
|||||||
inst.l.Debug(err.Error())
|
inst.l.Debug(err.Error())
|
||||||
return nil
|
return nil
|
||||||
} else {
|
} else {
|
||||||
return suggests.List(append(value, "all"))
|
return suggests.List(append(value, All))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Nodes: tree.Nodes{
|
Nodes: tree.Nodes{
|
||||||
@ -384,7 +386,7 @@ func (c *Command) execute(ctx context.Context, r *readline.Readline) error {
|
|||||||
env = append(env, c.kubectl.Cluster(cluster).Env())
|
env = append(env, c.kubectl.Cluster(cluster).Env())
|
||||||
|
|
||||||
var squadrons []string
|
var squadrons []string
|
||||||
if squadron == "all" {
|
if squadron == All {
|
||||||
if value, err := c.squadron.List(); err == nil {
|
if value, err := c.squadron.List(); err == nil {
|
||||||
squadrons = value
|
squadrons = value
|
||||||
}
|
}
|
||||||
@ -445,7 +447,7 @@ func (c *Command) notify(ctx context.Context, cmd, cluster, fleet, squadron, tag
|
|||||||
|
|
||||||
switch cmd {
|
switch cmd {
|
||||||
case "up":
|
case "up":
|
||||||
if squadron == "all" {
|
if squadron == All {
|
||||||
msg = c.slack.MarkdownSection(fmt.Sprintf("🚢 Full deployment to *%s* | *%s* _(%s)_", cluster, fleet, tag))
|
msg = c.slack.MarkdownSection(fmt.Sprintf("🚢 Full deployment to *%s* | *%s* _(%s)_", cluster, fleet, tag))
|
||||||
} else if len(units) == 0 {
|
} else if len(units) == 0 {
|
||||||
msg = c.slack.MarkdownSection(fmt.Sprintf("🛥 Deployment to *%s*\n\n- %s.all | *%s* _(%s)_\n", cluster, squadron, fleet, tag))
|
msg = c.slack.MarkdownSection(fmt.Sprintf("🛥 Deployment to *%s*\n\n- %s.all | *%s* _(%s)_\n", cluster, squadron, fleet, tag))
|
||||||
@ -457,7 +459,7 @@ func (c *Command) notify(ctx context.Context, cmd, cluster, fleet, squadron, tag
|
|||||||
msg = c.slack.MarkdownSection(fmt.Sprintf("🛶 Deployment to *%s* | *%s* _(%s)_\n\n%s\n", cluster, fleet, tag, strings.Join(str, "\n")))
|
msg = c.slack.MarkdownSection(fmt.Sprintf("🛶 Deployment to *%s* | *%s* _(%s)_\n\n%s\n", cluster, fleet, tag, strings.Join(str, "\n")))
|
||||||
}
|
}
|
||||||
case "down":
|
case "down":
|
||||||
if squadron == "all" {
|
if squadron == All {
|
||||||
msg = c.slack.MarkdownSection(fmt.Sprintf("🪦 Full uninstallation of *%s* | *%s*", cluster, fleet))
|
msg = c.slack.MarkdownSection(fmt.Sprintf("🪦 Full uninstallation of *%s* | *%s*", cluster, fleet))
|
||||||
} else if len(units) == 0 {
|
} else if len(units) == 0 {
|
||||||
msg = c.slack.MarkdownSection(fmt.Sprintf("💀 Uninstalling from *%s*\n\n- %s.all | *%s*\n", cluster, squadron, fleet))
|
msg = c.slack.MarkdownSection(fmt.Sprintf("💀 Uninstalling from *%s*\n\n- %s.all | *%s*\n", cluster, squadron, fleet))
|
||||||
|
|||||||
@ -64,7 +64,7 @@ func NewCommand(l log.Logger, kubectl *kubectl.Kubectl) *Command {
|
|||||||
Values: func(ctx context.Context, r *readline.Readline) []goprompt.Suggest {
|
Values: func(ctx context.Context, r *readline.Readline) []goprompt.Suggest {
|
||||||
return suggests.List(inst.kubectl.Clusters())
|
return suggests.List(inst.kubectl.Clusters())
|
||||||
},
|
},
|
||||||
Description: "cluster to run agains",
|
Description: "cluster to run against",
|
||||||
Nodes: tree.Nodes{
|
Nodes: tree.Nodes{
|
||||||
{
|
{
|
||||||
Name: "create",
|
Name: "create",
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/foomo/posh-providers/onepassword"
|
"github.com/foomo/posh-providers/onepassword"
|
||||||
"github.com/foomo/posh/pkg/log"
|
"github.com/foomo/posh/pkg/log"
|
||||||
"github.com/foomo/posh/pkg/util/git"
|
"github.com/foomo/posh/pkg/util/git"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"github.com/pterm/pterm"
|
"github.com/pterm/pterm"
|
||||||
"github.com/slack-go/slack"
|
"github.com/slack-go/slack"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
@ -87,12 +88,12 @@ func (s *Slack) Channel(id string) string {
|
|||||||
func (s *Slack) SendUserMessage(ctx context.Context, markdown, channel string, annotate bool) error {
|
func (s *Slack) SendUserMessage(ctx context.Context, markdown, channel string, annotate bool) error {
|
||||||
ch, ok := s.cfg.Channels[channel]
|
ch, ok := s.cfg.Channels[channel]
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("channel not found: %s", channel)
|
return errors.Errorf("channel not found: %s", channel)
|
||||||
}
|
}
|
||||||
|
|
||||||
user, err := git.ConfigUserName(ctx, s.l)
|
user, err := git.ConfigUserName(ctx, s.l)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get git user: %s", err.Error())
|
return errors.Wrap(err, "failed to get git user")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !annotate {
|
if !annotate {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user