maestrodev/maestro-rightscale-plugin

View on GitHub

Showing 76 of 122 total issues

Avoid too many return statements within this method.
Open

                  return Result.new(:success => false, :errors => [Exception.new(result.to_hash['error_description'])])
Severity: Major
Found in src/rightscale_api_helper.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return Result.new(:success => true, :value => instance)
    Severity: Major
    Found in src/rightscale_api_helper.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                        return Result.new(:success => false, :errors => [Exception.new(data['error_description'])], :value => data)
      Severity: Major
      Found in src/rightscale_api_helper.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                  return Result.new(:success => false, :errors => [Exception.new('No refresh token was specified, nor was a username/password/account')])
        Severity: Major
        Found in src/rightscale_api_helper.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    return Result.new(:success => false, :errors => [Exception.new(e.response['error_description'])], :value => e.response)
          Severity: Major
          Found in src/rightscale_api_helper.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return Result.new(:success => false, :errors => [Exception.new(e.response['error_description'])], :value => e.response)
            Severity: Major
            Found in src/rightscale_api_helper.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return Result.new(:success => false, :errors => result.errors, :value => instance)
              Severity: Major
              Found in src/rightscale_api_helper.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                  return Result.new(:success => false, :errors => [Exception.new("#{reponse.code} #{response}")])
                Severity: Major
                Found in src/rightscale_api_helper.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return Result.new(:success => false, :errors => result.errors, :value => result.value)
                  Severity: Major
                  Found in src/rightscale_api_helper.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                      return Result.new(:success => false, :errors => [Exception.new(result.to_hash['error_description'])])
                    Severity: Major
                    Found in src/rightscale_api_helper.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                        return Result.new(:success => true, :value => access_token)
                      Severity: Major
                      Found in src/rightscale_api_helper.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                          return Result.new(:success => false, :errors => [Exception.new('CloudFlow failed to complete successfully')])
                        Severity: Major
                        Found in src/rightscale_api_helper.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return Result.new(:success => false, :errors => [Exception.new("Timed out after #{timeout}s waiting for Server (id=#{server_id}, name=#{server.name}, deployment_id=#{deployment_id}, deployment_name=#{deployment_name}) to reach state #{state}, currently in state #{server.state}")], :value => server)
                          Severity: Major
                          Found in src/rightscale_api_helper.rb - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                              return Result.new(:success => false, :errors => [Exception.new("#{reponse.code} #{response}")])
                            Severity: Major
                            Found in src/rightscale_api_helper.rb - About 30 mins to fix

                              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

                              Severity
                              Category
                              Status
                              Source
                              Language