Parallels/vagrant-parallels

View on GitHub

Showing 82 of 82 total issues

Function Modernizr has 594 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.Modernizr = (function( window, document, undefined ) {

    var version = '2.6.1',

    Modernizr = {},
Severity: Major
Found in website/docs/source/javascripts/modernizr.js - About 2 days to fix

    Function Modernizr has a Cognitive Complexity of 115 (exceeds 5 allowed). Consider refactoring.
    Open

    window.Modernizr = (function( window, document, undefined ) {
    
        var version = '2.6.1',
    
        Modernizr = {},
    Severity: Minor
    Found in website/docs/source/javascripts/modernizr.js - About 2 days 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

    File modernizr.js has 596 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * Modernizr v2.6.1
     * www.modernizr.com
     *
     * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
    Severity: Major
    Found in website/docs/source/javascripts/modernizr.js - About 1 day to fix

      File base.rb has 518 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'log4r'
      require 'nokogiri'
      
      require 'vagrant/util/busy'
      require 'vagrant/util/network_ip'
      Severity: Major
      Found in lib/vagrant-parallels/driver/base.rb - About 1 day to fix

        Class Base has 57 methods (exceeds 20 allowed). Consider refactoring.
        Open

              class Base
                # Include this so we can use `Subprocess` more easily.
                include Vagrant::Util::Retryable
                include Vagrant::Util::NetworkIP
        
        
        Severity: Major
        Found in lib/vagrant-parallels/driver/base.rb - About 1 day to fix

          Method detect_owner_group_ids has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
          Open

                  def detect_owner_group_ids(machine, guest_path, mount_options, options)
                    mount_uid = find_mount_options_id("uid", mount_options)
                    mount_gid = find_mount_options_id("gid", mount_options)
          
                    if mount_uid.nil?
          Severity: Minor
          Found in lib/vagrant-parallels/util/unix_mount_helpers.rb - About 6 hrs 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

          File action.rb has 347 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'vagrant/action/builder'
          
          module VagrantPlugins
            module Parallels
              module Action
          Severity: Minor
          Found in lib/vagrant-parallels/action.rb - About 4 hrs to fix

            File network.rb has 322 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'ipaddr'
            require 'set'
            require 'log4r'
            
            require 'vagrant/util/scoped_hash_override'
            Severity: Minor
            Found in lib/vagrant-parallels/action/network.rb - About 3 hrs to fix

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

                      def call(env)
                        @env = env
              
                        # Get the list of network adapters from the configuration
                        network_adapters_config = env[:machine].provider_config.network_adapters.dup
              Severity: Minor
              Found in lib/vagrant-parallels/action/network.rb - About 3 hrs 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 bridged_adapter has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                      def bridged_adapter(config)
                        # Find the bridged interfaces that are available
                        bridgedifs = @env[:machine].provider.driver.read_bridged_interfaces
                        bridgedifs.delete_if { |interface| interface[:status] == 'Down' }
              
              
              Severity: Minor
              Found in lib/vagrant-parallels/action/network.rb - About 3 hrs 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 74 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def call(env)
                        @env = env
              
                        # Get the list of network adapters from the configuration
                        network_adapters_config = env[:machine].provider_config.network_adapters.dup
              Severity: Major
              Found in lib/vagrant-parallels/action/network.rb - About 2 hrs to fix

                Method hostonly_config has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                        def hostonly_config(options)
                          options = {
                            auto_config: true,
                            mac: nil,
                            name: nil,
                Severity: Minor
                Found in lib/vagrant-parallels/action/network.rb - About 2 hrs 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

                          machine.communicate.tap do |comm|
                            arch = ''
                            comm.execute("uname -p") { |type, data| arch << data if type == :stdout }
                
                            tools_iso_path = File.expand_path(
                lib/vagrant-parallels/guest_cap/linux/install_parallels_tools.rb on lines 12..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 93.

                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

                            machine.communicate.tap do |comm|
                              arch = ''
                              comm.execute("uname -p") { |type, data| arch << data if type == :stdout }
                
                              tools_iso_path = File.expand_path(
                lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb on lines 7..31

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

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

                        def detect_owner_group_ids(machine, guest_path, mount_options, options)
                          mount_uid = find_mount_options_id("uid", mount_options)
                          mount_gid = find_mount_options_id("gid", mount_options)
                
                          if mount_uid.nil?
                Severity: Major
                Found in lib/vagrant-parallels/util/unix_mount_helpers.rb - About 2 hrs to fix

                  Method hostonly_config has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def hostonly_config(options)
                            options = {
                              auto_config: true,
                              mac: nil,
                              name: nil,
                  Severity: Major
                  Found in lib/vagrant-parallels/action/network.rb - About 2 hrs to fix

                    Method bridged_adapter has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def bridged_adapter(config)
                              # Find the bridged interfaces that are available
                              bridgedifs = @env[:machine].provider.driver.read_bridged_interfaces
                              bridgedifs.delete_if { |interface| interface[:status] == 'Down' }
                    
                    
                    Severity: Major
                    Found in lib/vagrant-parallels/action/network.rb - About 2 hrs to fix

                      Method action_start has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def self.action_start
                              Vagrant::Action::Builder.new.tap do |b|
                                b.use BoxCheckOutdated
                                b.use Call, IsState, :running do |env1, b1|
                                  # If the VM is running, run the necessary provisioners
                      Severity: Minor
                      Found in lib/vagrant-parallels/action.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 a Cognitive Complexity of 14 (exceeds 5 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

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

                              def hostonly_find_matching_network(config)
                                this_netaddr = IPAddr.new("#{config[:ip]}/#{config[:netmask]}")
                      
                                @env[:machine].provider.driver.read_host_only_interfaces.each do |interface|
                                  return interface if config[:name] && config[:name] == interface[:name]
                      Severity: Minor
                      Found in lib/vagrant-parallels/action/network.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

                      Severity
                      Category
                      Status
                      Source
                      Language