crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

Function getCurrentRegionTooltip has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      getCurrentRegionTooltip: function () {
        var options = this.options,
          header = '',
          entries = [],
          fields, formats, formatlen, fclass, text, i,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/sparkline.js - About 2 hrs to fix

Method parallel_upgrade_compute_nodes has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def parallel_upgrade_compute_nodes(compute_nodes, controller = nil)
        Rails.logger.info("Entering parallel upgrade of compute nodes, #{upgrade_mode} mode")
        Rails.logger.info("Nodes for upgrade: #{compute_nodes.map(&:name).join(', ')}")
        save_nodes_state(compute_nodes, "compute", "upgrading")
        save_node_action("upgrading the packages")
Severity: Major
Found in crowbar_framework/app/models/api/upgrade.rb - About 2 hrs to fix

Function superMatcher has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        superMatcher = function( seed, context, xml, results, outermost ) {
            var elem, j, matcher,
                matchedCount = 0,
                i = "0",
                unmatched = seed && [],
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

Function _showDatepicker has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _showDatepicker: function(input) {
        input = input.target || input;
        if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
            input = $("input", input.parentNode)[0];
        }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

Method add_and_filter has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def add_and_filter(file, add, filter_re)
  lock = nil
  lock = lock(@new_resource)
  need_to_add = !add.nil?
  need_to_remove = false
Severity: Minor
Found in chef/cookbooks/utils/providers/line.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 node_state_valid_for_role? has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def self.node_state_valid_for_role?(node, barclamp, role)
    # We always want deployer-client, both for heartbeat but also because it
    # sets up the ability to use the barclamp library
    return true if role == "deployer-client"

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

  def skip_unready_nodes(bc, inst, new_elements, old_elements)
    logger.debug("skip_unready_nodes: enter for #{bc}:#{inst}")
    skip_unready_nodes_roles = Rails.application.config.crowbar.fetch(
      "skip_unready_nodes", {}
    ).fetch("roles", [])
Severity: Minor
Found in crowbar_framework/app/models/service_object.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 element_nodes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def element_nodes(roles = self.class.all, nodes = Node.all)
    assigned_nodes = []

    # Get all nodes from proposal roles mentioning this one
    proposal_roles(roles).each do |prop|
Severity: Minor
Found in crowbar_framework/app/models/role_object.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 expand_nodes_for_all has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def expand_nodes_for_all(items)
    nodes = []
    failures = []

    items.each do |item|
Severity: Minor
Found in crowbar_framework/lib/crowbar_pacemaker_proxy.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 restore_chef has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

      def restore_chef
        Rails.logger.debug "Restoring chef backup files"

        begin
          [:nodes, :roles, :clients, :databags].each do |type|
Severity: Minor
Found in crowbar_framework/lib/crowbar/backup/restore.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 init has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    init = jQuery.fn.init = function( selector, context ) {
        var match, elem;

        // HANDLE: $(""), $(null), $(undefined), $(false)
        if ( !selector ) {
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

Function send has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                send: function( headers, complete ) {
                    var i,
                        xhr = options.xhr(),
                        id = ++xhrId;

Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

Function domManip has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    domManip: function( args, callback ) {

        // Flatten any nested arrays
        args = concat.apply( [], args );

Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

Function drag has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    drag: function(event, ui) {

        var ts, bs, ls, rs, l, r, t, b, i, first,
            inst = $(this).data("ui-draggable"),
            o = inst.options,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

Function drag has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    drag: function(event, ui) {

        var inst = $(this).data("ui-draggable"), that = this;

        $.each(inst.sortables, function() {
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

Method node_ip_list has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def node_ip_list(ips)
    entries = [].tap do |result|
      ips.each do |network, addresses|
        unless network == "~notconnected" and addresses.nil?
          network_list = if ["[not managed]", "[dhcp]"].include? network
Severity: Major
Found in crowbar_framework/app/helpers/nodes_helper.rb - About 2 hrs to fix

Function CHILD has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        "CHILD": function( type, what, argument, first, last ) {
            var simple = type.slice( 0, 3 ) !== "nth",
                forward = type.slice( -4 ) !== "last",
                ofType = what === "of-type";

Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

Function Deferred has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    Deferred: function( func ) {
        var tuples = [
                // action, add listener, listener list, final state
                [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
                [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

Function success has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      success: function(data) {
        // check for invalid network.json
        $("#network-alert").remove();
        if (!data.network.valid) {
          $(".button_to").find("input").prop("disabled", true);
Severity: Major
Found in crowbar_framework/app/assets/javascripts/installer.js - About 2 hrs to fix

Function explode has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$.effects.effect.explode = function( o, done ) {

    var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
        cells = rows,
        el = $( this ),
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix
Severity
Category
Status
Source
Language