crowbar/crowbar-core

View on GitHub

Showing 1,006 of 6,062 total issues

Method restore has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def restore
        cleanup if self.class.restore_steps_path.exist?

        # restrict dns-server to not answer requests from other nodes to
        # avoid wrong results to clients.
Severity: Minor
Found in crowbar_framework/lib/crowbar/backup/restore.rb - About 25 mins 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 reboot_done? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def reboot_done?(host_or_ip, reboot_requesttime, options = {})
    # if reboot_requesttime is zero, we don't know when the reboot was requested.
    # in this case return true so the process can continue
    if reboot_requesttime > 0
      boottime = ssh_cmd_get_boottime(host_or_ip, options)
Severity: Minor
Found in crowbar_framework/lib/remote_node.rb - About 25 mins 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 verify_bags has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def verify_bags(base_dir)
  err = false
  Dir.chdir(base_dir) { |d|
    Dir["*/*.json"].each { |bag|
        schema = find_schema_for_file(bag)
Severity: Minor
Found in bin/validate_bags.rb - About 25 mins 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 values has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def values
      @timeouts_config = begin
        YAML.load_file("/etc/crowbar/upgrade_timeouts.yml")
      rescue
        Rails.logger.debug(
Severity: Minor
Found in crowbar_framework/lib/crowbar/upgrade_timeouts.rb - About 25 mins 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 parse_extra_opt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def parse_extra_opt(opt, arg)
  found = false
  @options.each do |x|
    next unless x[0].include? opt
    x[2].call(opt, arg)
Severity: Minor
Found in bin/barclamp_lib.rb - About 25 mins 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 racy_local_executor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def racy_local_executor(start_delay, end_delay)
    lambda do |node, cmd, shell|
      # Make the critical region inside the flock much longer.
      # Note that the command to be run has already been logged at this point,
      # so the modifications won't show up in log/test.log.
Severity: Minor
Found in crowbar_framework/spec/lib/crowbar/lock/shared_non_blocking_spec.rb - About 25 mins 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