Parallels/vagrant-parallels

View on GitHub

Showing 62 of 82 total issues

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

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

          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

            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

                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

                    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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language