Showing 93 of 93 total issues

Method parser.Init has a Cognitive Complexity of 2639 (exceeds 20 allowed). Consider refactoring.
Open

func (p *parser) Init(options ...func(*parser) error) error {
    var (
        max                  token32
        position, tokenIndex uint32
        buffer               []rune
Severity: Minor
Found in internal/logs/parser/grammar.peg.go - About 1 mo 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

Method parser.Init has 2833 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (p *parser) Init(options ...func(*parser) error) error {
    var (
        max                  token32
        position, tokenIndex uint32
        buffer               []rune
Severity: Major
Found in internal/logs/parser/grammar.peg.go - About 2 wks to fix

    File grammar.peg.go has 3337 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package parser
    
    // Code generated by peg -inline -switch grammar.peg DO NOT EDIT
    
    import (
    Severity: Major
    Found in internal/logs/parser/grammar.peg.go - About 1 wk to fix

      File lambda.go has 764 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      // Package lambda implements the API Gateway & AWS Lambda platform.
      package lambda
      
      import (
          "bytes"
      Severity: Major
      Found in platform/lambda/lambda.go - About 1 day to fix

        Method reporter.Start has a Cognitive Complexity of 59 (exceeds 20 allowed). Consider refactoring.
        Open

        func (r *reporter) Start() {
            tick := time.NewTicker(150 * time.Millisecond)
            defer tick.Stop()
        
            render := term.Renderer()
        Severity: Minor
        Found in reporter/text/text.go - About 6 hrs 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

        Method reporter.Start has 156 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (r *reporter) Start() {
            tick := time.NewTicker(150 * time.Millisecond)
            defer tick.Stop()
        
            render := term.Renderer()
        Severity: Major
        Found in reporter/text/text.go - About 5 hrs to fix

          Platform has 38 methods (exceeds 20 allowed). Consider refactoring.
          Open

          type Platform struct {
              config  *up.Config
              runtime string
              handler string
              zip     *bytes.Buffer
          Severity: Minor
          Found in platform/lambda/lambda.go - About 5 hrs to fix

            Method parser.Init has 46 return statements (exceeds 4 allowed).
            Open

            func (p *parser) Init(options ...func(*parser) error) error {
                var (
                    max                  token32
                    position, tokenIndex uint32
                    buffer               []rune
            Severity: Major
            Found in internal/logs/parser/grammar.peg.go - About 4 hrs to fix

              File team.go has 561 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              package team
              
              import (
                  "context"
                  "encoding/base64"
              Severity: Minor
              Found in internal/cli/team/team.go - About 3 hrs to fix

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

                                                        case 'f':
                                                            {
                                                                position53 := position
                                                                {
                                                                    position54 := position
                Severity: Major
                Found in internal/logs/parser/grammar.peg.go and 1 other location - About 2 hrs to fix
                internal/logs/parser/grammar.peg.go on lines 980..1021

                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 212.

                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

                                                        case 'e':
                                                            {
                                                                position56 := position
                                                                {
                                                                    position57 := position
                Severity: Major
                Found in internal/logs/parser/grammar.peg.go and 1 other location - About 2 hrs to fix
                internal/logs/parser/grammar.peg.go on lines 938..979

                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 212.

                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 subscribe has 83 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func subscribe(cmd *kingpin.Cmd) {
                    c := cmd.Command("subscribe", "Subscribe to the Pro plan.")
                
                    c.Action(func(_ *kingpin.ParseContext) error {
                        t, err := userconfig.Require()
                Severity: Major
                Found in internal/cli/team/team.go - About 2 hrs to fix

                  Function login has 78 lines of code (exceeds 50 allowed). Consider refactoring.
                  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 2 hrs to fix

                    Function init has 75 lines of code (exceeds 50 allowed). Consider refactoring.
                    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: Minor
                    Found in internal/cli/upgrade/upgrade.go - About 2 hrs to fix

                      Method Stack.Plan has 75 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

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

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

                                                                case 'w':
                                                                    {
                                                                        position59 := position
                                                                        {
                                                                            position60 := position
                        Severity: Major
                        Found in internal/logs/parser/grammar.peg.go and 1 other location - About 2 hrs to fix
                        internal/logs/parser/grammar.peg.go on lines 1060..1097

                        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 188.

                        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

                                                                case 'i':
                                                                    {
                                                                        position62 := position
                                                                        {
                                                                            position63 := position
                        Severity: Major
                        Found in internal/logs/parser/grammar.peg.go and 1 other location - About 2 hrs to fix
                        internal/logs/parser/grammar.peg.go on lines 1022..1059

                        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 188.

                        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 parser.Execute has 74 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (p *parser) Execute() {
                            buffer, _buffer, text, begin, end := p.Buffer, p.buffer, "", 0, 0
                            for _, token := range p.Tokens() {
                                switch token.pegRule {
                        
                        
                        Severity: Minor
                        Found in internal/logs/parser/grammar.peg.go - About 1 hr to fix

                          Function login has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
                          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: Minor
                          Found in internal/cli/team/team.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 deploy has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func deploy(stage string, build bool) error {
                          retry:
                              c, p, err := root.Init()
                          
                              // missing up.json non-interactive
                          Severity: Minor
                          Found in internal/cli/deploy/deploy.go - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language