crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

Function add has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        add: function (id, content, config, tags, append) {
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/bootstrap/fileinput.js - About 35 mins to fix

Method relevant_attributes_changed_if_roles? has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def relevant_attributes_changed_if_roles?(node, old_role, new_role, ignore_attr, only_for_roles)
Severity: Minor
Found in crowbar_framework/app/models/service_object.rb - About 35 mins to fix

Method render_instance_selector has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def render_instance_selector(bc, name, label, field, proposal)
Severity: Minor
Found in crowbar_framework/app/helpers/form_helper.rb - About 35 mins to fix

Method migrate_proposal has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def self.migrate_proposal(bc_name, validator, template, all_scripts, proposal)
Severity: Minor
Found in crowbar_framework/lib/schema_migration.rb - About 35 mins to fix

Method migrate_object has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def self.migrate_object(bc_name, template, all_scripts, attributes, deployment)
Severity: Minor
Found in crowbar_framework/lib/schema_migration.rb - About 35 mins to fix

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

  def apply_role_pre_chef_call(old_role, role, all_nodes)
    Rails.logger.debug("Network apply_role_pre_chef_call: entering #{all_nodes.inspect}")

    role.default_attributes["network"]["networks"].each do |k,net|
      db = Chef::DataBag.load("crowbar/#{k}_network") rescue nil
Severity: Minor
Found in crowbar_framework/app/models/network_service.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 create_configs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def create_configs(ses_service)
  # This function creates the /etc/ceph/ceph.conf
  # and the keyring files needed by the services
  # ses_service is the name of the service using ceph
  # which should be nova, cinder, glance
Severity: Minor
Found in chef/cookbooks/ses/providers/config.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 restore has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def restore(options = {})
    background = options.fetch(:background, false)
    from_upgrade = options.fetch(:from_upgrade, false)

    if Crowbar::Backup::Restore.restore_steps_path.exist?
Severity: Minor
Found in crowbar_framework/app/models/api/backup.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 upgrade_nodes_disruptive has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def upgrade_nodes_disruptive(elements_to_upgrade)
        elements_to_upgrade.each do |element|
          # If role has a cluster assigned ugprade that cluster (reuse the non-disruptive code here)
          if ServiceObject.is_cluster?(element)
            cluster = ServiceObject.cluster_name element
Severity: Minor
Found in crowbar_framework/app/models/api/upgrade.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 set_to_applying has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def set_to_applying(nodes, inst, pre_cached_nodes)
    with_lock "BA-LOCK" do
      nodes_to_save = []
      nodes.each do |node_name|
        node = pre_cached_nodes[node_name]
Severity: Minor
Found in crowbar_framework/app/models/service_object.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_all_repositories has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def disable_all_repositories
    Rails.logger.debug("Disabling all repositories.")
    all_db = begin
      Chef::DataBag.list
    rescue Net::HTTPServerException
Severity: Minor
Found in crowbar_framework/app/models/provisioner_service.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_repository has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def disable_repository(platform, arch, repo)
    repo_object = Crowbar::Repository.where(platform: platform, arch: arch, repo: repo).first
    if repo_object.nil?
      message = "#{repo} repository for #{platform} / #{arch} does not exist."
      Rails.logger.debug(message)
Severity: Minor
Found in crowbar_framework/app/models/provisioner_service.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 check_for_running_instances has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def check_for_running_instances
        controller = ::Node.find("run_list_map:nova-controller").first
        if controller.nil?
          Rails.logger.info("No nova-controller node found.")
          return
Severity: Minor
Found in crowbar_framework/app/models/api/upgrade.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 restore_to_ready has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def restore_to_ready(nodes)
    with_lock "BA-LOCK" do
      nodes_to_save = []
      nodes.each do |node_name|
        node = Node.find_by_name(node_name)
Severity: Minor
Found in crowbar_framework/app/models/service_object.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 select_nodes_for_role has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def select_nodes_for_role(all_nodes, role, preferred_intended_role = nil)
    # do not modify array given by caller
    valid_nodes = all_nodes.dup

    valid_nodes.delete_if { |n| n.nil? }
Severity: Minor
Found in crowbar_framework/app/models/service_object.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 node_status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def node_status
        not_upgraded = []
        upgraded = []
        if ::Crowbar::UpgradeStatus.new.finished?
          upgraded = ::Node.all.reject(&:admin?).map(&:name)
Severity: Minor
Found in crowbar_framework/app/models/api/upgrade.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 proposal_create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def proposal_create(params)
    base_id = params["id"]
    params["id"] = "#{@bc_name}-#{params["id"]}"
    if FORBIDDEN_PROPOSAL_NAMES.any?{ |n| n == base_id }
      return [403,I18n.t("model.service.illegal_name", names: FORBIDDEN_PROPOSAL_NAMES.to_sentence)]
Severity: Minor
Found in crowbar_framework/app/models/service_object.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(node, role = nil)
    @role = if role.nil?
      RoleObject.find_role_by_name Node.make_role_name(node.name)
    else
      role
Severity: Minor
Found in crowbar_framework/app/models/node.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 disk_claim has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def disk_claim(device, owner)
    if device
      crowbar_wall[:claimed_disks] ||= {}

      unless disk_owner(device).to_s.empty?
Severity: Minor
Found in crowbar_framework/app/models/node.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 render_barclamp_edit_deployment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def render_barclamp_edit_deployment(proposal)
    if show_raw_deployment?
      render partial: "barclamp/edit_deployment_raw"
    else
      if Rails.root.join("app", "views", "barclamp", proposal.barclamp, "_edit_deployment.html.haml").file?
Severity: Minor
Found in crowbar_framework/app/helpers/barclamps_helper.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

Severity
Category
Status
Source
Language