aeolusproject/conductor

View on GitHub

Showing 248 of 368 total issues

Avoid too many return statements within this method.
Open

        return _('Error, could not calculate state time: state is not monitored')
Severity: Major
Found in src/app/models/instance.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

              return acc_stopped_time
    Severity: Major
    Found in src/app/models/instance.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                return val
      Severity: Major
      Found in src/app/models/hardware_profile.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return Instance::STATE_PENDING
        Severity: Major
        Found in src/app/util/taskomatic.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    return acc_stopped_time + (Time.now - time_last_stopped)
          Severity: Major
          Found in src/app/models/instance.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return Instance::STATE_SHUTTING_DOWN
            Severity: Major
            Found in src/app/util/taskomatic.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                        return acc_shutting_down_time + (Time.now - time_last_shutting_down)
              Severity: Major
              Found in src/app/models/instance.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                          return acc_running_time
                Severity: Major
                Found in src/app/models/instance.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                            return acc_shutting_down_time
                  Severity: Major
                  Found in src/app/models/instance.rb - About 30 mins to fix

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

                      def create_auth_key
                        raise "instance provider_account is not set" unless self.provider_account
                        client = self.provider_account.connect
                        return nil unless client && client.feature?(:instances, :authentication_key)
                        if key = client.create_key(:name => key_name)
                    Severity: Minor
                    Found in src/app/models/instance.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 humanize_error has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def humanize_error(error, options={})
                      error = error.message if error.is_a?(Exception)
                      if error.match("Connection refused - connect\\(2\\)")
                        if options[:context] == :deltacloud
                            return I18n.translate('deltacloud.unreachable')
                    Severity: Minor
                    Found in src/app/util/conductor.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 uptime_all has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def uptime_all
                        return nil if events.empty?
                    
                        all_running = events.find_last_by_status_code(:all_running)
                        some_stopped = events.find_last_by_status_code(:some_stopped)
                    Severity: Minor
                    Found in src/app/models/deployment.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 end_time has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def end_time
                        if events.find_last_by_status_code(:all_running)
                          ev = events.find_last_by_status_code(:some_stopped) || events.find_last_by_status_code(:all_stopped)
                          ev.present? ? ev.event_time : nil
                        else
                    Severity: Minor
                    Found in src/app/models/deployment.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 handle_completed_rollback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def handle_completed_rollback
                        if self.state_changed? and self.state == STATE_ROLLBACK_COMPLETE
                          begin
                            if self.events.where(
                                :status_code => 'deployment_launch_match').count > 9
                    Severity: Minor
                    Found in src/app/models/deployment.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 deployment_for_mustache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def deployment_for_mustache(deployment)
                        {
                          :id                   => deployment.id,
                          :name                 => deployment.name,
                          :path                 => deployment_path(deployment),
                    Severity: Minor
                    Found in src/app/helpers/mustache_helper.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 check_destroyable_instances! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def check_destroyable_instances!
                        not_destroyable_instances = instances.find_all {|i| !i.destroyable?}
                        if not_destroyable_instances.empty?
                          true
                        else
                    Severity: Minor
                    Found in src/app/models/provider_account.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 all_groups has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def all_groups
                        group_list = []
                        group_list += self.user_groups if UserGroup.local_groups_active?
                        if UserGroup.ldap_groups_active?
                          ldap_group_names = Ldap.ldap_groups(self.username)
                    Severity: Minor
                    Found in src/app/models/user.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 build_all has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def build_all
                        raise _('The Image you tried to access cannot be found. It may have been deleted.') unless @base_image
                        if @base_image.imported?
                          flash[:error] = _('Imported image can\'t be built or pushed')
                          redirect_to @base_image and return
                    Severity: Minor
                    Found in src/app/decorators/controllers/tim/base_images_controller_decorator.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 valid_provider? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def valid_provider?
                        if deltacloud_provider.present?
                          client = connect
                          return false if client.nil?
                          return false unless client.driver(provider_type.deltacloud_driver).valid_provider? deltacloud_provider
                    Severity: Minor
                    Found in src/app/models/provider.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def update
                        @user_group = UserGroup.find(params[:id])
                        require_privilege(Alberich::Privilege::MODIFY, User)
                    
                        if params[:commit] == "Reset"
                    Severity: Minor
                    Found in src/app/controllers/user_groups_controller.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