auto-staging/stagectl

View on GitHub
helper/ask-environment.go

Summary

Maintainability
F
2 wks
Test Coverage

Function AskForEnvironmentAddInput has a Cognitive Complexity of 146 (exceeds 20 allowed). Consider refactoring.
Open

func AskForEnvironmentAddInput(env *types.EnvironmentPost) {
    ui := &input.UI{
        Writer: os.Stdout,
        Reader: os.Stdin,
    }
Severity: Minor
Found in helper/ask-environment.go - About 2 days 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 AskForEnvironmentUpdateInput has a Cognitive Complexity of 145 (exceeds 20 allowed). Consider refactoring.
Open

func AskForEnvironmentUpdateInput(env *types.EnvironmentPut) {
    ui := &input.UI{
        Writer: os.Stdout,
        Reader: os.Stdin,
    }
Severity: Minor
Found in helper/ask-environment.go - About 2 days 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 AskForEnvironmentAddInput has 269 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func AskForEnvironmentAddInput(env *types.EnvironmentPost) {
    ui := &input.UI{
        Writer: os.Stdout,
        Reader: os.Stdin,
    }
Severity: Major
Found in helper/ask-environment.go - About 1 day to fix

    Function AskForEnvironmentUpdateInput has 267 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func AskForEnvironmentUpdateInput(env *types.EnvironmentPut) {
        ui := &input.UI{
            Writer: os.Stdout,
            Reader: os.Stdin,
        }
    Severity: Major
    Found in helper/ask-environment.go - About 1 day to fix

      File ask-environment.go has 549 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      package helper
      
      import (
          "fmt"
          "log"
      Severity: Minor
      Found in helper/ask-environment.go - About 3 hrs to fix

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

            for choice := -1; choice != 0; {
                fmt.Printf("\nEnvironmentVariables: \n")
                for i, v := range env.EnvironmentVariables {
                    fmt.Printf("EnvironmentVariables %d \n", i)
                    fmt.Printf("    Name %s | Type %s | Value %s \n \n", v.Name, v.Type, v.Value)
        Severity: Major
        Found in helper/ask-environment.go and 2 other locations - About 1 day to fix
        helper/ask-environment.go on lines 505..615
        helper/ask-general-config.go on lines 183..293

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

        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

            for choice := -1; choice != 0; {
                fmt.Printf("\nEnvironmentVariables: \n")
                for i, v := range env.EnvironmentVariables {
                    fmt.Printf("EnvironmentVariables %d \n", i)
                    fmt.Printf("    Name %s | Type %s | Value %s \n \n", v.Name, v.Type, v.Value)
        Severity: Major
        Found in helper/ask-environment.go and 2 other locations - About 1 day to fix
        helper/ask-environment.go on lines 201..311
        helper/ask-general-config.go on lines 183..293

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

        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 6 locations. Consider refactoring.
        Open

            for choice := -1; choice != 0; {
                fmt.Printf("\nSchutdownSchedules: \n")
                for i, v := range env.ShutdownSchedules {
                    fmt.Printf("SchutdownSchedule %d \n", i)
                    fmt.Printf("    Cron %s \n \n", v.Cron)
        Severity: Major
        Found in helper/ask-environment.go and 5 other locations - About 1 day to fix
        helper/ask-environment.go on lines 40..118
        helper/ask-environment.go on lines 120..198
        helper/ask-environment.go on lines 424..502
        helper/ask-general-config.go on lines 22..100
        helper/ask-general-config.go on lines 102..180

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

        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 6 locations. Consider refactoring.
        Open

            for choice := -1; choice != 0; {
                fmt.Printf("\nSchutdownSchedules: \n")
                for i, v := range env.ShutdownSchedules {
                    fmt.Printf("SchutdownSchedule %d \n", i)
                    fmt.Printf("    Cron %s \n \n", v.Cron)
        Severity: Major
        Found in helper/ask-environment.go and 5 other locations - About 1 day to fix
        helper/ask-environment.go on lines 120..198
        helper/ask-environment.go on lines 344..422
        helper/ask-environment.go on lines 424..502
        helper/ask-general-config.go on lines 22..100
        helper/ask-general-config.go on lines 102..180

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

        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 6 locations. Consider refactoring.
        Open

            for choice := -1; choice != 0; {
                fmt.Printf("\nStartupSchedules: \n")
                for i, v := range env.StartupSchedules {
                    fmt.Printf("StartupSchedules %d \n", i)
                    fmt.Printf("    Cron %s \n \n", v.Cron)
        Severity: Major
        Found in helper/ask-environment.go and 5 other locations - About 1 day to fix
        helper/ask-environment.go on lines 40..118
        helper/ask-environment.go on lines 120..198
        helper/ask-environment.go on lines 344..422
        helper/ask-general-config.go on lines 22..100
        helper/ask-general-config.go on lines 102..180

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

        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 6 locations. Consider refactoring.
        Open

            for choice := -1; choice != 0; {
                fmt.Printf("\nStartupSchedules: \n")
                for i, v := range env.StartupSchedules {
                    fmt.Printf("StartupSchedules %d \n", i)
                    fmt.Printf("    Cron %s \n \n", v.Cron)
        Severity: Major
        Found in helper/ask-environment.go and 5 other locations - About 1 day to fix
        helper/ask-environment.go on lines 40..118
        helper/ask-environment.go on lines 344..422
        helper/ask-environment.go on lines 424..502
        helper/ask-general-config.go on lines 22..100
        helper/ask-general-config.go on lines 102..180

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

        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

        There are no issues that match your filters.

        Category
        Status