aeolusproject/conductor

View on GitHub

Showing 248 of 368 total issues

Method do_action has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.do_action(task, action)
    task.time_started = Time.now

    begin
      client = task.instance.provider_account.connect
Severity: Minor
Found in src/app/util/taskomatic.rb - About 35 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 launch! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def launch!(user)
    self.reload unless self.new_record?
    self.state = STATE_PENDING
    save!

Severity: Minor
Found in src/app/models/deployment.rb - About 35 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 transform_resource_links_recursively has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def transform_resource_links_recursively(subparams, sublinks)
    return if subparams == nil

    case sublinks
    when Symbol # then transform the link (last level of recursion)
Severity: Minor
Found in src/app/util/resource_link_filter.rb - About 35 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 disable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def disable(user)
    res = {}
    if valid_framework?
      # if we can connect to the provider, try to stop running instances
      # TODO: now provider is disabled even if stop request fails, is it ok?
Severity: Minor
Found in src/app/models/provider.rb - About 35 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 csv_export has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.csv_export(instances)
    csvm = get_csv_class
    csv_string = csvm.generate(:col_sep => ";", :row_sep => "\r\n") do |csv|
      event_attributes = Event.new.attributes.keys.reject {|key| key if key == "created_at" || key == "updated_at"}

Severity: Minor
Found in src/app/models/instance.rb - About 35 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 multi_destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def multi_destroy
    @provider = Provider.find(params[:provider_id])

    if params[:accounts_selected].blank?
      flash[:warning] = _('You must select some accounts first.')
Severity: Minor
Found in src/app/controllers/provider_accounts_controller.rb - About 35 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

Function multiActionValidation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  multiActionValidation: function() {
    $('#delete_button, #revoke_button, #stop_button, #stop_selected_instances, #reboot_selected_instances').live('click', function(e) {

      var $checkbox_table = $(this).closest("form.filterable-data").find("table.checkbox_table");
      var confirm_message = $checkbox_table.data('confirm');
Severity: Minor
Found in src/app/assets/javascripts/conductor.js - About 35 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 create_dcloud_instance has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.create_dcloud_instance(instance, match)
    client = match.provider_account.connect
    raise _('Could not connect to Provider Account.  Please contact an Administrator.') unless client

    client_args = {
Severity: Minor
Found in src/app/util/taskomatic.rb - About 35 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 multi_destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def multi_destroy
    require_privilege(Alberich::Privilege::MODIFY, User)
    deleted_users = []

    begin
Severity: Minor
Found in src/app/controllers/users_controller.rb - About 35 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 generate_random_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.generate_random_string(length)
    length.to_i.times.collect { (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }.join
  end
Severity: Minor
Found in src/lib/password.rb - About 35 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 save_breadcrumb has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def save_breadcrumb(path, name = controller_name)
    return if request.format == :json

    session[:breadcrumbs] ||= []
    breadcrumbs = session[:breadcrumbs]
Severity: Minor
Found in src/app/controllers/application_controller.rb - About 35 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 detect_locale has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def detect_locale
    # Processes the HTTP_ACCEPT_LANGUAGE header
    languages = env['HTTP_ACCEPT_LANGUAGE'].split(',')
    prefs = []
    languages.each do |language|
Severity: Minor
Found in src/app/controllers/application_controller.rb - About 35 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 load_provider_tabs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def load_provider_tabs
    @realms = @provider.provider_realms.apply_filters(:preset_filter_id => params[:provider_realms_preset_filter], :search_filter => params[:provider_realms_search])
    #TODO add links to real data for history,properties,permissions
    @tabs = [{ :name => _('Properties'),
               :view => 'properties',
Severity: Minor
Found in src/app/controllers/providers_controller.rb - About 35 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 run_deployable_level_checks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def run_deployable_level_checks(pool, user, deployable_xml)
      assembly_count = deployable_xml.assemblies.length

      if pool.pool_family.provider_accounts.empty?
        errors << I18n.t('instances.errors.no_provider_accounts')
Severity: Minor
Found in src/lib/deployable_matching/validator.rb - About 35 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 close_costs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def close_costs(all=true)
        hwp_cost = cost_now(t=Time.now)
        hwp_cost.close unless hwp_cost.nil?

        if all
Severity: Minor
Found in src/lib/costengine/mixins.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    @provider = Provider.find(params[:id])
    require_privilege(Alberich::Privilege::MODIFY, @provider)

    @provider.assign_attributes(params[:provider])
Severity: Minor
Found in src/app/controllers/providers_controller.rb - About 35 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 parse_from_gemfile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def self.parse_from_gemfile(gemfile,*groups)
        ENV['BUNDLE_GEMFILE'] = gemfile
        groups.map! { |g| g.to_sym }
        groups = [:default] if groups.empty?
        g = Bundler::Dsl.evaluate(gemfile,'foo',true)
Severity: Minor
Found in src/lib/aeolus/ext/bundler_ext.rb - About 35 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

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 value
    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 nil
      Severity: Major
      Found in src/app/models/hardware_profile.rb - About 30 mins to fix
        Severity
        Category
        Status
        Source
        Language