puppetlabs/facter

View on GitHub

Showing 389 of 389 total issues

Method find_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def find_command
          num_stacks = 0
          XEN_COMMANDS.each do |command|
            num_stacks += 1 if File.exist?(command)
          end
Severity: Minor
Found in lib/facter/resolvers/xen.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 error has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def error(msg, colorize = false) # rubocop:disable Style/OptionalBooleanParameter
      @@has_errors = true

      if @@message_callback && Options[:allow_external_loggers]
        @@message_callback.call(:error, msg)
Severity: Minor
Found in lib/facter/framework/logging/logger.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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.validate(options)
      DUPLICATED_OPTIONS_RULES.each do |key, value|
        if options.include?(key) && options.include?(value)
          write_error_and_exit("option #{value} cannot be specified more than once.")
        end
Severity: Minor
Found in lib/facter/framework/core/options/options_validator.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 update_changelog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update_changelog
    old_lines = File.read(changelog).split("\n")

    new_lines = [
      "## [#{version}](https://github.com/puppetlabs/facter/tree/#{version}) (#{Time.now.strftime '%Y-%m-%d'})\n",
Severity: Minor
Found in scripts/generate_changelog.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 read_ipaddress has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def read_ipaddress(fact_name)
            ip = nil
            primary_interface = read_primary_interface
            unless primary_interface.nil?
              output = Facter::Core::Execution.execute("ifconfig #{primary_interface}", logger: log)
Severity: Minor
Found in lib/facter/resolvers/solaris/ipaddress.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 setup_default_ext_facts_dirs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.setup_default_ext_facts_dirs
        if LegacyFacter::Util::Root.root?
          windows_dir = windows_data_dir
          Facter::Options[:default_external_dir] = if windows_dir
                                                     [File.join(windows_dir, 'PuppetLabs', 'facter', 'facts.d')]
Severity: Minor
Found in lib/facter/custom_facts/util/config.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 extract_vm_and_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def extract_vm_and_info(output_docker, output_lxc, lxc_from_environ)
          vm = nil
          if output_docker
            vm = 'docker'
            info = output_docker[1]
Severity: Minor
Found in lib/facter/resolvers/containers.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 retrieve_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def retrieve_info(fact_name)
            require 'socket'

            output = retrieving_hostname
            return nil unless output
Severity: Minor
Found in lib/facter/resolvers/linux/hostname.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 normalize_string has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def normalize_string(value)
        value = value.encode(Encoding::UTF_8)

        unless value.valid_encoding?
          raise NormalizationError, "String #{value.inspect} doesn't match the reported encoding #{value.encoding}"
Severity: Minor
Found in lib/facter/custom_facts/util/normalization.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 address_to_string has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def address_to_string(addr)
      return if addr[:lpSockaddr] == FFI::Pointer::NULL

      size = FFI::MemoryPointer.new(NetworkingFFI::INET6_ADDRSTRLEN + 1)
      buffer = FFI::MemoryPointer.new(:wchar, NetworkingFFI::INET6_ADDRSTRLEN + 1)
Severity: Minor
Found in lib/facter/resolvers/windows/ffi/network_utils.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 retrieve_windows_binaries_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def retrieve_windows_binaries_path
          require_relative '../../../facter/resolvers/windows/ffi/system32_ffi'

          windows_path = ENV['SystemRoot']

Severity: Minor
Found in lib/facter/resolvers/windows/system32.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

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

  module Linux
    module Dmi
      module Bios
        class ReleaseDate
          FACT_NAME = 'dmi.bios.release_date'
Severity: Major
Found in lib/facter/facts/linux/dmi/bios/release_date.rb and 26 other locations - About 25 mins to fix
lib/facter/facts/freebsd/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/freebsd/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/version.rb on lines 4..13
lib/facter/facts/linux/dmi/board/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/board/manufacturer.rb on lines 4..13
lib/facter/facts/linux/dmi/board/product.rb on lines 4..13
lib/facter/facts/linux/dmi/board/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/type.rb on lines 4..13
lib/facter/facts/linux/dmi/product/name.rb on lines 4..13
lib/facter/facts/linux/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/linux/dmi/product/version.rb on lines 4..13
lib/facter/facts/macosx/dmi/product/name.rb on lines 4..13
lib/facter/facts/macosx/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/uuid.rb on lines 4..13

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

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 27 locations. Consider refactoring.
Open

  module Linux
    module Dmi
      module Product
        class Name
          FACT_NAME = 'dmi.product.name'
Severity: Major
Found in lib/facter/facts/linux/dmi/product/name.rb and 26 other locations - About 25 mins to fix
lib/facter/facts/freebsd/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/freebsd/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/version.rb on lines 4..13
lib/facter/facts/linux/dmi/board/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/board/manufacturer.rb on lines 4..13
lib/facter/facts/linux/dmi/board/product.rb on lines 4..13
lib/facter/facts/linux/dmi/board/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/type.rb on lines 4..13
lib/facter/facts/linux/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/linux/dmi/product/version.rb on lines 4..13
lib/facter/facts/macosx/dmi/product/name.rb on lines 4..13
lib/facter/facts/macosx/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/uuid.rb on lines 4..13

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

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 27 locations. Consider refactoring.
Open

  module Linux
    module Dmi
      module Chassis
        class Type
          FACT_NAME = 'dmi.chassis.type'
Severity: Major
Found in lib/facter/facts/linux/dmi/chassis/type.rb and 26 other locations - About 25 mins to fix
lib/facter/facts/freebsd/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/freebsd/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/version.rb on lines 4..13
lib/facter/facts/linux/dmi/board/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/board/manufacturer.rb on lines 4..13
lib/facter/facts/linux/dmi/board/product.rb on lines 4..13
lib/facter/facts/linux/dmi/board/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/product/name.rb on lines 4..13
lib/facter/facts/linux/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/linux/dmi/product/version.rb on lines 4..13
lib/facter/facts/macosx/dmi/product/name.rb on lines 4..13
lib/facter/facts/macosx/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/uuid.rb on lines 4..13

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

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 3 locations. Consider refactoring.
Open

  module Openbsd
    class IsVirtual
      FACT_NAME = 'is_virtual'

      def call_the_resolver
Severity: Minor
Found in lib/facter/facts/openbsd/is_virtual.rb and 2 other locations - About 25 mins to fix
lib/facter/facts/freebsd/is_virtual.rb on lines 4..17
lib/facter/facts/linux/is_virtual.rb on lines 4..17

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

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 27 locations. Consider refactoring.
Open

  module Freebsd
    module Dmi
      module Product
        class Name
          FACT_NAME = 'dmi.product.name'
Severity: Major
Found in lib/facter/facts/freebsd/dmi/product/name.rb and 26 other locations - About 25 mins to fix
lib/facter/facts/freebsd/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/freebsd/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/version.rb on lines 4..13
lib/facter/facts/linux/dmi/board/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/board/manufacturer.rb on lines 4..13
lib/facter/facts/linux/dmi/board/product.rb on lines 4..13
lib/facter/facts/linux/dmi/board/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/type.rb on lines 4..13
lib/facter/facts/linux/dmi/product/name.rb on lines 4..13
lib/facter/facts/linux/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/linux/dmi/product/version.rb on lines 4..13
lib/facter/facts/macosx/dmi/product/name.rb on lines 4..13
lib/facter/facts/macosx/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/uuid.rb on lines 4..13

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

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 27 locations. Consider refactoring.
Open

  module Macosx
    module Dmi
      module Product
        class Name
          FACT_NAME = 'dmi.product.name'
Severity: Major
Found in lib/facter/facts/macosx/dmi/product/name.rb and 26 other locations - About 25 mins to fix
lib/facter/facts/freebsd/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/freebsd/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/version.rb on lines 4..13
lib/facter/facts/linux/dmi/board/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/board/manufacturer.rb on lines 4..13
lib/facter/facts/linux/dmi/board/product.rb on lines 4..13
lib/facter/facts/linux/dmi/board/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/type.rb on lines 4..13
lib/facter/facts/linux/dmi/product/name.rb on lines 4..13
lib/facter/facts/linux/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/linux/dmi/product/version.rb on lines 4..13
lib/facter/facts/macosx/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/uuid.rb on lines 4..13

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

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 27 locations. Consider refactoring.
Open

  module Linux
    module Dmi
      module Board
        class Manufacturer
          FACT_NAME = 'dmi.board.manufacturer'
Severity: Major
Found in lib/facter/facts/linux/dmi/board/manufacturer.rb and 26 other locations - About 25 mins to fix
lib/facter/facts/freebsd/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/freebsd/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/version.rb on lines 4..13
lib/facter/facts/linux/dmi/board/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/board/product.rb on lines 4..13
lib/facter/facts/linux/dmi/board/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/type.rb on lines 4..13
lib/facter/facts/linux/dmi/product/name.rb on lines 4..13
lib/facter/facts/linux/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/linux/dmi/product/version.rb on lines 4..13
lib/facter/facts/macosx/dmi/product/name.rb on lines 4..13
lib/facter/facts/macosx/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/uuid.rb on lines 4..13

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

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 27 locations. Consider refactoring.
Open

  module Macosx
    module Memory
      module Swap
        class Encrypted
          FACT_NAME = 'memory.swap.encrypted'
Severity: Major
Found in lib/facter/facts/macosx/memory/swap/encrypted.rb and 26 other locations - About 25 mins to fix
lib/facter/facts/freebsd/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/freebsd/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/version.rb on lines 4..13
lib/facter/facts/linux/dmi/board/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/board/manufacturer.rb on lines 4..13
lib/facter/facts/linux/dmi/board/product.rb on lines 4..13
lib/facter/facts/linux/dmi/board/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/type.rb on lines 4..13
lib/facter/facts/linux/dmi/product/name.rb on lines 4..13
lib/facter/facts/linux/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/linux/dmi/product/version.rb on lines 4..13
lib/facter/facts/macosx/dmi/product/name.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/uuid.rb on lines 4..13

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

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 27 locations. Consider refactoring.
Open

  module Linux
    module Dmi
      module Product
        class Uuid
          FACT_NAME = 'dmi.product.uuid'
Severity: Major
Found in lib/facter/facts/linux/dmi/product/uuid.rb and 26 other locations - About 25 mins to fix
lib/facter/facts/freebsd/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/freebsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/freebsd/dmi/product/uuid.rb on lines 4..13
lib/facter/facts/freebsd/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/release_date.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/linux/dmi/bios/version.rb on lines 4..13
lib/facter/facts/linux/dmi/board/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/board/manufacturer.rb on lines 4..13
lib/facter/facts/linux/dmi/board/product.rb on lines 4..13
lib/facter/facts/linux/dmi/board/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/asset_tag.rb on lines 4..13
lib/facter/facts/linux/dmi/chassis/type.rb on lines 4..13
lib/facter/facts/linux/dmi/product/name.rb on lines 4..13
lib/facter/facts/linux/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/linux/dmi/product/version.rb on lines 4..13
lib/facter/facts/macosx/dmi/product/name.rb on lines 4..13
lib/facter/facts/macosx/memory/swap/encrypted.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/vendor.rb on lines 4..13
lib/facter/facts/openbsd/dmi/bios/version.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/name.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/serial_number.rb on lines 4..13
lib/facter/facts/openbsd/dmi/product/uuid.rb on lines 4..13

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

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

Severity
Category
Status
Source
Language