Parallels/vagrant-parallels

View on GitHub

Showing 82 of 82 total issues

Method install_parallels_tools has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.install_parallels_tools(machine)
          machine.communicate.tap do |comm|
            # Get the host arch. This is safe even if an older x86-only Vagrant version is used.
            arch = `arch -64 uname -m`.chomp

Severity: Minor
Found in lib/vagrant-parallels/guest_cap/windows/install_parallels_tools.rb - About 1 hr to fix

    Method call has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def call(env)
              options = {}
    
              # Disable requiring password for register and clone actions [GH-67].
              acts = ['clone-vm']
    Severity: Minor
    Found in lib/vagrant-parallels/action/import.rb - About 1 hr to fix

      Function webforms has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function webforms() {
              /*>>input*/
              // Run through HTML5's new input attributes to see if the UA understands any.
              // We're using f which is the <input> element created early on
              // Mike Taylr has created a comprehensive resource for testing these attributes
      Severity: Minor
      Found in website/docs/source/javascripts/modernizr.js - About 1 hr to fix

        Method convert_to_full has 33 lines of code (exceeds 25 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 1 hr to fix

          Similar blocks of code found in 2 locations. 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: Major
          Found in lib/vagrant-parallels/action.rb and 1 other location - About 1 hr to fix
          lib/vagrant-parallels/action.rb on lines 251..266

          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 57.

          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

          Similar blocks of code found in 2 locations. 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: Major
          Found in lib/vagrant-parallels/action.rb and 1 other location - About 1 hr to fix
          lib/vagrant-parallels/action.rb on lines 229..244

          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 57.

          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 read_shared_interface has 32 lines of code (exceeds 25 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 1 hr to fix

            Method enable_adapters has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                    def enable_adapters(adapters)
                      # Get adapters which have already configured for this VM
                      # Such adapters will be just overridden
                      existing_adapters = read_settings.fetch('Hardware', {}).keys.select do |name|
                        name.start_with? 'net'
            Severity: Minor
            Found in lib/vagrant-parallels/driver/base.rb - About 1 hr 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_guest_tools_iso_path has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                    def read_guest_tools_iso_path(guest_os, arch=nil)
                      guest_os = (guest_os + (['arm', 'arm64', 'aarch64'].include?(arch.to_s.strip) ? '_arm' : '')).to_sym
                      iso_name = {
                        linux: 'prl-tools-lin.iso',
                        linux_arm: 'prl-tools-lin-arm.iso',
            Severity: Minor
            Found in lib/vagrant-parallels/driver/base.rb - About 1 hr 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 compile_forwarded_ports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                    def compile_forwarded_ports(config)
                      mappings = {}
            
                      config.vm.networks.each do |type, options|
                        next unless type == :forwarded_port
            Severity: Minor
            Found in lib/vagrant-parallels/util/compile_forwarded_ports.rb - About 1 hr 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 31 lines of code (exceeds 25 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 1 hr to fix

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

                  tests['smil'] = function() {
                      return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
                  };
              Severity: Major
              Found in website/docs/source/javascripts/modernizr.js and 1 other location - About 1 hr to fix
              website/docs/source/javascripts/modernizr.js on lines 833..835

              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 59.

              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

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

                  tests['svgclippaths'] = function() {
                      return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
                  };
              Severity: Major
              Found in website/docs/source/javascripts/modernizr.js and 1 other location - About 1 hr to fix
              website/docs/source/javascripts/modernizr.js on lines 824..826

              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 59.

              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 forward_ports has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def forward_ports
                        all_rules = @env[:machine].provider.driver.read_forwarded_ports(true)
                        names_in_use = all_rules.collect { |r| r[:name] }
                        ports = []
              
              
              Severity: Minor
              Found in lib/vagrant-parallels/action/forward_ports.rb - About 1 hr to fix

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

                    tests['localstorage'] = function() {
                        try {
                            localStorage.setItem(mod, mod);
                            localStorage.removeItem(mod);
                            return true;
                Severity: Major
                Found in website/docs/source/javascripts/modernizr.js and 1 other location - About 1 hr to fix
                website/docs/source/javascripts/modernizr.js on lines 789..797

                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 58.

                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

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

                    tests['sessionstorage'] = function() {
                        try {
                            sessionStorage.setItem(mod, mod);
                            sessionStorage.removeItem(mod);
                            return true;
                Severity: Major
                Found in website/docs/source/javascripts/modernizr.js and 1 other location - About 1 hr to fix
                website/docs/source/javascripts/modernizr.js on lines 779..787

                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 58.

                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 call has 28 lines of code (exceeds 25 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 1 hr to fix

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

                          def call(env)
                            options = {}
                  
                            # Disable requiring password for register and clone actions [GH-67].
                            acts = ['clone-vm']
                  Severity: Minor
                  Found in lib/vagrant-parallels/action/import.rb - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def call(env)
                            customizations = []
                            env[:machine].provider_config.customizations.each do |event, command|
                              if event == @event
                                customizations << command
                  Severity: Minor
                  Found in lib/vagrant-parallels/action/customize.rb - About 1 hr 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_destroy has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def self.action_destroy
                          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 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language