crowbar/crowbar-core

View on GitHub

Showing 6,062 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                case 39: if (event.ctrlKey || event.metaKey) {
                            $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
                        }
                        handled = event.ctrlKey || event.metaKey;
                        // +1 day on ctrl or command +right
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js and 1 other location - About 6 hrs to fix
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 7392..7403

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 160.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                case 37: if (event.ctrlKey || event.metaKey) {
                            $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D");
                        }
                        handled = event.ctrlKey || event.metaKey;
                        // -1 day on ctrl or command +left
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js and 1 other location - About 6 hrs to fix
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 7409..7420

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 160.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js and 1 other location - About 5 hrs to fix
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 5083..5083

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 141.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js and 1 other location - About 5 hrs to fix
crowbar_framework/vendor/assets/javascripts/jquery/ui.js on lines 5080..5080

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 141.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language