Parallels/vagrant-parallels

View on GitHub

Showing 82 of 82 total issues

Function isEventSupported has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    isEventSupported = (function() {

      var TAGNAMES = {
        'select': 'input', 'change': 'input',
        'submit': 'form', 'reset': 'form',
Severity: Minor
Found in website/docs/source/javascripts/modernizr.js - About 1 hr to fix

    Function bind has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          Function.prototype.bind = function bind(that) {
    
            var target = this;
    
            if (typeof target != "function") {
    Severity: Minor
    Found in website/docs/source/javascripts/modernizr.js - About 1 hr to fix

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

              def clone_vm(src_name, options = {})
                dst_name = "vagrant_temp_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
      
                args = ['clone', src_name, '--name', dst_name]
                args.concat(['--dst', options[:dst]]) if options[:dst]
      Severity: Minor
      Found in lib/vagrant-parallels/driver/base.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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              def call(env)
                # If we don't have a box, nothing to do
                if !env[:machine].box
                  return @app.call(env)
                end
      Severity: Minor
      Found in lib/vagrant-parallels/action/box_register.rb and 1 other location - About 55 mins to fix
      lib/vagrant-parallels/action/box_unregister.rb on lines 14..32

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 45.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              def self.install_parallels_tools(machine)
                if ptiagent_usable?(machine)
                  machine.communicate.sudo('ptiagent-cmd --install')
                else
                  machine.communicate.tap do |comm|
      Severity: Minor
      Found in lib/vagrant-parallels/guest_cap/linux/install_parallels_tools.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 action_provision has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.action_provision
              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 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 action_sync_folders has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

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

            def enable(machine, folders, _opts)
              # short guestpaths first, so we don't step on ourselves
              folders = folders.sort_by do |id, data|
                if data[:guestpath]
                  data[:guestpath].length
      Severity: Minor
      Found in lib/vagrant-parallels/synced_folder.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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              def call(env)
                # If we don't have a box, nothing to do
                if !env[:machine].box
                  return @app.call(env)
                end
      Severity: Minor
      Found in lib/vagrant-parallels/action/box_unregister.rb and 1 other location - About 55 mins to fix
      lib/vagrant-parallels/action/box_register.rb on lines 16..36

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 45.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

            def prepare(machine, folders, _opts)
              # Setup shared folder definitions in the VM config.
              defs = []
              folders.each do |id, data|
                hostpath = data[:hostpath]
      Severity: Minor
      Found in lib/vagrant-parallels/synced_folder.rb and 1 other location - About 50 mins to fix
      lib/vagrant-parallels/synced_folder_macvm.rb on lines 11..26

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 42.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

            def prepare(machine, folders, _opts)
              # Setup shared folder definitions in the VM config.
              defs = []
              folders.each do |id, data|
                hostpath = data[:hostpath]
      Severity: Minor
      Found in lib/vagrant-parallels/synced_folder_macvm.rb and 1 other location - About 50 mins to fix
      lib/vagrant-parallels/synced_folder.rb on lines 13..28

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 42.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

            def finalize!
              if @check_guest_tools == UNSET_VALUE
                @check_guest_tools = true
              end
      
      
      Severity: Minor
      Found in lib/vagrant-parallels/config.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 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
            Severity
            Category
            Status
            Source
            Language