fgrehm/vagrant-lxc

View on GitHub
lib/vagrant-lxc/driver/cli.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def create(template, backingstore, backingstore_options, config_file, template_opts = {})
          if config_file
            config_opts = ['-f', config_file]
          end

Severity: Minor
Found in lib/vagrant-lxc/driver/cli.rb - About 55 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 create has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def create(template, backingstore, backingstore_options, config_file, template_opts = {})
Severity: Minor
Found in lib/vagrant-lxc/driver/cli.rb - About 35 mins to fix

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

            def attach(*cmd)
              cmd = ['--'] + cmd
    
              if cmd.last.is_a?(Hash)
                opts       = cmd.pop
    Severity: Minor
    Found in lib/vagrant-lxc/driver/cli.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 transition_to has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def transition_to(target_state, tries = 30, timeout = 1, &block)
              raise TransitionBlockNotProvided unless block_given?
    
              yield self
    
    
    Severity: Minor
    Found in lib/vagrant-lxc/driver/cli.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

    There are no issues that match your filters.

    Category
    Status