maestrodev/maestro-rightscale-plugin

View on GitHub
src/right_scale_worker.rb

Summary

Maintainability
F
6 days
Test Coverage

File right_scale_worker.rb has 652 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'maestro_plugin'
require 'rubygems'  # Unsure why this is required
require 'rightscale_api_helper'

module MaestroDev
Severity: Major
Found in src/right_scale_worker.rb - About 1 day to fix

    Method start has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def start
            Maestro.log.info "Starting RightScale Worker"
      
            # make sure we have all the necessary fields
            validate_server_fields()
    Severity: Major
    Found in src/right_scale_worker.rb - About 3 hrs to fix

      Method get_server has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def get_server
              Maestro.log.info "Retrieving RightScale server information into the Composition"
        
              # TODO: much duplication with start, but refactor after other changes for deployments land
        
      Severity: Major
      Found in src/right_scale_worker.rb - About 2 hrs to fix

        Method start_deployment has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def start_deployment
                Maestro.log.info "Starting RightScale Deployment"
          
                deployment_id = get_field('deployment_id')
                deployment_name = get_field('deployment_name')
        Severity: Major
        Found in src/right_scale_worker.rb - About 2 hrs to fix

          Method wait has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def wait
                  Maestro.log.info "Waiting for RightScale Worker"
            
                  # make sure we have all the necessary fields
                  validate_server_fields()
          Severity: Major
          Found in src/right_scale_worker.rb - About 2 hrs to fix

            Method wait has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                  def wait
                    Maestro.log.info "Waiting for RightScale Worker"
              
                    # make sure we have all the necessary fields
                    validate_server_fields()
            Severity: Minor
            Found in src/right_scale_worker.rb - About 2 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 stop has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def stop
                    Maestro.log.info "Stopping RightScale Worker"
              
                    # make sure we have all the necessary fields
                    validate_server_fields()
            Severity: Major
            Found in src/right_scale_worker.rb - About 2 hrs to fix

              Method stop_deployment has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def stop_deployment
                      Maestro.log.info "Stopping RightScale Deployment"
                
                      deployment_id = get_field('deployment_id')
                      deployment_name = get_field('deployment_name')
              Severity: Major
              Found in src/right_scale_worker.rb - About 2 hrs to fix

                Method execute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                      def execute
                        Maestro.log.info "Executing RightScript"
                  
                        # TODO: much duplication with stop, but refactor after other changes for deployments land
                  
                Severity: Minor
                Found in src/right_scale_worker.rb - About 2 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 execute has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def execute
                        Maestro.log.info "Executing RightScript"
                  
                        # TODO: much duplication with stop, but refactor after other changes for deployments land
                  
                Severity: Minor
                Found in src/right_scale_worker.rb - About 1 hr to fix

                  Method stop has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def stop
                          Maestro.log.info "Stopping RightScale Worker"
                    
                          # make sure we have all the necessary fields
                          validate_server_fields()
                  Severity: Minor
                  Found in src/right_scale_worker.rb - 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

                  Method create_cloudflow has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def create_cloudflow
                          Maestro.log.info "Starting RightScale CloudFlow Worker"
                    
                          # make sure we have all the necessary fields
                          validate_cloudflow_fields()
                  Severity: Minor
                  Found in src/right_scale_worker.rb - About 1 hr to fix

                    Method start has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def start
                            Maestro.log.info "Starting RightScale Worker"
                      
                            # make sure we have all the necessary fields
                            validate_server_fields()
                    Severity: Minor
                    Found in src/right_scale_worker.rb - 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

                    Method stop_deployment has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def stop_deployment
                            Maestro.log.info "Stopping RightScale Deployment"
                      
                            deployment_id = get_field('deployment_id')
                            deployment_name = get_field('deployment_name')
                    Severity: Minor
                    Found in src/right_scale_worker.rb - 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

                    Method start_deployment has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def start_deployment
                            Maestro.log.info "Starting RightScale Deployment"
                      
                            deployment_id = get_field('deployment_id')
                            deployment_name = get_field('deployment_name')
                    Severity: Minor
                    Found in src/right_scale_worker.rb - 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

                    Consider simplifying this complex logical expression.
                    Open

                            if server.state != MaestroDev::RightScalePlugin::RightScaleApiHelper::STATE_OPERATIONAL
                              write_output "Server id=#{server_id}, name=#{server_name}, deployment_id=#{deployment_id}, deployment_name=#{deployment_name} in not currently operational\n"
                      
                              context_servers = read_output_value('rightscale_servers') || {}
                              context_servers[server_id] = {
                    Severity: Major
                    Found in src/right_scale_worker.rb - About 1 hr to fix

                      Method get_server has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def get_server
                              Maestro.log.info "Retrieving RightScale server information into the Composition"
                        
                              # TODO: much duplication with start, but refactor after other changes for deployments land
                        
                      Severity: Minor
                      Found in src/right_scale_worker.rb - 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

                      Method validate_base_fields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def validate_base_fields(missing_fields)
                              if get_field('account_id').nil?
                                missing_fields << 'account_id'
                              end
                              if get_field('refresh_token').nil? && get_field('username').nil? && get_field('password').nil?
                      Severity: Minor
                      Found in src/right_scale_worker.rb - About 35 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

                      Method validate_server_fields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def validate_server_fields(missing_fields = [])
                              if get_field('server_id').nil? and ((get_field('nickname').nil? or (get_field('deployment_id').nil? and get_field('deployment_name').nil?)))
                                missing_fields << '(nickname and deployment_id) or (nickname and deployment_name) or server_id'
                              end
                              validate_base_fields(missing_fields)
                      Severity: Minor
                      Found in src/right_scale_worker.rb - 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

                      Method wait_for_task has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def wait_for_task(recipe, task, timeout=600, interval=5)
                              desired_summary = "completed: #{recipe}"
                              last_state = nil
                              i = 0
                              while i <= timeout do
                      Severity: Minor
                      Found in src/right_scale_worker.rb - 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

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

                              if server_id && server_id.to_i > 0
                                write_output "Looking up server by id=#{server_id}\n"
                              elsif server_name && server_name != ''
                                if deployment_id
                                  write_output "Looking up server by nickname=#{server_name} deployment_id=#{deployment_id}\n"
                      Severity: Major
                      Found in src/right_scale_worker.rb and 2 other locations - About 1 hr to fix
                      src/right_scale_worker.rb on lines 246..264
                      src/right_scale_worker.rb on lines 420..438

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

                      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

                              if server_id && server_id.to_i > 0
                                write_output "Looking up server by id=#{server_id}\n"
                              elsif server_name && server_name != ''
                                if deployment_id
                                  write_output "Looking up server by nickname=#{server_name} deployment_id=#{deployment_id}\n"
                      Severity: Major
                      Found in src/right_scale_worker.rb and 2 other locations - About 1 hr to fix
                      src/right_scale_worker.rb on lines 246..264
                      src/right_scale_worker.rb on lines 344..362

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

                      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

                              if server_id && server_id.to_i > 0
                                write_output "Looking up server by id=#{server_id}\n"
                              elsif server_name && server_name != ''
                                if deployment_id
                                  write_output "Looking up server by nickname=#{server_name} deployment_id=#{deployment_id}\n"
                      Severity: Major
                      Found in src/right_scale_worker.rb and 2 other locations - About 1 hr to fix
                      src/right_scale_worker.rb on lines 344..362
                      src/right_scale_worker.rb on lines 420..438

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

                      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

                              if !result.errors.nil?
                                @log_wrapper.info "#{result.errors.size} Errors stopping deployment (id=#{deployment_id} name=#{deployment_name})"
                                result.errors.each{|error|
                                  @log_wrapper.error "  #{error.message}, backtrace=#{error.backtrace}"
                      Severity: Minor
                      Found in src/right_scale_worker.rb and 1 other location - About 35 mins to fix
                      src/right_scale_worker.rb on lines 521..524

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

                      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

                              if !result.errors.nil?
                                @log_wrapper.info "#{result.errors.size} Errors starting deployment (id=#{deployment_id} name=#{deployment_name})"
                                result.errors.each{|error|
                                  @log_wrapper.error "  #{error.message}, backtrace=#{error.backtrace}"
                      Severity: Minor
                      Found in src/right_scale_worker.rb and 1 other location - About 35 mins to fix
                      src/right_scale_worker.rb on lines 611..614

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

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

                              if server.nil?
                                write_output "Error finding server by id=#{server_id}, name=#{server_name}, deployment_id=#{deployment_id}, deployment_name=#{deployment_name}\n"
                                set_error "Error finding server by id=#{server_id}, name=#{server_name}, deployment_id=#{deployment_id}, deployment_name=#{deployment_name}\n"
                                return
                              end
                      Severity: Major
                      Found in src/right_scale_worker.rb and 3 other locations - About 30 mins to fix
                      src/right_scale_worker.rb on lines 167..171
                      src/right_scale_worker.rb on lines 370..374
                      src/right_scale_worker.rb on lines 448..452

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

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

                                if server.nil?
                                  write_output "Error finding server by id=#{server_id}, name=#{server_name}, deployment_id=#{deployment_id}, deployment_name=#{deployment_name}\n"
                                  set_error "Error finding server by id=#{server_id}, name=#{server_name}, deployment_id=#{deployment_id}, deployment_name=#{deployment_name}\n"
                                  return
                                end
                      Severity: Major
                      Found in src/right_scale_worker.rb and 3 other locations - About 30 mins to fix
                      src/right_scale_worker.rb on lines 167..171
                      src/right_scale_worker.rb on lines 272..276
                      src/right_scale_worker.rb on lines 370..374

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

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

                              if server.nil?
                                write_output "Error finding server by id=#{server_id}, name=#{server_name}, deployment_id=#{deployment_id}, deployment_name=#{deployment_name}\n"
                                set_error "Error finding server by id=#{server_id}, name=#{server_name}, deployment_id=#{deployment_id}, deployment_name=#{deployment_name}\n"
                                return
                              end
                      Severity: Major
                      Found in src/right_scale_worker.rb and 3 other locations - About 30 mins to fix
                      src/right_scale_worker.rb on lines 167..171
                      src/right_scale_worker.rb on lines 272..276
                      src/right_scale_worker.rb on lines 448..452

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

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

                              if server.nil?
                                write_output "Error finding server by id=#{server_id}, name=#{server_name}, deployment_id=#{deployment_id}, deployment_name=#{deployment_name}\n"
                                set_error "Error finding server by id=#{server_id}, name=#{server_name}, deployment_id=#{deployment_id}, deployment_name=#{deployment_name}\n"
                                return
                              end
                      Severity: Major
                      Found in src/right_scale_worker.rb and 3 other locations - About 30 mins to fix
                      src/right_scale_worker.rb on lines 272..276
                      src/right_scale_worker.rb on lines 370..374
                      src/right_scale_worker.rb on lines 448..452

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

                      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

                              context_servers[server_id] = {
                                  :name => server.name,
                                  :state => server.state,
                                  :public_ip_address => ip_address,
                                  :private_ip_address => private_ip_address,
                      Severity: Minor
                      Found in src/right_scale_worker.rb and 1 other location - About 30 mins to fix
                      src/right_scale_worker.rb on lines 211..219

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

                      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

                              if result.success
                                if wait_until_stopped
                                  @log_wrapper.info "Deployment (id=#{deployment_id} name=#{deployment_name}) stopped"
                                else
                                  @log_wrapper.info "Deployment (id=#{deployment_id} name=#{deployment_name}) stop requested"
                      Severity: Minor
                      Found in src/right_scale_worker.rb and 1 other location - About 30 mins to fix
                      src/right_scale_worker.rb on lines 505..512

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

                      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

                              if result.success
                                if wait_until_started
                                  @log_wrapper.info "Deployment (id=#{deployment_id} name=#{deployment_name}) started"
                                else
                                  @log_wrapper.info "Deployment (id=#{deployment_id} name=#{deployment_name}) launched"
                      Severity: Minor
                      Found in src/right_scale_worker.rb and 1 other location - About 30 mins to fix
                      src/right_scale_worker.rb on lines 595..602

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

                      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

                                context_servers[server_id] = {
                                    :name => server.name,
                                    :state => server.state,
                                    :public_ip_address => ip_address,
                                    :private_ip_address => private_ip_address,
                      Severity: Minor
                      Found in src/right_scale_worker.rb and 1 other location - About 30 mins to fix
                      src/right_scale_worker.rb on lines 310..318

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

                      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

                              if !result.notices.nil?
                                @log_wrapper.info "#{result.notices.size} Notices starting deployment (id=#{deployment_id} name=#{deployment_name})"
                                result.notices.each{|notice|
                                  @log_wrapper.warn "  #{notice.message}"
                      Severity: Minor
                      Found in src/right_scale_worker.rb and 1 other location - About 25 mins to fix
                      src/right_scale_worker.rb on lines 618..621

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

                      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

                              if !result.notices.nil?
                                @log_wrapper.info "#{result.notices.size} Notices stopping deployment (id=#{deployment_id} name=#{deployment_name})"
                                result.notices.each{|notice|
                                  @log_wrapper.warn "  #{notice.message}"
                      Severity: Minor
                      Found in src/right_scale_worker.rb and 1 other location - About 25 mins to fix
                      src/right_scale_worker.rb on lines 528..531

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

                      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