crowbar/crowbar-core

View on GitHub

Showing 6,062 of 6,062 total issues

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

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

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.popover')
      var options = typeof option == 'object' && option
crowbar_framework/vendor/assets/javascripts/bootstrap/tooltip.js on lines 651..661

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 137.

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

          if (spotRadius && options.get('minSpotColor')) {
            x = xvalues[$.inArray(this.minyorg, yvalues)];
            target.drawCircle(canvasLeft + Math.round((x - this.minx) * (canvasWidth / rangex)),
              canvasTop + Math.round(canvasHeight - (canvasHeight * ((this.minyorg - this.miny) / rangey))),
              spotRadius, undefined,
crowbar_framework/vendor/assets/javascripts/jquery/sparkline.js on lines 1685..1691

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 137.

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

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.tooltip')
      var options = typeof option == 'object' && option
crowbar_framework/vendor/assets/javascripts/bootstrap/popover.js on lines 97..107

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 137.

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

          if (spotRadius && options.get('maxSpotColor')) {
            x = xvalues[$.inArray(this.maxyorg, yvalues)];
            target.drawCircle(canvasLeft + Math.round((x - this.minx) * (canvasWidth / rangex)),
              canvasTop + Math.round(canvasHeight - (canvasHeight * ((this.maxyorg - this.miny) / rangey))),
              spotRadius, undefined,
crowbar_framework/vendor/assets/javascripts/jquery/sparkline.js on lines 1678..1684

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 137.

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

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

Method ha_config_check has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

      def ha_config_check
        prop = Proposal.where(barclamp: "cinder").first

        unless prop.nil?
          backends = prop["attributes"]["cinder"]["volumes"].select do |volume|
Severity: Minor
Found in crowbar_framework/app/models/api/crowbar.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

Method adminrepocheck has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

      def adminrepocheck
        upgrade_status = ::Crowbar::UpgradeStatus.new
        upgrade_status.start_step(:repocheck_crowbar)
        zypper_stream = Hash.from_xml(
          `sudo /usr/bin/zypper-retry --xmlout products`
Severity: Minor
Found in crowbar_framework/app/models/api/upgrade.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

Consider simplifying this complex logical expression.
Open

            if ( event.pageX == null && original.clientX != null ) {
                eventDoc = event.target.ownerDocument || document;
                doc = eventDoc.documentElement;
                body = eventDoc.body;

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

Function uploadSingle has 125 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        uploadSingle: function (i, files, allFiles) {
            var self = this, total = self.getFileStack().length, formdata = new FormData(), outData,
                previewId = self.previewInitId + "-" + i, $thumb, chkComplete, $btnUpload, $btnDelete,
                hasPostData = self.filestack.length > 0 || !$.isEmptyObject(self.uploadExtraData),
                fnBefore, fnSuccess, fnComplete, fnError, updateUploadLog, params = {id: previewId, index: i};
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/bootstrap/fileinput.js - About 5 hrs to fix

Method deallocate_ip_by_type has a Cognitive Complexity of 33 (exceeds 5 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: Minor
Found in crowbar_framework/app/models/network_service.rb - About 4 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

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

        if ($.isArray(options.get('colorMap'))) {
          this.colorMapByIndex = options.get('colorMap');
          this.colorMapByValue = null;
        } else {
          this.colorMapByIndex = null;
crowbar_framework/vendor/assets/javascripts/jquery/sparkline.js on lines 1974..1983

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 133.

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

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

        if ($.isArray(options.get('colorMap'))) {
          this.colorMapByIndex = options.get('colorMap');
          this.colorMapByValue = null;
        } else {
          this.colorMapByIndex = null;
crowbar_framework/vendor/assets/javascripts/jquery/sparkline.js on lines 1832..1841

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 133.

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 init has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      init: function (el, values, options, width, height) {
        var barWidth = parseInt(options.get('barWidth'), 10),
          barSpacing = parseInt(options.get('barSpacing'), 10),
          chartRangeMin = options.get('chartRangeMin'),
          chartRangeMax = options.get('chartRangeMax'),
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/sparkline.js - About 4 hrs to fix

File default.rb has 367 lines of code (exceeds 250 allowed). Consider refactoring.
Open

include_recipe "utils"
require "ipaddr"

package "bind9" do
  case node[:platform_family]
Severity: Minor
Found in chef/cookbooks/bind9/recipes/default.rb - About 4 hrs to fix

Method get_node_and_network has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def get_node_and_network(node_name)
    network = {}
    @network = []
    @node = Node.find_by_name(node_name) if @node.nil?
    if @node
Severity: Minor
Found in crowbar_framework/app/controllers/nodes_controller.rb - About 4 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 __module6__ has 115 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

File upgrade_status_spec.rb has 357 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "spec_helper"

describe Crowbar::UpgradeStatus do
  let(:new_status) { subject.class.new }

Severity: Minor
Found in crowbar_framework/spec/lib/crowbar/upgrade_status_spec.rb - About 4 hrs to fix
Severity
Category
Status
Source
Language