crowbar/crowbar-core

View on GitHub

Showing 6,062 of 6,062 total issues

Avoid deeply nested control flow statements.
Open

                        if ( deleteExpando ) {
                            delete elem[ internalKey ];

                        } else if ( typeof elem.removeAttribute !== strundefined ) {
                            elem.removeAttribute( internalKey );
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                                if ( typeof xhr.responseText === "string" ) {
                                    responses.text = xhr.responseText;
                                }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
                        contains( context, elem ) && elem.id === m ) {
                        results.push( elem );
                        return results;
                    }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if ( Expr.relative[ tokens[j].type ] ) {
                        break;
                    }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        for ( match in context ) {
                            // Properties of context are called as methods if possible
                            if ( jQuery.isFunction( this[ match ] ) ) {
                                this[ match ]( context[ match ] );

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

Avoid deeply nested control flow statements.
Open

                        if ( (elem = matcherOut[i]) ) {
                            // Restore matcherIn since elem is not yet a final match
                            temp.push( (matcherIn[i] = elem) );
                        }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if ( matches[ sel ] ) {
                            matches.push( handleObj );
                        }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                            if (lookAhead("'")) {
                                output += "'";
                            } else {
                                literal = true;
                            }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if ( typeof elem.getElementsByTagName !== "undefined" ) {
                        // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
                        jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );

                        // Splice the scripts into ret after their former ancestor and advance our index beyond them
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/migrate.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                if (val > 0) {
                  stackTotals[i] += val;
                }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/sparkline.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                if (stackMin < 0 && stackMax > 0) {
                  if (val < 0) {
                    stackRangesNeg[i] += Math.abs(val);
                  } else {
                    stackRanges[i] += val;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/sparkline.js - About 45 mins to fix

Function drawLine has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      drawLine: function (x1, y1, x2, y2, lineColor, lineWidth) {
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/sparkline.js - About 45 mins to fix

Function invokePartial has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data) {
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/misc/handlebars.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        switch (col) {
                            case 0: calender += " ui-datepicker-group-first";
                                cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break;
                            case numMonths[1]-1: calender += " ui-datepicker-group-last";
                                cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 45 mins to fix

Function drawCircle has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      drawCircle: function (x, y, radius, lineColor, fillColor, lineWidth) {
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/sparkline.js - About 45 mins to fix

Function drawRect has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      drawRect: function (x, y, width, height, lineColor, fillColor) {
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/sparkline.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                      if (this.terminals_[p] && p > 2) {
                          expected.push("'" + this.terminals_[p] + "'");
                      }
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/misc/handlebars.js - About 45 mins to fix

Method get_repos has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def get_repos(platform, version, arch)
        repositories = {}
        db = "repos-#{platform}-#{version}-#{arch}".tr(".", "_")

        repos_db = begin
Severity: Minor
Found in chef/cookbooks/provisioner/libraries/repositories.rb - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
Open

def upgrade(ta, td, a, d)
  unless a["networks"]["nova_floating"].key? "add_ovs_bridge"
    a["networks"]["nova_floating"]["add_ovs_bridge"] = ta["networks"]["nova_floating"]["add_ovs_bridge"]
  end
  unless a["networks"]["nova_floating"].key? "bridge_name"
Severity: Minor
Found in chef/data_bags/crowbar/migrate/network/011_add_ovs_attributes.rb - About 45 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 allocate_ip_by_type has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def allocate_ip_by_type(bc_instance, network, range, object, type, suggestion = nil)
Severity: Minor
Found in crowbar_framework/app/models/network_service.rb - About 45 mins to fix
Severity
Category
Status
Source
Language