crowbar/crowbar-core

View on GitHub

Showing 6,062 of 6,062 total issues

Function removeValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  Array.prototype.removeValue = function() {
    var a = arguments;
    var L = a.length;
    var what;
    var ax;
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/misc/arrayRemove.js - 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 downgrade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def downgrade(ta, td, a, d)
  unless ta["chef"].key?("solr_heap")
    a.delete["chef"]["solr_heap"]
  end
  unless ta["chef"].key?("solr_tmpfs")
Severity: Minor
Found in chef/data_bags/crowbar/migrate/crowbar/102_chef-solr.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 add_restart_management_node_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def add_restart_management_node_attributes
      @node.set[:crowbar_wall] = {} unless @node[:crowbar_wall]
      @node.set[:crowbar_wall][:requires_restart] = {} \
            unless @node[:crowbar_wall][:requires_restart]
      @node.set[:crowbar_wall][:requires_restart][cookbook] = {} \
Severity: Minor
Found in chef/cookbooks/utils/libraries/restart_manager.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 upgrade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def upgrade(ta, td, a, d)
  unless a.key("chef")
    a["chef"] = ta["chef"]
  end
  unless a["chef"].key?("solr_heap")
Severity: Minor
Found in chef/data_bags/crowbar/migrate/crowbar/102_chef-solr.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 get_host_for_admin_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.get_host_for_admin_url(node, use_cluster = false)
    if use_cluster && defined?(CrowbarPacemakerHelper)
      # loose dependency on the pacemaker cookbook
      cluster_vhostname = CrowbarPacemakerHelper.cluster_vhostname(node)

Severity: Minor
Found in chef/cookbooks/utils/libraries/helpers.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 upgrade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def upgrade(template_attrs, template_deployment, attrs, deployment)
  unless defined?(@@dns_designate_rndc_key)
    service = ServiceObject.new "fake-logger"
    @@dns_designate_rndc_key = service.random_password
  end
Severity: Minor
Found in chef/data_bags/crowbar/migrate/dns/301_add_rndckey.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 kill_nic_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def kill_nic_files(nic)
  case node[:platform_family]
  when "rhel"
    # Redhat and Centos have lots of small files definining interfaces.
    # Delete the ones we no longer care about here.
Severity: Minor
Found in chef/cookbooks/network/recipes/default.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.create(nic, slaves = [])
      Chef::Log.info("Creating new bridge #{nic}")
      if self.exists?(nic)
        raise ::ArgumentError.new("#{nic} already exists.")
      end
Severity: Minor
Found in chef/cookbooks/barclamp/libraries/nic.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 release_chef_locks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def release_chef_locks(locks)
    return if locks.empty?

    queue = Queue.new
    locks.each { |l| queue.push l }
Severity: Minor
Found in crowbar_framework/app/models/service_object.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 attribute_names has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def attribute_names
        super.tap do |values|
          unless values.include?("includes")
            values.push("includes")
          end
Severity: Minor
Found in crowbar_framework/app/models/batch/base.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 unlock_crowbar_ui_package has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def unlock_crowbar_ui_package
        ui_unlock = run_cmd("sudo zypper-retry removelock 'crowbar-ui*'")
        unless ui_unlock[:exit_code].zero?
          raise_node_upgrade_error(
            "Removing crowbar-ui package lock has failed. " \
Severity: Minor
Found in crowbar_framework/app/models/api/upgrade.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 upgrade_compute_nodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def upgrade_compute_nodes(virt)
        Rails.logger.info("Upgrading #{virt} compute nodes... ")
        compute_nodes = ::Node.find("roles:nova-compute-#{virt}")
        if compute_nodes.empty?
          Rails.logger.info("There are no compute nodes of #{virt} type.")
Severity: Minor
Found in crowbar_framework/app/models/api/upgrade.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 save_archive has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def save_archive
    if file.nil?
      errors.add_on_blank :file
      return false
    end
Severity: Minor
Found in crowbar_framework/app/models/api/backup.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 skip_unchanged_node? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def skip_unchanged_node?(node_name, old_role, new_role)
    # if old_role is nil, then we are applying the barclamp for the first time
    return false if old_role.nil?

    # if the servers have changed, we need to apply
Severity: Minor
Found in crowbar_framework/app/models/ntp_service.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 save_nodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def save_nodes(nodes)
    return if nodes.empty?

    queue = Queue.new
    nodes.each { |n| queue.push n }
Severity: Minor
Found in crowbar_framework/app/models/service_object.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 upgrade! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def upgrade!
        if upgrading?
          return {
            status: :unprocessable_entity,
            message: I18n.t("api.crowbar.upgrade_ongoing")
Severity: Minor
Found in crowbar_framework/app/models/api/crowbar.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 save_config_to_databag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def save_config_to_databag(old_role, role)
    if role.nil?
      config = nil
    else
      server_nodes_names = role.override_attributes["ntp"]["elements"]["ntp-server"]
Severity: Minor
Found in crowbar_framework/app/models/ntp_service.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 run_remote_chef_client has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def run_remote_chef_client(node, command, logfile_name)
    Thread.new do
      # Exec command
      # the -- tells sudo to stop interpreting options

Severity: Minor
Found in crowbar_framework/app/models/service_object.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 expander has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def expander(values)
      {}.tap do |result|
        values.each do |full|
          barclamp, proposal = full.split(".")

Severity: Minor
Found in crowbar_framework/app/models/batch/base.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 enable_compute_service has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def enable_compute_service(controller, node, only_enable = false)
        hostname = node[:hostname]
        controller.run_ssh_cmd(
          "source /root/.openrc; " \
          "openstack --insecure compute service set --enable #{hostname} nova-compute"
Severity: Minor
Found in crowbar_framework/app/models/api/upgrade.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