crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

File nodes_helper.rb has 523 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module NodesHelper
  def all_non_admin_nodes
    Node.find("NOT admin_node:true")
  end

Severity: Major
Found in crowbar_framework/app/helpers/nodes_helper.rb - About 1 day to fix

Method checks has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

      def checks
        upgrade_status = ::Crowbar::UpgradeStatus.new
        upgrade_status.start_step(:prechecks)

        {}.tap do |ret|
Severity: Minor
Found in crowbar_framework/app/models/api/upgrade.rb - About 1 day 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 setup_base_images.rb has 511 lines of code (exceeds 250 allowed). Consider refactoring.
Open

dirty = false

# Set up the OS images as well
# Common to all OSes
admin_net = Barclamp::Inventory.get_network_by_type(node, "admin")
Severity: Major
Found in chef/cookbooks/provisioner/recipes/setup_base_images.rb - About 1 day to fix

Method allocate_ip_by_type has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

  def allocate_ip_by_type(bc_instance, network, range, object, type, suggestion = nil)
    Rails.logger.debug("Network allocate ip for #{type}: entering #{object} #{network} #{range}")
    return [404, "No network specified"] if network.nil?
    return [404, "No range specified"] if range.nil?
    return [404, "No object specified"] if object.nil?
Severity: Minor
Found in crowbar_framework/app/models/network_service.rb - About 1 day 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 tooltip.js has 497 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* ========================================================================
 * Bootstrap: tooltip.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#tooltip
 * Inspired by the original jQuery.tipsy by Jason Frame
 * ========================================================================
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/bootstrap/tooltip.js - About 7 hrs to fix

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

    _create: function() {
        // Some browsers only repeat keydown events, not keypress events,
        // so we use the suppressKeyPress flag to determine if we've already
        // handled the keydown event. #7269
        // Unfortunately the code for & in keypress is the same as the up arrow,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 7 hrs to fix

Method transition has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

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

    # we need one state before "installed" (and after allocation) because we
    # need the node to have the admin network fully defined for
Severity: Minor
Found in crowbar_framework/app/models/network_service.rb - About 7 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 crowbar_spec.rb has 474 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "spec_helper"

describe Api::Crowbar do
  let(:pid) { rand(20000..30000) }
  let(:admin_node) { NodeObject.find_node_by_name("admin") }
Severity: Minor
Found in crowbar_framework/spec/models/api/crowbar_spec.rb - About 7 hrs to fix

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

unless node[:platform_family] == "suse"
  include_recipe "bluepill"
end

pkglist = ()
Severity: Minor
Found in chef/cookbooks/crowbar/recipes/default.rb - About 7 hrs to fix

Function insertNode has 172 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  NodeList.prototype.insertNode = function(role, id, alias, admin, platform, platform_version, cluster, remotes, initial) {
    var self = this;
    var $role = $(self.dataBag.roleTarget.format(role));

    if (self.constraints) {
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/nodeList.js - About 6 hrs to fix

Function registerEvents has 172 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  DynamicTable.prototype.registerEvents = function() {
    var self = this;

    self.root.find('[data-add]').live('click', function(event) {
      self.prepareJson();
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/dynamicTable.js - About 6 hrs to fix

Function _generateHTML has 169 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _generateHTML: function(inst) {
        var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
            controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
            monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
            selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 6 hrs to fix

Method transition has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

  def transition(inst, name, state)
    self.transition_save_node = false

    return [404, "No state specified"] if state.nil?
    # FIXME: validate state
Severity: Minor
Found in crowbar_framework/app/models/crowbar_service.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

File nodeList.js has 444 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

  function NodeList(el) {
    this.$root = $(el);
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/jquery/nodeList.js - About 6 hrs to fix

Method validate_hook has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

   def validate_hook(value, rule, path, errors)
      case rule.name
      when "DiskURL"
         begin
           arr = URI.split(value)
Severity: Minor
Found in crowbar_framework/app/models/crowbar_validator.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

File barclamp_lib.rb has 440 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "rubygems"
require "net/http"
require "net/http/digest_auth"
require "uri"
require "inifile"
Severity: Minor
Found in bin/barclamp_lib.rb - About 6 hrs to fix

Method services has 163 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def services
        return unless cluster_health_check
        return unless check_schema_migrations
        return unless check_product_version
        begin
Severity: Major
Found in crowbar_framework/app/models/api/upgrade.rb - About 6 hrs to fix

Class Repository has 47 methods (exceeds 20 allowed). Consider refactoring.
Open

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

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

Function install has 161 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function install(el, opts) {
            var css, themedCSS;
            var full = (el == window);
            var msg = (opts && opts.message !== undefined ? opts.message : undefined);
            opts = $.extend({}, $.blockUI.defaults, opts || {});
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/blockui.js - About 6 hrs to fix
Severity
Category
Status
Source
Language