puppetlabs/facter-ng

View on GitHub

Showing 65 of 200 total issues

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

          def read_facts(fact_name)
            build_disks_hash

            FILE_PATHS.each do |key, file|
              @fact_list[:disks].each do |disk, value|
Severity: Minor
Found in lib/resolvers/disk_resolver.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 bury has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def bury(*args)
      raise ArgumentError, '2 or more arguments required' if args.count < 2

      if args.count == 2
        self[args[0]] = args[1]
Severity: Minor
Found in lib/models/fact_collection.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 debug has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def debug(msg)
      return unless debugging_active?

      if msg.nil? || msg.empty?
        empty_message_error(msg)
Severity: Minor
Found in lib/framework/logging/logger.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 load_searched_facts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def load_searched_facts(collection, searched_facts, weight)
        searched_facts.each do |fact|
          parser = LegacyFacter::Util::Parser.parser_for(fact.file)
          next if parser.nil?

Severity: Minor
Found in lib/custom_facts/util/directory_loader.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 expand_command has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def expand_command(command)
          exe = nil
          args = nil

          if (match = (command.match(DOUBLE_QUOTED_COMMAND) || command.match(SINGLE_QUOTED_COMMAND)))
Severity: Minor
Found in lib/custom_facts/core/execution/posix.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 get_adapter_addresses has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def get_adapter_addresses(size_ptr, adapter_addresses, flags)
          error = nil
          3.times do
            error = NetworkingFFI::GetAdaptersAddresses(NetworkingFFI::AF_UNSPEC, flags,
                                                        FFI::Pointer::NULL, adapter_addresses, size_ptr)
Severity: Minor
Found in lib/resolvers/windows/networking_resolver.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 query_cudv has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

          def query_cudv(fact_name)
            @fact_list[:partitions] = {}

            odmquery = Facter::ODMQuery.new
            odmquery.equals('PdDvLn', 'logical_volume/lvsubclass/lvtype')
Severity: Minor
Found in lib/resolvers/aix/partitions.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 partitions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def partitions
        parts = Facter::Resolvers::Partitions.resolve(:partitions)
        mountpoints = Facter::Resolvers::Linux::Mountpoints.resolve(:mountpoints)
        return parts unless mountpoints

Severity: Minor
Found in lib/facts/linux/partitions.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 setcode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def setcode(string = nil, &block)
        if string
          @code = proc do
            output = Facter::Core::Execution.execute(string, on_fail: nil)
            if output.nil? || output.empty?
Severity: Minor
Found in lib/custom_facts/util/resolution.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 build_fact_list has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def build_fact_list(reg)
          reg.each do |name, _value|
            @fact_list[:edition_id] = reg[name] if name == 'EditionID'
            @fact_list[:installation_type] = reg[name] if name == 'InstallationType'
            @fact_list[:product_name] = reg[name] if name == 'ProductName'
Severity: Minor
Found in lib/resolvers/windows/product_release_resolver.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 retrieve_info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

          def retrieve_info(fact_name)
            ssh_dir = determine_ssh_dir
            return unless ssh_dir && File.directory?(ssh_dir)

            ssh_list = []
Severity: Minor
Found in lib/resolvers/windows/ssh.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 check_version_6 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def check_version_6(version, consumerrel)
        hash = {}
        hash['6.3'] = consumerrel ? '8.1' : '2012 R2'
        hash['6.2'] = consumerrel ? '8' : '2012'
        hash['6.1'] = consumerrel ? '7' : '2008 R2'
Severity: Minor
Found in lib/facts_utils/windows_release_finder.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 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(fact_name, fact_class, filter_tokens, user_query, type)
Severity: Minor
Found in lib/models/searched_fact.rb - About 35 mins to fix

    Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(name, value = '', type = :core, user_query = nil, filter_tokens = [])
    Severity: Minor
    Found in lib/models/resolved_fact.rb - About 35 mins to fix

      Method define_resolution has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def define_resolution(resolution_name, options = {}, &block)
              resolution_type = options.delete(:type) || :simple
      
              resolve = create_or_return_resolution(resolution_name, resolution_type)
      
      
      Severity: Minor
      Found in lib/custom_facts/util/fact.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 expand_command has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def expand_command(command)
                exe = nil
                args = nil
      
                if (match = command.match(DOUBLE_QUOTED_COMMAND))
      Severity: Minor
      Found in lib/custom_facts/core/execution/windows.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 cache_fact has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def cache_fact(fact)
            group_name = if fact.file
                           File.basename(fact.file)
                         else
                           @fact_groups.get_fact_group(fact.name)
      Severity: Minor
      Found in lib/framework/core/cache_manager.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 augment_facts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def augment_facts(ttls, groups)
              fact_groups = Facter::FactGroups.new
      
              @options[:blocked_facts] = fact_groups.blocked_facts unless fact_groups.blocked_facts.nil?
              @options[:block_list] = fact_groups.block_list
      Severity: Minor
      Found in lib/framework/core/options/config_file_options.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 populate_version_and_revision has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def populate_version_and_revision
                oem_strings = Facter::Resolvers::Virtualization.resolve(:oem_strings)
                return unless oem_strings
      
                version = revision = ''
      Severity: Minor
      Found in lib/facts/windows/hypervisors/virtualbox.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 confine has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def confine(confines = nil, &block)
              case confines
              when Hash
                confines.each do |fact, values|
                  @confines.push LegacyFacter::Util::Confine.new(fact, *values)
      Severity: Minor
      Found in lib/custom_facts/core/suitable.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

      Severity
      Category
      Status
      Source
      Language