fgrehm/vagrant-lxc

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

Summary

Maintainability
C
7 hrs
Test Coverage

Class Driver has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Driver
      # This is raised if the container can't be found when initializing it with
      # a name.
      class ContainerNotFound < StandardError; end

Severity: Minor
Found in lib/vagrant-lxc/driver.rb - About 3 hrs to fix

    Method configure_private_network has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def configure_private_network(bridge_name, bridge_ip, container_name, address_type, ip)
            @logger.info "Configuring network interface for #{container_name} using #{ip} and bridge #{bridge_name}"
            if ip
              ip += '/24'
            end
    Severity: Minor
    Found in lib/vagrant-lxc/driver.rb - About 1 hr to fix

      Method create has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def create(name, backingstore, backingstore_options, template_path, config_file, template_options = {})
      Severity: Minor
      Found in lib/vagrant-lxc/driver.rb - About 45 mins to fix

        Method configure_private_network has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def configure_private_network(bridge_name, bridge_ip, container_name, address_type, ip)
                @logger.info "Configuring network interface for #{container_name} using #{ip} and bridge #{bridge_name}"
                if ip
                  ip += '/24'
                end
        Severity: Minor
        Found in lib/vagrant-lxc/driver.rb - About 45 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 configure_private_network has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def configure_private_network(bridge_name, bridge_ip, container_name, address_type, ip)
        Severity: Minor
        Found in lib/vagrant-lxc/driver.rb - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status