Parallels/vagrant-parallels

View on GitHub

Showing 62 of 82 total issues

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

        def call(env)
          # Get the forwarded ports used by other virtual machines and
          # consider those in use as well.
          env[:port_collision_extra_in_use] =
            env[:machine].provider.driver.read_used_ports
Severity: Minor
Found in lib/vagrant-parallels/action/prepare_forwarded_port_collision_params.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 action_ssh has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def self.action_ssh
        Vagrant::Action::Builder.new.tap do |b|
          b.use ConfigValidate
          b.use CheckSharedInterface
          b.use Call, IsState, :not_created do |env1, b1|
Severity: Minor
Found in lib/vagrant-parallels/action.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 action_halt has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def self.action_halt
        Vagrant::Action::Builder.new.tap do |b|
          b.use ConfigValidate
          b.use CheckSharedInterface
          b.use Call, IsState, :not_created do |env1, b1|
Severity: Minor
Found in lib/vagrant-parallels/action.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def initialize(id, host_port, guest_port, host_ip, guest_ip, **options)
Severity: Minor
Found in lib/vagrant-parallels/model/forwarded_port.rb - About 45 mins to fix

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

          def self.action_snapshot_restore
            Vagrant::Action::Builder.new.tap do |b|
              b.use Call, IsState, :not_created do |env1, b1|
                if env1[:result]
                  b1.use Message, I18n.t('vagrant.commands.common.vm_not_created')
    Severity: Minor
    Found in lib/vagrant-parallels/action.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

    Avoid deeply nested control flow statements.
    Open

                      ) { |type, data| output[type] << data if output[type] }
    Severity: Major
    Found in lib/vagrant-parallels/util/unix_mount_helpers.rb - About 45 mins to fix

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

              def recover(env)
                if env[:machine] && env[:machine].state.id != :not_created
                  return if env['vagrant.error'].is_a?(Vagrant::Errors::VagrantError)
                  return if env['vagrant_parallels.error'].is_a?(Errors::VagrantParallelsError)
      
      
      Severity: Minor
      Found in lib/vagrant-parallels/action/import.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

      Avoid deeply nested control flow statements.
      Open

                        mount_gid = output[:stdout].chomp if result == 0
      Severity: Major
      Found in lib/vagrant-parallels/util/unix_mount_helpers.rb - About 45 mins to fix

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

              def self.action_ssh_run
                Vagrant::Action::Builder.new.tap do |b|
                  b.use ConfigValidate
                  b.use CheckSharedInterface
                  b.use Call, IsState, :not_created do |env1, b1|
        Severity: Minor
        Found in lib/vagrant-parallels/action.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 call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def call(env)
                  @machine = env[:machine]
        
                  if !@machine.provider_config.check_guest_tools
                    @logger.info('Not checking Parallels Tools because of configuration')
        Severity: Minor
        Found in lib/vagrant-parallels/action/handle_guest_tools.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)
                  name = env[:machine].provider_config.name
        
                  # If we already set the name before, then don't do anything
                  sentinel = env[:machine].data_dir.join('action_set_name')
        Severity: Minor
        Found in lib/vagrant-parallels/action/set_name.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 convert_to_full has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def convert_to_full(env)
                  is_linked = false
        
                  @hdd_list.each do |hdd_dir|
                    disk_desc = File.join(hdd_dir, 'DiskDescriptor.xml')
        Severity: Minor
        Found in lib/vagrant-parallels/action/export.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 read_bridged_interfaces has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def read_bridged_interfaces
                  host_hw_info = read_host_info.fetch('Hardware info', {})
                  net_list = host_hw_info.select do |name, attrs|
                    # Get all network interfaces except 'vnicXXX'
                    attrs.fetch('type') == 'net' and name !~ /^(vnic(.+?))$/
        Severity: Minor
        Found in lib/vagrant-parallels/driver/base.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 ssh_ip has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def ssh_ip
                  5.times do
                    ip = read_guest_ip_dhcp
                    return ip unless ip.empty?
        
        
        Severity: Minor
        Found in lib/vagrant-parallels/driver/base.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 read_shared_interface has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def read_shared_interface
                  net_info = json do
                    execute_prlsrvctl('net', 'info', read_shared_network_id, '--json')
                  end
        
        
        Severity: Minor
        Found in lib/vagrant-parallels/driver/base.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)
                  files = {}
                  env['package.include'].each do |file|
                    source = Pathname.new(file)
        
        
        Severity: Minor
        Found in lib/vagrant-parallels/action/setup_package_files.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 read_host_only_interfaces has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def read_host_only_interfaces
                  net_list = read_virtual_networks
                  net_list.keep_if { |net| net['Type'] == 'host-only' }
        
                  hostonly_ifaces = []
        Severity: Minor
        Found in lib/vagrant-parallels/driver/base.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 mount_parallels_shared_folder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.mount_parallels_shared_folder(machine, name, guestpath, options)
                  machine.communicate.tap do |comm|
                    # clear prior symlink
                    if comm.test("test -L \"#{guestpath}\"", :sudo => true)
                      comm.sudo("rm \"#{guestpath}\"")
        Severity: Minor
        Found in lib/vagrant-parallels/guest_cap/darwin/mount_parallels_shared_folder.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 mount_parallels_shared_folder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.mount_parallels_shared_folder(machine, name, guestpath, options)
                  # Sanity check for mount options: we are not supporting
                  # VirtualBox-specific 'fmode' and 'dmode' options
                  if options[:mount_options]
                    invalid_opts = options[:mount_options].select do |opt|
        Severity: Minor
        Found in lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def initialize(uuid=nil)
                  # Setup the base
                  super(uuid)
        
                  @logger = Log4r::Logger.new('vagrant_parallels::driver::meta')
        Severity: Minor
        Found in lib/vagrant-parallels/driver/meta.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