jbussdieker/lxc_forge

View on GitHub

Showing 4 of 6 total issues

Method compress has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def compress
      Dir.chdir "/var/lib/lxc"
      count = 0
      IO.popen("tar -zcvf #{tmp_file} #{name} 2>&1") do |io|
        while !io.eof? do
Severity: Minor
Found in lib/lxc_forge/container.rb - About 35 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 uncompress has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def uncompress
      Dir.chdir "/var/lib/lxc"
      count = 0
      IO.popen("tar -zxvf #{tmp_file} 2>&1") do |io|
        while !io.eof? do
Severity: Minor
Found in lib/lxc_forge/container.rb - About 35 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 upload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def upload
      raise "Container doesn't exist" unless container.exists?

      if container.remote_exists?
        prompt_yes_no "Remote file already exists. Replace it (y/n) " unless options[:force]
Severity: Minor
Found in lib/lxc_forge/command.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 download has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def download
      raise "Remote file doesn't exist" unless container.remote_exists?

      if container.exists?
        prompt_yes_no "Container already exists. Replace it (y/n) " unless options[:force]
Severity: Minor
Found in lib/lxc_forge/command.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