crowbar/crowbar-core

View on GitHub

Showing 6,062 of 6,062 total issues

Method prepare_compute_nodes has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def prepare_compute_nodes(virt)
        Rails.logger.info("Preparing #{virt} compute nodes for upgrade... ")
        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 1 hr to fix

Method available_platforms has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def available_platforms(architecture)
      @available_platforms ||= begin
        provisioner = Node.find("roles:provisioner-server").first
        if provisioner.nil?
          {}
Severity: Minor
Found in crowbar_framework/app/models/node.rb - About 1 hr to fix

Method queue_proposal has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def queue_proposal(bc, inst, elements, element_order, deps, pre_cached_nodes)
      logger.debug("queue proposal: enter for #{bc}:#{inst}")
      delay = []
      begin
        lock = acquire_lock("queue")
Severity: Minor
Found in crowbar_framework/lib/crowbar/deployment_queue.rb - About 1 hr to fix

Method proposal_edit has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def proposal_edit(name)
  usage(-1) if name.nil? or name == ""

  if @data.nil? or @data == ""
    struct = get_json("/proposals/#{name}")
Severity: Minor
Found in bin/barclamp_lib.rb - About 1 hr to fix

Method values has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def values
      @timeouts_config = begin
        YAML.load_file("/etc/crowbar/upgrade_timeouts.yml")
      rescue
        Rails.logger.debug(
Severity: Minor
Found in crowbar_framework/lib/crowbar/upgrade_timeouts.rb - About 1 hr to fix

Method wait_for_ssh_state has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def wait_for_ssh_state(desired_state, action)
      Timeout.timeout(800) do
        loop do
          ssh_status = @node.ssh_cmd("").first
          break if desired_state == :up ? ssh_status == 200 : ssh_status != 200
Severity: Minor
Found in crowbar_framework/app/models/api/node.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 run_online_migrations has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def run_online_migrations
        nova_nodes = ::Node.find("roles:nova-controller")
        heat_nodes = ::Node.find("roles:heat-server")
        return if nova_nodes.empty? && heat_nodes.empty?

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

  def validate_public_name(value, unique_check = true)
    unless value.to_s.empty?
      if !(value =~ /^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$/)
        Rails.logger.warn "Public name #{value} not saved because it did not conform to valid DNS hostnames"
        raise "#{I18n.t('invalid_dns_public_name', scope: 'model.node')}: #{value}"
Severity: Minor
Found in crowbar_framework/app/models/node.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 index has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    @export = default_export_hash
    export_dir.children.each do |file|
      filename = file.basename.to_s

Severity: Minor
Found in crowbar_framework/app/controllers/support_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 aaaLogin has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def aaaLogin(ucs_url, username, password)
    if ucs_url.blank?
      logger.debug "Cisco UCS: missing login URL"
      redirect_to ucs_settings_path, alert: "You must provide a login URL"
      return nil
Severity: Minor
Found in crowbar_framework/app/controllers/ucs_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 nodes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def nodes

    net_bc = RoleObject.find_role_by_name "network-config-default"
    @modes = []
    @active_mode = @mode = net_bc.default_attributes["network"]["mode"]
Severity: Minor
Found in crowbar_framework/app/controllers/network_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 check_key_file has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def check_key_file
      expected = @config.fetch("repomd", {})["fingerprint"]
      return true if expected.blank?

      key_path = repodata_path.join("repomd.xml.key")
Severity: Minor
Found in crowbar_framework/lib/crowbar/repository.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 end_step has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def end_step(success = true, errors = {})
      ::Crowbar::Lock::LocalBlocking.with_lock(shared: false, logger: @logger, path: lock_path) do
        unless running?
          @logger.warn("The step is not running, could not be finished")
          raise Crowbar::Error::EndStepRunningError.new(current_step)
Severity: Minor
Found in crowbar_framework/lib/crowbar/upgrade_status.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 ip_addrs has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        def ip_addrs(version = :ipv4)
          [].tap do |addresses|
            Resolv.getaddresses(fqdn).each do |address|
              ip_addr = IPAddr.new(address)
              if version == :ipv6
Severity: Minor
Found in crowbar_framework/lib/crowbar/checks/network.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 pretty_target_platform has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def pretty_target_platform(target_platform)
        return "openSUSE Leap 42.1" if target_platform == "opensuse-42.1"
        return "SLES 12 SP4" if target_platform == "suse-12.4"
        return "SLES 12 SP3" if target_platform == "suse-12.3"
        return "SLES 12 SP2" if target_platform == "suse-12.2"
Severity: Minor
Found in crowbar_framework/lib/crowbar/platform.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

Function showHide has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function showHide( elements, show ) {
    var display, elem, hidden,
        values = [],
        index = 0,
        length = elements.length;
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 1 hr to fix

Function access has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
    var i = 0,
        length = elems.length,
        bulk = key == null;

Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 1 hr to fix

Function dispatch has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    dispatch: function( event ) {

        // Make a writable jQuery.Event from the native event object
        event = jQuery.event.fix( event );

Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 1 hr to fix

Function clone has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    clone: function( elem, dataAndEvents, deepDataAndEvents ) {
        var destElements, node, clone, i, srcElements,
            inPage = jQuery.contains( elem.ownerDocument, elem );

        if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 1 hr to fix

Function _dialogDatepicker has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _dialogDatepicker: function(input, date, onSelect, settings, pos) {
        var id, browserWidth, browserHeight, scrollX, scrollY,
            inst = this._dialogInst; // internal instance

        if (!inst) {
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix
Severity
Category
Status
Source
Language