crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

Function anonymous has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {

  var $0 = $$.length - 1;
  switch (yystate) {
  case 1: return new yy.ProgramNode($$[$0-1]); 
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/misc/handlebars.js - About 3 hrs to fix

Method validate_hook has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

   def validate_hook(value, rule, path, errors)
      case rule.name
      when "DiskURL"
         begin
           arr = URI.split(value)
Severity: Major
Found in crowbar_framework/app/models/crowbar_validator.rb - About 3 hrs to fix

File base.rb has 313 lines of code (exceeds 250 allowed). Consider refactoring.
Open

return if node[:platform_family] == "windows"

###
# If anything has to be applied to a Windows node, it has to be done
# before the return above, anything from this point forward being applied
Severity: Minor
Found in chef/cookbooks/provisioner/recipes/base.rb - About 3 hrs to fix

File upgrade_status.rb has 312 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yaml"
require "pathname"

require_relative "lock"
require_relative "lock/local_blocking"
Severity: Minor
Found in crowbar_framework/lib/crowbar/upgrade_status.rb - About 3 hrs to fix

File javascript.js has 311 lines of code (exceeds 250 allowed). Consider refactoring.
Open

CodeMirror.defineMode("javascript", function(config, parserConfig) {
  var indentUnit = config.indentUnit;
  var jsonMode = parserConfig.json;

  // Tokenizer
Severity: Minor
Found in crowbar_framework/vendor/assets/javascripts/codemirror/javascript.js - About 3 hrs to fix

File prepare-upgrade-scripts.rb has 311 lines of code (exceeds 250 allowed). Consider refactoring.
Open

arch = node[:kernel][:machine]
roles = node["run_list_map"].keys

target_platform, target_platform_version = node[:target_platform].split("-")
new_repos = Provisioner::Repositories.get_repos(
Severity: Minor
Found in chef/cookbooks/crowbar/recipes/prepare-upgrade-scripts.rb - About 3 hrs to fix

Function _refresh has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _refresh: function() {
        var maxHeight,
            options = this.options,
            heightStyle = options.heightStyle,
            parent = this.element.parent(),
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 3 hrs to fix

Method parse_address has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def self.parse_address(a)
      addr,subnet = a.split("/",2)
      unless addr.kind_of?(String) && (addr =~ /^[0-9a-f:]+$/) &&
          (! addr.include?(":::")) && addr.length >= 2
        raise ArgumentError.new("#{addr} is not a valid IP6 address")
Severity: Minor
Found in chef/cookbooks/barclamp/libraries/ip.rb - About 3 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 parallel_upgrade_compute_nodes has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

      def parallel_upgrade_compute_nodes(compute_nodes, controller = nil)
        Rails.logger.info("Entering parallel upgrade of compute nodes, #{upgrade_mode} mode")
        Rails.logger.info("Nodes for upgrade: #{compute_nodes.map(&:name).join(', ')}")
        save_nodes_state(compute_nodes, "compute", "upgrading")
        save_node_action("upgrading the packages")
Severity: Minor
Found in crowbar_framework/app/models/api/upgrade.rb - About 3 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 get_proposals_from_barclamps has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def get_proposals_from_barclamps(barclamps)
    modules = {}
    active = RoleObject.active
    barclamps.each do |name, details|
      modules[name] = {
Severity: Minor
Found in crowbar_framework/app/controllers/barclamp_controller.rb - About 3 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 change has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        change: function (e) {
            var self = this, $el = self.$element;
            if (!self.isUploadable && isEmpty($el.val()) && self.fileInputCleared) { // IE 11 fix
                self.fileInputCleared = false;
                return;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/bootstrap/fileinput.js - About 3 hrs to fix

File ucs_controller.rb has 308 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "net/http"
require "uri"
require "rexml/document"
require "cgi"

Severity: Minor
Found in crowbar_framework/app/controllers/ucs_controller.rb - About 3 hrs to fix

Function Animation has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Animation( elem, properties, options ) {
    var result,
        stopped,
        index = 0,
        length = animationPrefilters.length,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 3 hrs to fix

Function _doKeyDown has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _doKeyDown: function(event) {
        var onSelect, dateStr, sel,
            inst = $.datepicker._getInst(event.target),
            handled = true,
            isRTL = inst.dpDiv.is(".ui-datepicker-rtl");
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/ui.js - About 3 hrs to fix

Method openstackbackup has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def openstackbackup
        crowbar_lib_dir = "/var/lib/crowbar"
        dump_path = "#{crowbar_lib_dir}/backup/8-to-9-openstack_dump.sql.gz"
        if File.exist?(dump_path)
          Rails.logger.warn("OpenStack backup already exists. Skipping...")
Severity: Major
Found in crowbar_framework/app/models/api/upgrade.rb - About 3 hrs to fix

Method node_detail_hardware has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def node_detail_hardware
    @node_detail_hardware ||= begin
      raid_data = if bios_raid_options[:show].include?(:raid)
        content_tag(
          :em,
Severity: Major
Found in crowbar_framework/app/helpers/nodes_helper.rb - About 3 hrs to fix

Function initInnerToggle has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    initInnerToggle: function (el, options) {

      var attachment = (el.css('direction') === 'rtl') ? 'left' : 'right'
        , elWidth = el[options.widthMethod]()
        , wrapperCSS = {

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

        def load(group, barclamp, instance = nil)
          # If no instance is specified, see if this node uses an instance of
          # this barclamp and use it
          if instance.nil? && @node[barclamp] && @node[barclamp][:config]
            instance = @node[barclamp][:config][:environment]
Severity: Minor
Found in chef/cookbooks/barclamp/libraries/barclamp_library.rb - About 3 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 relevant_attributes_changed_if_roles? has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def relevant_attributes_changed_if_roles?(node, old_role, new_role, ignore_attr, only_for_roles)
    # if only_for_roles has some sole
    unless only_for_roles.nil? || only_for_roles.empty?
      # get roles for this node
      roles_in_new = new_role.elements.keys.select { |r| new_role.elements[r].include?(node) }
Severity: Minor
Found in crowbar_framework/app/models/service_object.rb - About 3 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 validate_proposal_constraints has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_proposal_constraints(proposal)
    elements = proposal["deployment"][@bc_name]["elements"]
    nodes_is_admin = {}

    role_constraints.keys.each do |role|
Severity: Minor
Found in crowbar_framework/app/models/service_object.rb - About 3 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

Severity
Category
Status
Source
Language