crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

Function initFileActions has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        initFileActions: function () {
            var self = this;
            if (!self.showPreview) {
                return;
            }
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/bootstrap/fileinput.js - About 2 hrs to fix

Consider simplifying this complex logical expression.
Open

    if (params[:raid_type] == "raid1" && raid_disks_selected < 2) || \
        (params[:raid_type] == "raid0" && raid_disks_selected < 1) || \
        (params[:raid_type] == "raid5" && raid_disks_selected < 3) || \
        (params[:raid_type] == "raid6" && raid_disks_selected < 4) || \
        (params[:raid_type] == "raid10" && raid_disks_selected < 4)
Severity: Critical
Found in crowbar_framework/app/controllers/nodes_controller.rb - About 2 hrs to fix

Function internalRemoveData has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function internalRemoveData( elem, name, pvt ) {
    if ( !jQuery.acceptData( elem ) ) {
        return;
    }

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

Function _setOption has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _setOption: function( key, value ) {
        /*jshint maxcomplexity:15*/
        var isDraggable, isResizable,
            uiDialog = this.uiDialog;

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

Function _setOption has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _setOption: function( key, value ) {
        var i,
            valsLength = 0;

        if ( key === "range" && this.options.range === true ) {
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Function blind has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$.effects.effect.blind = function( o, done ) {
    // Create element
    var el = $( this ),
        props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
        mode = $.effects.setMode( el, o.mode || "hide" ),
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Method transition has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def transition(inst, name, state)
    Rails.logger.debug("Provisioner transition: entering:  #{name} for #{state}")

    # hardware-installing for the bootdisk finder
    if ["hardware-installing", "installed", "readying"].include? state
Severity: Minor
Found in crowbar_framework/app/models/provisioner_service.rb - About 1 hr to fix

Method process_queue has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def process_queue
      logger.debug("process queue: enter")
      loop_again = true
      while loop_again
        loop_again = false
Severity: Minor
Found in crowbar_framework/lib/crowbar/deployment_queue.rb - About 1 hr to fix

Function _determineDate has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _determineDate: function(inst, date, defaultDate) {
        var offsetNumeric = function(offset) {
                var date = new Date();
                date.setDate(date.getDate() + offset);
                return date;
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Function _animate has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _animate: function( toShow, toHide, data ) {
        var total, easing, duration,
            that = this,
            adjust = 0,
            down = toShow.length &&
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 1 hr to fix

Function _mouseCapture has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _mouseCapture: function( event ) {
        var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
            that = this,
            o = this.options;

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

Function _toggle has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _toggle: function( event, eventData ) {
        var that = this,
            toShow = eventData.newPanel,
            toHide = eventData.oldPanel;

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

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

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

def get_supported_speeds(interface)
  ecmd = EthtoolCmd.new
  ecmd.cmd = ETHTOOL_GSET

  ifreq = [interface, ecmd.data].pack("a16P")
Severity: Minor
Found in chef/cookbooks/ohai/files/default/plugins/crowbar.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 make_zone has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def make_zone(zone)
  # copy over SOA records that we have not overridden
  populate_soa zone
  zonefile_entries=Array.new
  Chef::Log.debug "Processing zone: #{zone.inspect}"
Severity: Minor
Found in chef/cookbooks/bind9/recipes/default.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_postponed_nodes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_postponed_nodes(proposal)
    return unless upgrade_postponed?

    skip_unready_nodes_enabled = Rails.application.config.crowbar.fetch(
      "skip_unready_nodes", {}
Severity: Minor
Found in crowbar_framework/app/models/service_object.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 violates_admin_constraint? has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def violates_admin_constraint?(elements, role, nodes_is_admin = {})
    if role_constraints[role] && !role_constraints[role]["admin"]
      elements[role].each do |element|
        next if is_cluster?(element) || is_remotes?(element)
        unless nodes_is_admin.key? element
Severity: Minor
Found in crowbar_framework/app/models/service_object.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 prepare_nodes_for_crowbar_upgrade has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def prepare_nodes_for_crowbar_upgrade
    proposal = Proposal.find_by(barclamp: "crowbar", name: "default")

    # To all nodes, add a new role which prepares them for the upgrade
    nodes_to_upgrade = []
Severity: Minor
Found in crowbar_framework/app/models/crowbar_service.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 set_state has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def set_state(state)
    # use the real transition function for this
    cb = CrowbarService.new
    result = cb.transition "default", @node.name, state

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

  def hash_to_ul(hash)
    content_tag :ul do
      hash.collect do |key, value|
        content = []

Severity: Minor
Found in crowbar_framework/app/helpers/tag_helper.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