BaxterStockman/vagrant-ansible_auto

View on GitHub

Showing 14 of 17 total issues

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

      def finalize!
        super
        @inventory.groups                   = @groups                             unless @groups                          == UNSET_VALUE
        @inventory.vars                     = @vars                               unless @vars                            == UNSET_VALUE
        @inventory.children                 = @children                           unless @children                        == UNSET_VALUE
Severity: Minor
Found in lib/vagrant/ansible_auto/config.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 with_default_gateway_addresses has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

              def with_default_gateway_addresses(machine)
                return enum_for(__method__, machine) unless block_given?

                machine.communicate.execute('ip route show', error_check: false) do |type, data|
                  if type == :stdout
Severity: Minor
Found in lib/vagrant/ansible_auto/cap/guest/posix/gateway_addresses.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

Class Inventory has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Inventory
      include VagrantPlugins::AnsibleAuto::Util::Config

      UNNAMED_GROUP = '_'.freeze

Severity: Minor
Found in lib/vagrant/ansible_auto/inventory.rb - About 2 hrs to fix

    Method with_candidate_addresses has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

                  def with_candidate_addresses(machine)
                    return enum_for(__method__, machine) unless block_given?
    
                    seen_candidates = Set.new
                    yield_unseen_candidate = lambda do |host_and_port|
    Severity: Minor
    Found in lib/vagrant/ansible_auto/cap/guest/posix/ssh_server_address.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

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

          def groups=(new_groups)
            @groups = nil
    
            new_groups.each do |group_heading, entries|
              group, type = parse_group_heading(group_heading)
    Severity: Minor
    Found in lib/vagrant/ansible_auto/inventory.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 provision has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

          def provision
            @config = @__ansible_config.merge(config)
    
            return super unless machine.guest.capability?(:ssh_server_address)
    
    
    Severity: Minor
    Found in lib/vagrant/ansible_auto/provisioner.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 with_candidate_addresses has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                  def with_candidate_addresses(machine)
                    return enum_for(__method__, machine) unless block_given?
    
                    seen_candidates = Set.new
                    yield_unseen_candidate = lambda do |host_and_port|
    Severity: Minor
    Found in lib/vagrant/ansible_auto/cap/guest/posix/ssh_server_address.rb - About 1 hr to fix

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

                    def with_open_ports(machine, target_machine = nil)
                      return enum_for(__method__, machine, target_machine) unless block_given?
      
                      return unless machine.guest.capability?(:port_open?)
      
      
      Severity: Minor
      Found in lib/vagrant/ansible_auto/cap/guest/posix/ssh_server_address.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 validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def validate(machine)
              super
      
              errors = _detected_errors + @__errors
      
      
      Severity: Minor
      Found in lib/vagrant/ansible_auto/config.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 fetch_public_key has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

                    def fetch_public_key(machine, path)
                      return unless machine.guest.capability?(:executable_installed?) \
                        && machine.guest.capability(:executable_installed?, 'ssh-keygen')
      
                      public_key = ''
      Severity: Minor
      Found in lib/vagrant/ansible_auto/cap/guest/posix/public_key.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 merge! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def merge!(other)
                if block_given?
                  other.each do |key, value|
                    convert_key(key).tap do |ckey|
                      self[ckey] = if key? ckey
      Severity: Minor
      Found in lib/vagrant/ansible_auto/util/hash_with_indifferent_access.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 parse_superclass has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def parse_superclass(superclass)
              return nil unless superclass
      
              case superclass.type
              when :call, :command_call
      Severity: Minor
      Found in yard/extensions.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 add_host has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_host(host, hostvars = nil)
              hosts.add case host
                        when Host
                          host.tap { |h| h.hostvars = hostvars unless hostvars.nil? }
                        when String, Symbol
      Severity: Minor
      Found in lib/vagrant/ansible_auto/inventory.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 with_ini_lines_groups has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def with_ini_lines_groups
              return enum_for(__method__) unless block_given?
      
              to_h.tap { |h| h.delete(UNNAMED_GROUP) }.sort.each do |group, entries|
                yield "[#{group}]"
      Severity: Minor
      Found in lib/vagrant/ansible_auto/inventory.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