maestrodev/maestro-rightscale-plugin

View on GitHub

Showing 76 of 122 total issues

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 get_server has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def get_server(args)
        # for convenience
        server_id = args[:server_id]
        server_name = args[:server_name]
        deployment_id = args[:deployment_id]
Severity: Major
Found in src/rightscale_api_helper.rb - About 2 hrs to fix

    Method get_cloudflow_process has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def get_cloudflow_process(args)
            # for convenience
            process_id = args[:process_id]
            timeout = args[:timeout] || DEFAULT_TIMEOUT
            api_version = DEFAULT_API_VERSION
    Severity: Minor
    Found in src/rightscale_api_helper.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 start has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                  def start(args)
                    # for readability
                    server_id = args[:server_id]
                    server_name = args[:server_name]
                    deployment_id = args[:deployment_id]
            Severity: Minor
            Found in src/rightscale_api_helper.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 initialize has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                  def initialize(args)
                    delay_connect = args[:delay_connect] || false
                    @logger = args[:logger] || Logger.new(STDOUT)
                    @verbose = args[:verbose]
                    @trace = args[:trace]
            Severity: Minor
            Found in src/rightscale_api_helper.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 connect has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                  def connect(args={}) # :nodoc:
                    indent = args[:indent] || ''
                    cookies = args[:cookies] || {}
              
                    args_no_pass = args.reject {|key, _| key == :password }
            Severity: Minor
            Found in src/rightscale_api_helper.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 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                  def stop(args)
                    # for readability
                    server_id = args[:server_id]
                    server_name = args[:server_name]
                    deployment_id = args[:deployment_id]
            Severity: Minor
            Found in src/rightscale_api_helper.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 connect has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def connect(args={}) # :nodoc:
                    indent = args[:indent] || ''
                    cookies = args[:cookies] || {}
              
                    args_no_pass = args.reject {|key, _| key == :password }
            Severity: Minor
            Found in src/rightscale_api_helper.rb - About 1 hr to fix

              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

              Method get_deployment has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def get_deployment(args)
                      # for convenience
                      deployment_id = args[:deployment_id]
                      deployment_name = args[:deployment_name]
                      indent = args[:indent] || ''
              Severity: Minor
              Found in src/rightscale_api_helper.rb - About 1 hr to fix

                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_deployment has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def get_deployment(args)
                          # for convenience
                          deployment_id = args[:deployment_id]
                          deployment_name = args[:deployment_name]
                          indent = args[:indent] || ''
                  Severity: Minor
                  Found in src/rightscale_api_helper.rb - About 55 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

                  Severity
                  Category
                  Status
                  Source
                  Language