aeolusproject/conductor

View on GitHub

Showing 248 of 368 total issues

Method update_quota has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def update_quota(state_from, state_to, an_instance)
    pool = an_instance.pool
    pool_family = pool.pool_family
    user = an_instance.owner
    provider_account = an_instance.provider_account
Severity: Minor
Found in src/app/models/instance_observer.rb - About 3 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 match_hardware_profile_property has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def self.match_hardware_profile_property(front_end_property, back_end_property)
    # if the front_end_property is nil, we don't care about it, so everything matches:
    return true if front_end_property.nil? || front_end_property.value.to_s.empty?
    # if the back_end_property is nil, it only matches if front-end is also nil:
    return false if back_end_property.nil? || back_end_property.value.to_s.empty?
Severity: Minor
Found in src/app/models/hardware_profile.rb - About 3 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 transmit_event has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def transmit_event
    # Extract just the old values from change_hash
    old_values = {}
    change_hash.each_pair do |k,v|
      old_values[k] = v[0]
Severity: Minor
Found in src/app/models/event.rb - About 3 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 validate_hwp has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_hwp
    case name
    when MEMORY
      unless unit == UNIT_MB
        errors.add(:unit, "Memory must be specified in MB")
Severity: Minor
Found in src/app/models/hardware_profile_property.rb - About 3 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

Class ProviderAccount has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

class ProviderAccount < ActiveRecord::Base

  class << self
    include CommonFilterMethods
  end
Severity: Minor
Found in src/app/models/provider_account.rb - About 3 hrs to fix

    File views.js has 297 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    Conductor.Views = Conductor.Views || {}
    
    
    Conductor.Views.PoolsIndex = Backbone.View.extend({
      el: '#content',
    Severity: Minor
    Found in src/app/assets/javascripts/backbone/views.js - About 3 hrs to fix

      Method sortable_table_header has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        def sortable_table_header(fields=[])
          columns = fields.collect do |field|
            if field[:sortable]==true or field[:sortable].nil?
              order_dir = params[:order_dir] ? params[:order_dir] : 'desc'
              if field[:sort_attr].to_s.eql?(params[:order_field])
      Severity: Minor
      Found in src/app/helpers/application_helper.rb - About 3 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 _fast_gettext_old_format_m has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def _fast_gettext_old_format_m(args)
            if args.kind_of?(Hash)
              dup.gsub(INTERPOLATION_PATTERN_WITH_ESCAPE) do |match|
                if match == '%%'
                  '%'
      Severity: Minor
      Found in src/lib/fix_string_interpolate.rb - About 3 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 index has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def index
          clear_breadcrumbs
          save_breadcrumb(pools_path(:viewstate => viewstate_id))
      
          # This is primarily relevant to filter_view, but we check @details_tab in other places:
      Severity: Major
      Found in src/app/controllers/pools_controller.rb - About 3 hrs to fix

        File provider_account.rb has 292 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class ProviderAccount < ActiveRecord::Base
        
          class << self
            include CommonFilterMethods
          end
        Severity: Minor
        Found in src/app/models/provider_account.rb - About 3 hrs to fix

          File logs_controller.rb has 289 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class LogsController < ApplicationController
            before_filter :require_user
          
            def index
              clear_breadcrumbs
          Severity: Minor
          Found in src/app/controllers/logs_controller.rb - About 2 hrs to fix

            Method get_image_details has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

              def get_image_details
                deployable_xml = DeployableXML.new(xml)
                uuids = deployable_xml.image_uuids
                images = []
                missing_images = []
            Severity: Minor
            Found in src/app/models/deployable.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 generate_graph has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

              def generate_graph
                @group = params[:group].nil? ? "" : params[:group]
            
                start_code = (@source_type == 'Deployment' ? 'first_running' : 'running')
                end_code = (@source_type == 'Deployment' ? 'all_stopped' : 'stopped')
            Severity: Minor
            Found in src/app/controllers/logs_controller.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 show has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

              def show
                @pool = Pool.find(params[:id])
                @title = @pool.name
                save_breadcrumb(pool_path(@pool, :viewstate => viewstate_id), @pool.name)
                require_privilege(Alberich::Privilege::VIEW, @pool)
            Severity: Minor
            Found in src/app/controllers/pools_controller.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 update has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

              def update
                KEYS.each do |key|
                  if params[key]
                    if key == SELF_SERVICE_DEFAULT_QUOTA
                      @self_service_default_quota = MetadataObject.lookup(key)
            Severity: Minor
            Found in src/app/controllers/settings_controller.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

            File deployables_controller.rb has 281 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'uri'
            
            class DeployablesController < ApplicationController
              before_filter :require_user
            
            
            Severity: Minor
            Found in src/app/controllers/deployables_controller.rb - About 2 hrs to fix

              `` has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

              $.extend(Conductor, {
                tabIsClickedResetFilters: false,
              
                positionFooter: function () {
                  var $footer = $('footer');
              Severity: Minor
              Found in src/app/assets/javascripts/conductor.js - About 2 hrs to fix

                Method launch_time_params has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                  def launch_time_params
                    @title = _('New Deployment')
                
                    @deployment = Deployment.new(params[:deployment])
                    @pool = @deployment.pool
                Severity: Minor
                Found in src/app/controllers/deployments_controller.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 add_members has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                  def add_members
                    @user_group = UserGroup.find(params[:id])
                    require_privilege(Alberich::Privilege::MODIFY, User)
                
                    unless @user_group.membership_source == UserGroup::MEMBERSHIP_SOURCE_LOCAL
                Severity: Minor
                Found in src/app/controllers/user_groups_controller.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 create has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def create
                    if params[:cancel]
                      redirect_to polymorphic_path([Catalog.find(Array(params[:catalog_id])[0]), Deployable])
                      return
                    end
                Severity: Major
                Found in src/app/controllers/deployables_controller.rb - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language