cogolabs/fleet2kubes

View on GitHub

Showing 5 of 44 total issues

Method FlagSet.Parse has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
Open

func (f *FlagSet) Parse(arguments []string) error {
    f.parsed = true
    f.args = arguments
    f.actual = map[string]string{}
    f.env = map[string]string{}
Severity: Minor
Found in pkg/unit/mflag.go - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function NewCronJob has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

func NewCronJob(name, schedule, concurrencyPolicy, restartPolicy,
    image string, command []string, env map[string]string, resources Resources, annotations Annotations) *CronJob {
Severity: Minor
Found in pkg/kubes/cronjob.go - About 35 mins to fix

    Function NewDeployment has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func NewDeployment(name, image string, command []string, replicas, port int, env map[string]string,
        resources Resources) *Deployment {
    Severity: Minor
    Found in pkg/kubes/deployment.go - About 35 mins to fix

      Method FlagSet.parseOne has 5 return statements (exceeds 4 allowed).
      Open

      func (f *FlagSet) parseOne() (bool, string, error) {
          if len(f.args) == 0 {
              return false, "", nil
          }
          s := f.args[0]
      Severity: Major
      Found in pkg/unit/mflag.go - About 35 mins to fix

        Method Unit.ValidateAll has 5 return statements (exceeds 4 allowed).
        Open

        func (u *Unit) ValidateAll() error {
            if err := u.ValidateKeys(); err != nil {
                return err
            }
            if err := u.ValidateExecStartPre(); err != nil {
        Severity: Major
        Found in pkg/unit/validate.go - About 35 mins to fix
          Severity
          Category
          Status
          Source
          Language