crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

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

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

File network_service.rb has 354 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class NetworkService < ServiceObject
  def initialize(thelogger = nil)
    super
    @bc_name = "network"
  end
Severity: Minor
Found in crowbar_framework/app/models/network_service.rb - About 4 hrs to fix

File repository.rb has 350 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Crowbar
  class Repository
    attr_reader :platform, :arch, :id, :config

    class << self
Severity: Minor
Found in crowbar_framework/lib/crowbar/repository.rb - About 4 hrs to fix

Function __module7__ has 109 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var __module7__ = (function(__dependency1__) {
  "use strict";
  var __exports__ = {};
  var Exception = __dependency1__;

Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/misc/handlebars.js - About 4 hrs to fix

Function uploadBatch has 109 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        uploadBatch: function () {
            var self = this, files = self.filestack, total = files.length, params = {},
                hasPostData = self.filestack.length > 0 || !$.isEmptyObject(self.uploadExtraData),
                setAllUploaded, fnBefore, fnSuccess, fnComplete, fnError;
            self.formdata = new FormData();
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/bootstrap/fileinput.js - About 4 hrs to fix

Function _create has 107 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _create: function() {

        var n, i, handle, axis, hname,
            that = this,
            o = this.options;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 4 hrs to fix

Method unique_device_for has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

  def unique_device_for(device)
    # check first if we have already a claimed disk which points to the same
    # device node. if so, use that as "unique device"
    already_claimed_name = self.unique_name_already_claimed_by(device)
    unless already_claimed_name.nil?
Severity: Minor
Found in crowbar_framework/app/models/node.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

Method load! has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

      def load!
        # reset other cached values
        @admin_ip = nil
        @web_port = nil

Severity: Minor
Found in crowbar_framework/lib/crowbar/repository.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 defaultPrefilter has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function defaultPrefilter( elem, props, opts ) {
    /* jshint validthis: true */
    var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
        anim = this,
        orig = {},
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 4 hrs to fix

Method switch has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  def switch
    @port_start = 1
    @sum = 0
    @vports = {}
    @groups = {}
Severity: Minor
Found in crowbar_framework/app/controllers/network_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

Method adminrepocheck has 102 lines of code (exceeds 25 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: Major
Found in crowbar_framework/app/models/api/upgrade.rb - About 4 hrs to fix
Severity
Category
Status
Source
Language