Showing 92 of 92 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

                        case 'f':
                            if buffer[position] != rune('f') {
                                goto l307
                            }
                            position++
Severity: Major
Found in internal/logs/parser/grammar.peg.go and 2 other locations - About 55 mins to fix
internal/logs/parser/grammar.peg.go on lines 3122..3143
internal/logs/parser/grammar.peg.go on lines 3162..3183

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 125.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

                        case 'd':
                            if buffer[position] != rune('d') {
                                goto l307
                            }
                            position++
Severity: Major
Found in internal/logs/parser/grammar.peg.go and 2 other locations - About 55 mins to fix
internal/logs/parser/grammar.peg.go on lines 3100..3121
internal/logs/parser/grammar.peg.go on lines 3122..3143

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 125.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function init has 9 return statements (exceeds 4 allowed).
Open

func init() {
    cmd := root.Command("build", "Build zip file.")
    cmd.Example(`up build`, "Build archive and save to ./out.zip")
    cmd.Example(`up build > /tmp/out.zip`, "Build archive and output to file via stdout.")
    cmd.Example(`up build --size`, "Build archive and list files by size.")
Severity: Major
Found in internal/cli/build/build.go - About 55 mins to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

                            case 'e':
                                if buffer[position] != rune('e') {
                                    goto l307
                                }
                                position++
    Severity: Major
    Found in internal/logs/parser/grammar.peg.go and 2 other locations - About 55 mins to fix
    internal/logs/parser/grammar.peg.go on lines 3100..3121
    internal/logs/parser/grammar.peg.go on lines 3162..3183

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 125.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function init has 9 return statements (exceeds 4 allowed).
    Open

    func init() {
        cmd := root.Command("upgrade", "Install the latest or specified version of Up.")
        cmd.Example(`up upgrade`, "Upgrade to the latest version available.")
        cmd.Example(`up upgrade -t 0.4.4`, "Upgrade to the specified version.")
        target := cmd.Flag("target", "Target version for upgrade.").Short('t').String()
    Severity: Major
    Found in internal/cli/upgrade/upgrade.go - About 55 mins to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                              {
                                  position199 := position
                                  if buffer[position] != rune('o') {
                                      goto l198
                                  }
      Severity: Minor
      Found in internal/logs/parser/grammar.peg.go and 1 other location - About 50 mins to fix
      internal/logs/parser/grammar.peg.go on lines 2850..2873

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 120.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method Platform.updateFunction has 8 return statements (exceeds 4 allowed).
      Open

      func (p *Platform) updateFunction(c *lambda.Lambda, a *apigateway.APIGateway, up *s3manager.Uploader, region string, d up.Deploy) (version string, err error) {
          b := aws.String(p.getS3BucketName(region))
          k := aws.String(p.getS3Key(d.Stage))
      
          // upload
      Severity: Major
      Found in platform/lambda/lambda.go - About 50 mins to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    {
                        position294 := position
                        if buffer[position] != rune('i') {
                            goto l293
                        }
        Severity: Minor
        Found in internal/logs/parser/grammar.peg.go and 1 other location - About 50 mins to fix
        internal/logs/parser/grammar.peg.go on lines 2303..2326

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 120.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method Config.Load has 8 return statements (exceeds 4 allowed).
        Open

        func (c *Config) Load() error {
            path, err := c.path()
            if err != nil {
                return errors.Wrap(err, "getting path")
            }
        Severity: Major
        Found in internal/userconfig/userconfig.go - About 50 mins to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          func (c *Client) GetPlans(token string) (plans []Plan, err error) {
              res, err := c.request(token, "GET", "/billing/plans", nil)
              if err != nil {
                  return nil, err
              }
          Severity: Minor
          Found in internal/account/account.go and 1 other location - About 45 mins to fix
          internal/account/account.go on lines 177..186

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 117.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          func (c *Client) GetCards(token string) (cards []Card, err error) {
              res, err := c.request(token, "GET", "/billing/cards", nil)
              if err != nil {
                  return nil, err
              }
          Severity: Minor
          Found in internal/account/account.go and 1 other location - About 45 mins to fix
          internal/account/account.go on lines 189..198

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 117.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function login has 7 return statements (exceeds 4 allowed).
          Open

          func login(cmd *kingpin.Cmd) {
              c := cmd.Command("login", "Sign in to your account.")
              c.Example(`up team login`, "Sign in or create account with interactive prompt.")
              c.Example(`up team login --team apex-software`, "Sign in to a team using your existing email.")
              c.Example(`up team login --email tj@example.com --team apex-software`, "Sign in to a team with email.")
          Severity: Major
          Found in internal/cli/team/team.go - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            } else if v := e.String("version"); v != "" {
                                s += " (version " + v + ")"
                            }
            Severity: Major
            Found in reporter/text/text.go - About 45 mins to fix

              Function add has 7 return statements (exceeds 4 allowed).
              Open

              func add(cmd *kingpin.Cmd) {
                  c := cmd.Command("add", "Add a new team.")
                  name := c.Arg("name", "Name of the team.").Required().String()
              
                  c.Action(func(_ *kingpin.ParseContext) error {
              Severity: Major
              Found in internal/cli/team/team.go - About 45 mins to fix

                Function init has 7 return statements (exceeds 4 allowed).
                Open

                func init() {
                    cmd := root.Command("start", "Start development server.")
                    cmd.Example(`up start`, "Start development server on port 3000.")
                    cmd.Example(`up start -o`, "Start development server and open in the browser.")
                    cmd.Example(`up start --address :5000`, "Start development server on port 5000.")
                Severity: Major
                Found in internal/cli/start/start.go - About 45 mins to fix

                  Method Platform.createRole has 7 return statements (exceeds 4 allowed).
                  Open

                  func (p *Platform) createRole() error {
                      s := session.New(aws.NewConfig())
                      c := iam.New(s)
                  
                      name := p.roleName()
                  Severity: Major
                  Found in platform/lambda/lambda.go - About 45 mins to fix

                    Method Stack.Plan has 7 return statements (exceeds 4 allowed).
                    Open

                    func (s *Stack) Plan(versions resources.Versions) error {
                        c := s.config
                        tmpl := s.template(versions)
                        name := c.Name
                    
                    
                    Severity: Major
                    Found in platform/lambda/stack/stack.go - About 45 mins to fix

                      Function init has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func init() {
                          cmd := root.Command("build", "Build zip file.")
                          cmd.Example(`up build`, "Build archive and save to ./out.zip")
                          cmd.Example(`up build > /tmp/out.zip`, "Build archive and output to file via stdout.")
                          cmd.Example(`up build --size`, "Build archive and list files by size.")
                      Severity: Minor
                      Found in internal/cli/build/build.go - About 45 mins 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

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                                                          {
                                                                              position37 := position
                                                                              {
                                                                                  position38 := position
                                                                                  if buffer[position] != rune('b') {
                      Severity: Minor
                      Found in internal/logs/parser/grammar.peg.go and 1 other location - About 40 mins to fix
                      internal/logs/parser/grammar.peg.go on lines 862..885

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 111.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                                                      {
                                                                          position43 := position
                                                                          {
                                                                              position44 := position
                                                                              if buffer[position] != rune('s') {
                      Severity: Minor
                      Found in internal/logs/parser/grammar.peg.go and 1 other location - About 40 mins to fix
                      internal/logs/parser/grammar.peg.go on lines 825..848

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 111.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language