crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

Method validate_proposal_elements has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_proposal_elements proposal_elements
    proposal_elements.each do |role_and_elements|
      role, elements = role_and_elements
      uniq_elements  = elements.uniq

Severity: Minor
Found in crowbar_framework/app/models/service_object.rb - About 3 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_role_list has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def node_role_list(node)
    all_roles     = RoleObject.all
    all_proposals = Proposal.all

    list_items = ActiveSupport::OrderedHash.new.tap do |listing|
Severity: Minor
Found in crowbar_framework/app/helpers/nodes_helper.rb - About 3 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

File rails.js has 302 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function($, undefined) {

/**
 * Unobtrusive scripting adapter for jQuery
 * https://github.com/rails/jquery-ujs
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/rails.js - About 3 hrs to fix

Function _keydown has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _keydown: function( event ) {
        /*jshint maxcomplexity:20*/
        var match, prev, character, skip, regex,
            preventDefault = true;

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

Function initPreviewDeletes has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        initPreviewDeletes: function () {
            var self = this, deleteExtraData = self.deleteExtraData || {},
                resetProgress = function () {
                    var hasFiles = self.isUploadable ? previewCache.count(self.id) : self.$element.get(0).files.length;
                    if (self.$preview.find('.kv-file-remove').length === 0 && !hasFiles) {
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/bootstrap/fileinput.js - About 3 hrs to fix

Function anonymous has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {


  function strip(start, end) {
    return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end);
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/misc/handlebars.js - About 3 hrs to fix

Function formatDate has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    formatDate: function (format, date, settings) {
        if (!date) {
            return "";
        }

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

Function init has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        init: function (options) {
            var self = this, $el = self.$element, t;
            $.each(options, function (key, value) {
                switch (key) {
                    case 'minFileCount':
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/bootstrap/fileinput.js - About 3 hrs to fix

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

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

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

Method unique_name has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

        def unique_name
          # check first if we have already a claimed disk which points to the same
          # device node. if so, use that as "unique name"
          already_claimed_name = self.unique_name_already_claimed_by
          unless already_claimed_name.nil?
Severity: Minor
Found in chef/cookbooks/barclamp/libraries/barclamp_library.rb - About 3 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 initiate_nodes_upgrade has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def initiate_nodes_upgrade
    upgrade_nodes = Node.all.reject do |node|
      node.admin? || node[:platform] == "windows" || node.state != "crowbar_upgrade"
    end
    check_if_nodes_are_available upgrade_nodes
Severity: Minor
Found in crowbar_framework/app/models/crowbar_service.rb - About 3 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 _clear has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _clear: function(event, noPropagation) {

        this.reverting = false;
        // We delay all events that have to be triggered to after the point where the placeholder has been removed and
        // everything else normalized again
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 3 hrs to fix

Method deallocate_ip_by_type has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def deallocate_ip_by_type(bc_instance, network, object, type)
    Rails.logger.debug("Network deallocate ip from #{type}: entering #{object} #{network}")

    return [404, "No network specified"] if network.nil?
    return [404, "No type specified"] if type.nil?
Severity: Major
Found in crowbar_framework/app/models/network_service.rb - About 3 hrs to fix

Function Sizzle has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Sizzle( selector, context, results, seed ) {
    var match, elem, m, nodeType,
        // QSA vars
        i, groups, old, nid, newContext, newSelector;

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

Function _mouseDrag has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _mouseDrag: function(event) {
        var i, item, itemElement, intersection,
            o = this.options,
            scrolled = false;

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

Function _mouseStart has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _mouseStart: function(event, overrideHandle, noActivation) {

        var i, body,
            o = this.options;

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

Function registerDefaultHelpers has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function registerDefaultHelpers(instance) {
    instance.registerHelper('helperMissing', function(arg) {
      if(arguments.length === 2) {
        return undefined;
      } else {
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/misc/handlebars.js - About 3 hrs to fix

Function buildFragment has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    buildFragment: function( elems, context, scripts, selection ) {
        var j, elem, contains,
            tmp, tag, tbody, wrap,
            l = elems.length,

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

Function _mouseDrag has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _mouseDrag: function(event) {

        this.dragged = true;

        if (this.options.disabled) {
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix

Function Datepicker has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Datepicker() {
    this._curInst = null; // The current instance in use
    this._keyEvent = false; // If the last event was a key event
    this._disabledInputs = []; // List of date picker inputs that have been disabled
    this._datepickerShowing = false; // True if the popup picker is showing , false if not
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 2 hrs to fix
Severity
Category
Status
Source
Language