Showing 92 of 92 total issues

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

    c.Action(func(_ *kingpin.ParseContext) error {
        t, err := userconfig.Require()
        if err != nil {
            return err
        }
Severity: Major
Found in internal/cli/team/team.go and 1 other location - About 1 hr to fix
internal/cli/team/team.go on lines 618..636

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

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

    c.Action(func(_ *kingpin.ParseContext) error {
        t, err := userconfig.Require()
        if err != nil {
            return err
        }
Severity: Major
Found in internal/cli/team/team.go and 1 other location - About 1 hr to fix
internal/cli/team/team.go on lines 591..609

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

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 61 lines of code (exceeds 50 allowed). Consider refactoring.
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: Minor
Found in platform/lambda/lambda.go - About 1 hr to fix

    Function subscribe has a Cognitive Complexity of 27 (exceeds 20 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: 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 init has 60 lines of code (exceeds 50 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 1 hr to fix

      Function init has 59 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func init() {
          cmd := root.Command("logs", "Show log output.")
          cmd.Example(`up logs`, "Show logs from the past hour.")
          cmd.Example(`up logs -S 30m`, "Show logs from the past 30 minutes.")
          cmd.Example(`up logs -S 5h`, "Show logs from the past 5 hours.")
      Severity: Minor
      Found in internal/cli/logs/logs.go - About 1 hr to fix

        Method Platform.Prune has 57 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (p *Platform) Prune(region, stage string, versions int) error {
            p.events.Emit("prune", nil)
        
            if err := p.createRole(); err != nil {
                return errors.Wrap(err, "creating iam role")
        Severity: Minor
        Found in platform/lambda/prune.go - About 1 hr to fix

          Method Platform.createCerts has 57 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (p *Platform) createCerts() error {
              s := session.New(aws.NewConfig().WithRegion("us-east-1"))
              a := acm.New(s)
              var domains []string
          
          
          Severity: Minor
          Found in platform/lambda/lambda.go - About 1 hr to fix

            Function init has a Cognitive Complexity of 26 (exceeds 20 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 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

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

                        {
                            position299 := position
                            if buffer[position] != rune('n') {
                                goto l298
                            }
            Severity: Major
            Found in internal/logs/parser/grammar.peg.go and 1 other location - About 1 hr to fix
            internal/logs/parser/grammar.peg.go on lines 2207..2234

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

            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

                                    {
                                        position186 := position
                                        if buffer[position] != rune('a') {
                                            goto l185
                                        }
            Severity: Major
            Found in internal/logs/parser/grammar.peg.go and 1 other location - About 1 hr to fix
            internal/logs/parser/grammar.peg.go on lines 2886..2913

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

            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 'm':
                                                                {
                                                                    position31 := position
                                                                    {
                                                                        position32 := position
            Severity: Major
            Found in internal/logs/parser/grammar.peg.go and 2 other locations - About 1 hr to fix
            internal/logs/parser/grammar.peg.go on lines 734..763
            internal/logs/parser/grammar.peg.go on lines 794..823

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

            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 'k':
                                                                {
                                                                    position34 := position
                                                                    {
                                                                        position35 := position
            Severity: Major
            Found in internal/logs/parser/grammar.peg.go and 2 other locations - About 1 hr to fix
            internal/logs/parser/grammar.peg.go on lines 734..763
            internal/logs/parser/grammar.peg.go on lines 764..793

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

            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 'g':
                                                                {
                                                                    position28 := position
                                                                    {
                                                                        position29 := position
            Severity: Major
            Found in internal/logs/parser/grammar.peg.go and 2 other locations - About 1 hr to fix
            internal/logs/parser/grammar.peg.go on lines 764..793
            internal/logs/parser/grammar.peg.go on lines 794..823

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

            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 NewProgressInt(total int) *progress.Bar {
                b := progress.NewInt(total)
                b.Template(`{{.Bar}} {{.Percent | printf "%0.0f"}}% {{.Text}}`)
                b.Width = 35
                b.StartDelimiter = colors.Gray("|")
            Severity: Major
            Found in internal/util/util.go and 1 other location - About 1 hr to fix
            internal/util/util.go on lines 90..99

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

            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 NewInlineProgressInt(total int) *progress.Bar {
                b := progress.NewInt(total)
                b.Template(`{{.Bar}} {{.Percent | printf "%0.0f"}}% {{.Text}}`)
                b.Width = 20
                b.StartDelimiter = colors.Gray("|")
            Severity: Major
            Found in internal/util/util.go and 1 other location - About 1 hr to fix
            internal/util/util.go on lines 78..87

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

            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

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

            http.createServer((req, res) => {
              res.setHeader('X-Foo', 'bar')
              res.setHeader('Content-Type', 'text/plain; charset=utf-8')
              res.end('Hello World')
            }).listen(port)
            Severity: Major
            Found in http/static/testdata/dynamic/app.js and 1 other location - About 1 hr to fix
            handler/testdata/node/app.js on lines 4..10

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

            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

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

            http.createServer((req, res) => {
              res.setHeader('X-Foo', 'bar')
              res.setHeader('Content-Type', 'text/plain; charset=utf-8')
              res.end('Hello World')
            }).listen(port, '127.0.0.1', _ => {
            Severity: Major
            Found in handler/testdata/node/app.js and 1 other location - About 1 hr to fix
            http/static/testdata/dynamic/app.js on lines 4..8

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

            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 10 return statements (exceeds 4 allowed).
            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 1 hr to fix

              Method Platform.updateFunction has 10 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 1 hr to fix
                Severity
                Category
                Status
                Source
                Language