crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

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

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

    # discovering because mandatory for discovery image
    if ["discovering", "readying"].include? state
Severity: Major
Found in crowbar_framework/app/models/ipmi_service.rb - About 2 hrs to fix

Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    parse: function( red, green, blue, alpha ) {
        if ( red === undefined ) {
            this._rgba = [ null, null, null, null ];
            return this;
        }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

Method canonical_address has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def canonical_address
      f = 0
      in_run = false
      runs = Array.new
      a = self.to_a
Severity: Minor
Found in chef/cookbooks/barclamp/libraries/ip.rb - About 2 hrs 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 openstackbackup has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def openstackbackup
        crowbar_lib_dir = "/var/lib/crowbar"
        dump_path = "#{crowbar_lib_dir}/backup/8-to-9-openstack_dump.sql.gz"
        if File.exist?(dump_path)
          Rails.logger.warn("OpenStack backup already exists. Skipping...")
Severity: Minor
Found in crowbar_framework/app/models/api/upgrade.rb - About 2 hrs 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_proposal_after_save has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_proposal_after_save proposal
    require "set"

    proposal["attributes"]["provisioner"]["packages"].each do |platform, packages|
      packages.each do |package|
Severity: Minor
Found in crowbar_framework/app/models/provisioner_service.rb - About 2 hrs 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 interface_list has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def interface_list
    return [] if @node.nil?
    answer = []
    @node["network"]["interfaces"].each do |k,v|
      next if k == "lo"     # no loopback, please
Severity: Minor
Found in crowbar_framework/app/models/node.rb - About 2 hrs 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_pending_elements has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def add_pending_elements(bc, inst, element_order, elements, queue_me, pre_cached_nodes = {})
      nodes_map, pre_cached_nodes = elements_to_nodes_to_roles_map(
        elements, element_order, pre_cached_nodes
      )

Severity: Minor
Found in crowbar_framework/lib/crowbar/deployment_queue.rb - About 2 hrs 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 elements_to_nodes_to_roles_map has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def elements_to_nodes_to_roles_map(elements, element_order = [], pre_cached_nodes = {})
      nodes_map = {}
      active_elements = element_order.flatten

      elements.each do |role_name, nodes|
Severity: Minor
Found in crowbar_framework/lib/crowbar/deployment_queue.rb - About 2 hrs 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 readInput has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function readInput() {
      if (leaveInputAlone) return;
      var changed = false, text = input.value, sr = selRange(input);
      if (!sr) return false;
      var changed = editing.text != text, rs = reducedSelection;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

Function keydown has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            keydown: function( event ) {
                /*jshint maxcomplexity:15*/
                if ( this.element.prop( "readOnly" ) ) {
                    suppressKeyPress = true;
                    suppressInput = true;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

Function _refreshValue has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _refreshValue: function() {
        var lastValPercent, valPercent, value, valueMin, valueMax,
            oRange = this.options.range,
            o = this.options,
            that = this,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

Function _processTabs has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _processTabs: function() {
        var that = this;

        this.tablist = this._getList()
            .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

Method node_barclamp_list has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def node_barclamp_list(node)
    all_proposals = Proposal.all

    list_items = ActiveSupport::OrderedHash.new.tap do |listing|
      node_barclamps(node).map do |role|
Severity: Major
Found in crowbar_framework/app/helpers/nodes_helper.rb - About 2 hrs to fix

Function remove has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    remove: function( elem, types, handler, selector, mappedTypes ) {
        var j, handleObj, tmp,
            origCount, t, events,
            special, handlers, type,
            namespaces, origType,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

Function onMouseDown has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function onMouseDown(e) {
      var ld = lastDoubleClick; lastDoubleClick = null;
      // First, see if this is a click in the gutter
      for (var n = e.target(); n != wrapper; n = n.parentNode)
        if (n.parentNode == gutterText) {
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

Function retrieveAllocated has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  NodeList.prototype.retrieveAllocated = function() {
    var self = this;

    $.each(self.json.elements, function(role, nodes) {
      var $role = $(self.dataBag.roleTarget.format(role));
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/nodeList.js - About 2 hrs to fix

Method unique_device_for has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def unique_device_for(device)
    # check first if we have already a claimed disk which points to the same
    # device node. if so, use that as "unique device"
    already_claimed_name = self.unique_name_already_claimed_by(device)
    unless already_claimed_name.nil?
Severity: Major
Found in crowbar_framework/app/models/node.rb - About 2 hrs to fix

Consider simplifying this complex logical expression.
Open

                if ( ( mappedTypes || origType === handleObj.origType ) &&
                    ( !handler || handler.guid === handleObj.guid ) &&
                    ( !tmp || tmp.test( handleObj.namespace ) ) &&
                    ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
                    handlers.splice( j, 1 );
Severity: Critical
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

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

  next:function () {
          if (this.done) {
              return this.EOF;
          }
          if (!this._input) this.done = true;
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/misc/handlebars.js - About 2 hrs to fix

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

$.effects.animateClass = function( value, duration, easing, callback ) {
    var o = $.speed( duration, easing, callback );

    return this.queue( function() {
        var animated = $( this ),
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix
Severity
Category
Status
Source
Language