jkawamoto/roadie-queue-manager

View on GitHub

Showing 11 of 11 total issues

Function run has 83 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func run(project, queue string) (err error) {
    logger := log.New(os.Stdout, "", 0)

    defer func() (err error) {

Severity: Major
Found in cli.go - About 2 hrs to fix

    Function run has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
    Open

    func run(project, queue string) (err error) {
        logger := log.New(os.Stdout, "", 0)
    
        defer func() (err error) {
    
    
    Severity: Minor
    Found in cli.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

    func assetsDockerfile() (*asset, error) {
        bytes, err := assetsDockerfileBytes()
        if err != nil {
            return nil, err
        }
    Severity: Minor
    Found in assets/assets.go and 1 other location - About 40 mins to fix
    assets/assets.go on lines 101..110

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

    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 assetsEntrypointSh() (*asset, error) {
        bytes, err := assetsEntrypointShBytes()
        if err != nil {
            return nil, err
        }
    Severity: Minor
    Found in assets/assets.go and 1 other location - About 40 mins to fix
    assets/assets.go on lines 81..90

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

    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 RestoreAsset has 6 return statements (exceeds 4 allowed).
    Open

    func RestoreAsset(dir, name string) error {
        data, err := Asset(name)
        if err != nil {
            return err
        }
    Severity: Major
    Found in assets/assets.go - About 40 mins to fix

      Function ExecuteScript has 6 return statements (exceeds 4 allowed).
      Open

      func ExecuteScript(ctx context.Context, s *script.Script, logger *log.Logger) (err error) {
      
          logger.Println("Creating a Dockerfile and an entrypoint.sh")
          dockerfile, err := Dockerfile(s)
          if err != nil {
      Severity: Major
      Found in exec.go - About 40 mins to fix

        Function run has 6 return statements (exceeds 4 allowed).
        Open

        func run(project, queue string) (err error) {
            logger := log.New(os.Stdout, "", 0)
        
            defer func() (err error) {
        
        
        Severity: Major
        Found in cli.go - About 40 mins to fix

          Method CLI.Run has 5 return statements (exceeds 4 allowed).
          Open

          func (cli *CLI) Run(args []string) int {
              var (
                  version bool
              )
          
          
          Severity: Major
          Found in cli.go - About 35 mins to fix

            Function parseURL has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
            Open

            func parseURL(u string) (opt DownloadOpt) {
            
                var noExpand bool
                if strings.HasPrefix(u, "dropbox://") {
                    // The given URL has schema dropbox://
            Severity: Minor
            Found in exec.go - About 25 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

            Your code does not pass gofmt in 4 places. Go fmt your code!
            Open

            // Code generated by go-bindata.
            Severity: Minor
            Found in assets/assets.go by gofmt

            2: cannot find package "github.com/jkawamoto/roadie/cloud/gcp" in any of:
            Open

                "github.com/jkawamoto/roadie/cloud/gcp"
            Severity: Minor
            Found in cli.go by govet
            Severity
            Category
            Status
            Source
            Language