aeolusproject/conductor

View on GitHub

Showing 248 of 368 total issues

Class DeploymentsController has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

class DeploymentsController < ApplicationController
  before_filter :require_user
  before_filter :load_deployments, :only => [:index, :show]
  before_filter :load_deployment, :only => [:edit, :update]
  before_filter :check_inaccessible_instances, :only => :multi_stop
Severity: Minor
Found in src/app/controllers/deployments_controller.rb - About 2 hrs to fix

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

      def self.up
        bpo_map = {}
        bpo_metadata_objects = MetadataObject.where(:object_type => "BasePermissionObject")
        BasePermissionObject.all.each do |old_bpo|
          new_bpo = Alberich::BasePermissionObject.create!(:name => old_bpo.name)
    Severity: Major
    Found in src/db/migrate/20130401120000_migrate_data_to_alberich.rb - About 2 hrs to fix

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

        def add_provider_accounts
          @pool_family = PoolFamily.find(params[:id])
          require_privilege(Alberich::Privilege::MODIFY, @pool_family)
      
          if ProviderAccount.count == 0
      Severity: Minor
      Found in src/app/controllers/pool_families_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 multi_destroy has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        def multi_destroy
          deleted = []
          not_deleted = []
          not_deleted_perms = []
          catalogs = Catalog.find(params[:catalogs_selected])
      Severity: Minor
      Found in src/app/controllers/catalogs_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 statistics has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        def statistics
          @statistics = Hash.new
          @providers.each do |provider|
            @statistics[provider.id] = {
              "running_instances" => 0,
      Severity: Minor
      Found in src/app/controllers/providers_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 conductor.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Place your application-specific JavaScript functions and classes here
      // This file is automatically included by javascript_include_tag :defaults
      
      
      $.extend(Conductor, {
      Severity: Minor
      Found in src/app/assets/javascripts/conductor.js - About 2 hrs to fix

        File deployable_xml.rb has 267 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'tsort'
        
        class ValidationError < RuntimeError; end
        
        class ParameterXML
        Severity: Minor
        Found in src/app/util/deployable_xml.rb - About 2 hrs to fix

          File instances_controller.rb has 266 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class InstancesController < ApplicationController
            before_filter :require_user
            before_filter :load_instance, :only => [:show, :key, :edit, :update, :stop, :reboot]
            before_filter :set_view_vars, :only => [:show, :index, :export_events]
            before_filter :check_inaccessible_instances, :only => [:stop, :multi_stop]
          Severity: Minor
          Found in src/app/controllers/instances_controller.rb - About 2 hrs to fix

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

              def not_existing_references
                # not_existing references are detected when doing tsort
                strongly_connected_components
            
                invalid_refs = []
            Severity: Minor
            Found in src/app/util/deployable_xml.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 remove_members has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

              def remove_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 get_target_image_info has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

              def get_target_image_info(target_images, provider_type)
                target_image = target_images.last
                info = {}
                # If there's no target image, or it's failed, show a build URL:
                if (target_image.nil? || target_image.status == Tim::TargetImage::STATUS_FAILED) &&

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

              def multi_stop
                notices = []
                errors = []
            
                @deployments_to_stop.each do |deployment|
            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 transmit_event has 55 lines of code (exceeds 25 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: Major
            Found in src/app/models/event.rb - About 2 hrs to fix

              Method generate_graph has 55 lines of code (exceeds 25 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: Major
              Found in src/app/controllers/logs_controller.rb - About 2 hrs to fix

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

                  def destroy
                    destroyed = []
                    failed = []
                    permission_failed = []
                    error_messages = []
                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 populate_realms has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def populate_realms
                    reload
                
                    # if the provider is not running, mark as unavailable and don't refresh its
                    # realms
                Severity: Major
                Found in src/app/models/provider.rb - About 2 hrs to fix

                  File base_images_controller_decorator.rb has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  Tim::BaseImagesController.class_eval do
                    before_filter :require_user
                  
                    before_filter :load_permissioned_images, :only => :index
                    before_filter :check_view_permission, :only => [:show]

                    Method show has 50 lines of code (exceeds 25 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

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

                        def create
                          @deployment = Deployment.new(params[:deployment])
                          @pool = @deployment.pool
                          require_privilege(Alberich::Privilege::CREATE, Deployment, @pool)
                      
                      
                      Severity: Minor
                      Found in src/app/controllers/deployments_controller.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_source_label has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def get_source_label(source, label_type)
                          label = "Unknown"
                          if !source.nil?
                            case label_type
                            when _('Pool')
                      Severity: Minor
                      Found in src/app/controllers/logs_controller.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

                      Severity
                      Category
                      Status
                      Source
                      Language