crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

Function render has 159 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      render: function () {
        var options = this.options,
          target = this.target,
          canvasWidth = this.canvasWidth,
          canvasHeight = this.canvasHeight,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/sparkline.js - About 6 hrs to fix

Method deployment_check has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

      def deployment_check
        ret = {}
        # Only allow the upgrade for mariadb setup
        # TODO: update the search if we allow multiple proposals
        db_node = ::Node.find("roles:database-server").first
Severity: Minor
Found in crowbar_framework/app/models/api/crowbar.rb - About 6 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 size has 156 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    // Create element
    var original, baseline, factor,
        el = $( this ),
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 6 hrs to fix

File blockui.js has 423 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * jQuery blockUI plugin
 * Version 2.66.0-2013.10.09
 * Requires jQuery v1.7 or later
 *
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/blockui.js - About 6 hrs to fix

File crowbar_service.rb has 421 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class CrowbarService < ServiceObject
  attr_accessor :transition_save_node

  def initialize(thelogger = nil)
    super
Severity: Minor
Found in crowbar_framework/app/models/crowbar_service.rb - About 6 hrs to fix

File update_nodes.rb has 420 lines of code (exceeds 250 allowed). Consider refactoring.
Open

def find_node_boot_mac_addresses(node, admin_data_net)
  # If we don't have an admin IP allocated yet, using node.macaddress is
  # our best guess for the boot macaddress.
  if admin_data_net.nil? || \
      admin_data_net.interface_list.nil?
Severity: Minor
Found in chef/cookbooks/provisioner/recipes/update_nodes.rb - About 6 hrs to fix

Function parseDate has 148 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    parseDate: function (format, value, settings) {
        if (format == null || value == null) {
            throw "Invalid arguments";
        }

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

Function position has 147 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$.fn.position = function( options ) {
    if ( !options || !options.of ) {
        return _position.apply( this, arguments );
    }

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

Function __module2__ has 145 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var __module2__ = (function(__dependency1__, __dependency2__) {
  "use strict";
  var __exports__ = {};
  /*globals Exception, Utils */
  var Utils = __dependency1__;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/misc/handlebars.js - About 5 hrs to fix

Class RoleObject has 42 methods (exceeds 20 allowed). Consider refactoring.
Open

class RoleObject < ChefObject
  self.chef_type = "role"

  def cluster_roles(roles = RoleObject.all)
    @cluster_roles ||= begin
Severity: Minor
Found in crowbar_framework/app/models/role_object.rb - About 5 hrs to fix

Method proposal_update has 137 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def proposal_update
    if params[:submit].nil?
      #
      # This is RESTFul path
      #
Severity: Major
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 5 hrs to fix

Method transition has a Cognitive Complexity of 36 (exceeds 5 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: Minor
Found in crowbar_framework/app/models/ipmi_service.rb - About 5 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 _create has 135 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _create: function() {
        this.element.closest( "form" )
            .unbind( "reset" + this.eventNamespace )
            .bind( "reset" + this.eventNamespace, formResetHandler );

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

Class Proposal has 40 methods (exceeds 20 allowed). Consider refactoring.
Open

class Proposal < ActiveRecord::Base
  # FIXME: remove this when the export is properly implemented
  class_attribute :chef_type

  self.chef_type = "data_bag_item"
Severity: Minor
Found in crowbar_framework/app/models/proposal.rb - About 5 hrs to fix

Class UpgradeStatus has 40 methods (exceeds 20 allowed). Consider refactoring.
Open

  class UpgradeStatus
    attr_reader :progress_file_path
    attr_accessor :progress

    # Return the current state of upgrade process.
Severity: Minor
Found in crowbar_framework/lib/crowbar/upgrade_status.rb - About 5 hrs to fix

Function readFiles has 133 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        readFiles: function (files) {
            this.reader = new FileReader();
            var self = this, $el = self.$element, $preview = self.$preview, reader = self.reader,
                $container = self.$previewContainer, $status = self.$previewStatus, msgLoading = self.msgLoading,
                msgProgress = self.msgProgress, previewInitId = self.previewInitId, numFiles = files.length,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/bootstrap/fileinput.js - About 5 hrs to fix

Function render has 130 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      render: function () {
        var target = this.target,
          values = this.values,
          vlen = values.length,
          options = this.options,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/sparkline.js - About 5 hrs to fix

Function Callbacks has 128 lines of code (exceeds 25 allowed). Consider refactoring.
Open

jQuery.Callbacks = function( options ) {

    // Convert options from String-formatted to Object-formatted if needed
    // (we check in cache first)
    options = typeof options === "string" ?
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 5 hrs to fix

File migrate.js has 379 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * jQuery Migrate - v1.2.1 - 2013-05-08
 * https://github.com/jquery/jquery-migrate
 * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
 */
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/migrate.js - About 5 hrs to fix

File dynamicTable.js has 379 lines of code (exceeds 250 allowed). Consider refactoring.
Open

;(function($, doc, win) {
  'use strict';

  function DynamicTable(el, options) {
    this.root = $(el);
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js - About 5 hrs to fix
Severity
Category
Status
Source
Language