fgrehm/vagrant-lxc

View on GitHub

Showing 30 of 30 total issues

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

    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 redirect_port has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def redirect_port(host_ip, host_port, guest_ip, guest_port)
                if redir_version >= 3
                  params = %W( -n #{host_ip}:#{host_port} #{guest_ip}:#{guest_port} )
                else
                  params = %W( --lport=#{host_port} --caddr=#{guest_ip} --cport=#{guest_port} )
      Severity: Minor
      Found in lib/vagrant-lxc/action/forward_ports.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 call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def call(env)
                @env = env
                driver = env[:machine].provider.driver
                config = env[:machine].provider_config
      
      
      Severity: Minor
      Found in lib/vagrant-lxc/action/boot.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 finalize! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def finalize!
              @container_name = nil if @container_name == UNSET_VALUE
              @backingstore = nil if @backingstore == UNSET_VALUE
              @existing_container_name = nil if @existing_container_name == UNSET_VALUE
              @tmpfs_mount_size = '2G' if @tmpfs_mount_size == UNSET_VALUE
      Severity: Minor
      Found in lib/vagrant-lxc/config.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 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

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

              def call(env)
                @env = env
      
                # Get the ports we're forwarding
                env[:forwarded_ports] = compile_forwarded_ports(env[:machine].config)
      Severity: Minor
      Found in lib/vagrant-lxc/action/forward_ports.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 validate_box has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def validate_box
                unless SUPPORTED_VERSIONS.include? box_version
                  raise Errors::IncompatibleBox.new name: @box.name,
                                                    found: box_version,
                                                    supported: SUPPORTED_VERSIONS.join(', ')
      Severity: Minor
      Found in lib/vagrant-lxc/action/handle_box_metadata.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