crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

Function parse has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  parse: function parse(input) {
      var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
      this.lexer.setInput(input);
      this.lexer.yy = this.yy;
      this.yy.lexer = this.lexer;
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/misc/handlebars.js - About 4 hrs to fix

Method reset_proposal has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def reset_proposal(inst, bc = @bc_name)
    ::Proposal.find_by(
      barclamp: bc,
      name: inst
    ).tap do |proposal|
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 upgradable_elements_of_proposals has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

      def upgradable_elements_of_proposals(proposals)
        to_upgrade = []

        # First find out the nodes with compute role, for later checks
        compute_nodes = {}
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 nodes has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

      def nodes(component = "all")
        status = ::Crowbar::UpgradeStatus.new

        if component == "postpone"
          status.postpone
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 process_queue has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def process_queue
      logger.debug("process queue: enter")
      loop_again = true
      while loop_again
        loop_again = false
Severity: Minor
Found in crowbar_framework/lib/crowbar/deployment_queue.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 nodes has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def nodes
    if params[:component]
      component = params[:component]
      upgrade_status = ::Crowbar::UpgradeStatus.new
      substep = upgrade_status.current_substep
Severity: Major
Found in crowbar_framework/app/controllers/api/upgrade_controller.rb - About 3 hrs to fix

Class Restore has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Restore
      attr_accessor :backup, :version

      def initialize(backup)
        @backup = backup
Severity: Minor
Found in crowbar_framework/lib/crowbar/backup/restore.rb - About 3 hrs to fix

File barclamp_library.rb has 324 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative "conduit_resolver.rb"
require_relative "ssh_key_parser.rb"

module BarclampLibrary
  class Barclamp
Severity: Minor
Found in chef/cookbooks/barclamp/libraries/barclamp_library.rb - About 3 hrs to fix

Method allocate_ip_by_type has 94 lines of code (exceeds 25 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: Major
Found in crowbar_framework/app/models/network_service.rb - About 3 hrs to fix

Method non_disruptive_upgrade_compute_nodes has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

      def non_disruptive_upgrade_compute_nodes(names)
        compute_nodes = names.map do |name|
          ::Node.find_node_by_name_or_alias(name)
        end

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

  def bulk
    @report = {
      success: [],
      failed: [],
      duplicate_public: false,
Severity: Major
Found in crowbar_framework/app/controllers/nodes_controller.rb - About 3 hrs to fix

Method nodes has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def nodes(component = "all")
        status = ::Crowbar::UpgradeStatus.new

        if component == "postpone"
          status.postpone
Severity: Major
Found in crowbar_framework/app/models/api/upgrade.rb - About 3 hrs to fix

Method transition has 91 lines of code (exceeds 25 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: Major
Found in crowbar_framework/app/models/crowbar_service.rb - About 3 hrs to fix

Method checks has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

        {}.tap do |ret|
Severity: Major
Found in crowbar_framework/app/models/api/upgrade.rb - About 3 hrs to fix

Method ha_config_check has 90 lines of code (exceeds 25 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: Major
Found in crowbar_framework/app/models/api/crowbar.rb - About 3 hrs to fix

Method apply_role_pre_chef_call has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def apply_role_pre_chef_call(old_role, role, all_nodes)
    Rails.logger.debug("DNS apply_role_pre_chef_call: entering #{all_nodes.inspect}")
    return if all_nodes.empty?

    tnodes = role.override_attributes["dns"]["elements"]["dns-server"]
Severity: Minor
Found in crowbar_framework/app/models/dns_service.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 default_loader has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def default_loader
    f = File.join "db","node_description.yml"
    begin
      if File.exist? f
        default = {}
Severity: Minor
Found in crowbar_framework/app/models/node.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_after_save has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_proposal_after_save proposal
    super

    errors = []

Severity: Minor
Found in crowbar_framework/app/models/nfs_client_service.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 split_key_line has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def split_key_line(line)
      line = line.clone
      res = []
      field = ""
      escape = false # was last char a backslash (so current one is escaped)?
Severity: Minor
Found in crowbar_framework/lib/crowbar/ssh_key_parser.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 trigger has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    trigger: function( event, data, elem, onlyHandlers ) {
        var handle, ontype, cur,
            bubbleType, special, tmp, i,
            eventPath = [ elem || document ],
            type = hasOwn.call( event, "type" ) ? event.type : event,
Severity: Major
Found in crowbar_framework/vendor/assets/javascripts/jquery/jquery.js - About 3 hrs to fix
Severity
Category
Status
Source
Language