puppetlabs/facter-ng

View on GitHub

Showing 200 of 200 total issues

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

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

  module Solaris
    module Processors
      class Models
        FACT_NAME = 'processors.models'
        ALIASES = 'processor.*'
Severity: Minor
Found in lib/facts/solaris/processors/models.rb and 1 other location - About 40 mins to fix
lib/facts/macosx/processors/models.rb on lines 4..16

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

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

  module Macosx
    module Processors
      class Models
        FACT_NAME = 'processors.models'
        ALIASES = 'processor.*'
Severity: Minor
Found in lib/facts/macosx/processors/models.rb and 1 other location - About 40 mins to fix
lib/facts/solaris/processors/models.rb on lines 4..16

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

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

  module Windows
    class Network6Interfaces
      FACT_NAME = 'network6_.*'
      TYPE = :legacy

Severity: Major
Found in lib/facts/windows/network6_interfaces.rb and 15 other locations - About 40 mins to fix
lib/facts/linux/ipaddress6_interfaces.rb on lines 4..16
lib/facts/linux/ipaddress_interfaces.rb on lines 4..16
lib/facts/linux/macaddress_interfaces.rb on lines 4..16
lib/facts/linux/mtu_interfaces.rb on lines 4..16
lib/facts/linux/netmask6_interfaces.rb on lines 4..16
lib/facts/linux/netmask_interfaces.rb on lines 4..16
lib/facts/linux/network6_interfaces.rb on lines 4..16
lib/facts/linux/network_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress6_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress_interfaces.rb on lines 4..16
lib/facts/windows/macaddress_interfaces.rb on lines 4..16
lib/facts/windows/mtu_interfaces.rb on lines 4..16
lib/facts/windows/netmask6_interfaces.rb on lines 4..16
lib/facts/windows/netmask_interfaces.rb on lines 4..16
lib/facts/windows/network_interfaces.rb on lines 4..16

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

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

  module Linux
    class Ipaddress6Interfaces
      FACT_NAME = 'ipaddress6_.*'
      TYPE = :legacy

Severity: Major
Found in lib/facts/linux/ipaddress6_interfaces.rb and 15 other locations - About 40 mins to fix
lib/facts/linux/ipaddress_interfaces.rb on lines 4..16
lib/facts/linux/macaddress_interfaces.rb on lines 4..16
lib/facts/linux/mtu_interfaces.rb on lines 4..16
lib/facts/linux/netmask6_interfaces.rb on lines 4..16
lib/facts/linux/netmask_interfaces.rb on lines 4..16
lib/facts/linux/network6_interfaces.rb on lines 4..16
lib/facts/linux/network_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress6_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress_interfaces.rb on lines 4..16
lib/facts/windows/macaddress_interfaces.rb on lines 4..16
lib/facts/windows/mtu_interfaces.rb on lines 4..16
lib/facts/windows/netmask6_interfaces.rb on lines 4..16
lib/facts/windows/netmask_interfaces.rb on lines 4..16
lib/facts/windows/network6_interfaces.rb on lines 4..16
lib/facts/windows/network_interfaces.rb on lines 4..16

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

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

  def create_spec_file(spec_path, fact_name, operating_system)
    fact_tokens = fact_name.split('.')
    spec_file_name = fact_tokens.reverse.first + '_spec.rb'
    spec_file_with_path = File.join(spec_path, spec_file_name)

Severity: Minor
Found in tasks/fact_generator/fact_creator.rb and 1 other location - About 40 mins to fix
tasks/fact_generator/fact_creator.rb on lines 62..71

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

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

  module Linux
    class Netmask6Interfaces
      FACT_NAME = 'netmask6_.*'
      TYPE = :legacy

Severity: Major
Found in lib/facts/linux/netmask6_interfaces.rb and 15 other locations - About 40 mins to fix
lib/facts/linux/ipaddress6_interfaces.rb on lines 4..16
lib/facts/linux/ipaddress_interfaces.rb on lines 4..16
lib/facts/linux/macaddress_interfaces.rb on lines 4..16
lib/facts/linux/mtu_interfaces.rb on lines 4..16
lib/facts/linux/netmask_interfaces.rb on lines 4..16
lib/facts/linux/network6_interfaces.rb on lines 4..16
lib/facts/linux/network_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress6_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress_interfaces.rb on lines 4..16
lib/facts/windows/macaddress_interfaces.rb on lines 4..16
lib/facts/windows/mtu_interfaces.rb on lines 4..16
lib/facts/windows/netmask6_interfaces.rb on lines 4..16
lib/facts/windows/netmask_interfaces.rb on lines 4..16
lib/facts/windows/network6_interfaces.rb on lines 4..16
lib/facts/windows/network_interfaces.rb on lines 4..16

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

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

      def check_other_facts
        product_name = Facter::Resolvers::Linux::DmiBios.resolve(:product_name)
        bios_vendor =  Facter::Resolvers::Linux::DmiBios.resolve(:bios_vendor)
        return 'kvm' if bios_vendor&.include?('Amazon EC2')
        return unless product_name
Severity: Minor
Found in lib/facts/linux/virtual.rb and 1 other location - About 40 mins to fix
lib/facts/linux/is_virtual.rb on lines 46..52

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

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

  def create_fact_file(fact_path, fact_name, operating_system)
    fact_tokens = fact_name.split('.')
    fact_file_name = fact_tokens.reverse.first + '.rb'
    fact_file_with_path = File.join(fact_path, fact_file_name)

Severity: Minor
Found in tasks/fact_generator/fact_creator.rb and 1 other location - About 40 mins to fix
tasks/fact_generator/fact_creator.rb on lines 74..83

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

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

  module Windows
    class IpaddressInterfaces
      FACT_NAME = 'ipaddress_.*'
      TYPE = :legacy

Severity: Major
Found in lib/facts/windows/ipaddress_interfaces.rb and 15 other locations - About 40 mins to fix
lib/facts/linux/ipaddress6_interfaces.rb on lines 4..16
lib/facts/linux/ipaddress_interfaces.rb on lines 4..16
lib/facts/linux/macaddress_interfaces.rb on lines 4..16
lib/facts/linux/mtu_interfaces.rb on lines 4..16
lib/facts/linux/netmask6_interfaces.rb on lines 4..16
lib/facts/linux/netmask_interfaces.rb on lines 4..16
lib/facts/linux/network6_interfaces.rb on lines 4..16
lib/facts/linux/network_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress6_interfaces.rb on lines 4..16
lib/facts/windows/macaddress_interfaces.rb on lines 4..16
lib/facts/windows/mtu_interfaces.rb on lines 4..16
lib/facts/windows/netmask6_interfaces.rb on lines 4..16
lib/facts/windows/netmask_interfaces.rb on lines 4..16
lib/facts/windows/network6_interfaces.rb on lines 4..16
lib/facts/windows/network_interfaces.rb on lines 4..16

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

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

  module Windows
    class Ipaddress6Interfaces
      FACT_NAME = 'ipaddress6_.*'
      TYPE = :legacy

Severity: Major
Found in lib/facts/windows/ipaddress6_interfaces.rb and 15 other locations - About 40 mins to fix
lib/facts/linux/ipaddress6_interfaces.rb on lines 4..16
lib/facts/linux/ipaddress_interfaces.rb on lines 4..16
lib/facts/linux/macaddress_interfaces.rb on lines 4..16
lib/facts/linux/mtu_interfaces.rb on lines 4..16
lib/facts/linux/netmask6_interfaces.rb on lines 4..16
lib/facts/linux/netmask_interfaces.rb on lines 4..16
lib/facts/linux/network6_interfaces.rb on lines 4..16
lib/facts/linux/network_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress_interfaces.rb on lines 4..16
lib/facts/windows/macaddress_interfaces.rb on lines 4..16
lib/facts/windows/mtu_interfaces.rb on lines 4..16
lib/facts/windows/netmask6_interfaces.rb on lines 4..16
lib/facts/windows/netmask_interfaces.rb on lines 4..16
lib/facts/windows/network6_interfaces.rb on lines 4..16
lib/facts/windows/network_interfaces.rb on lines 4..16

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

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

  module Linux
    class NetworkInterfaces
      FACT_NAME = 'network_.*'
      TYPE = :legacy

Severity: Major
Found in lib/facts/linux/network_interfaces.rb and 15 other locations - About 40 mins to fix
lib/facts/linux/ipaddress6_interfaces.rb on lines 4..16
lib/facts/linux/ipaddress_interfaces.rb on lines 4..16
lib/facts/linux/macaddress_interfaces.rb on lines 4..16
lib/facts/linux/mtu_interfaces.rb on lines 4..16
lib/facts/linux/netmask6_interfaces.rb on lines 4..16
lib/facts/linux/netmask_interfaces.rb on lines 4..16
lib/facts/linux/network6_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress6_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress_interfaces.rb on lines 4..16
lib/facts/windows/macaddress_interfaces.rb on lines 4..16
lib/facts/windows/mtu_interfaces.rb on lines 4..16
lib/facts/windows/netmask6_interfaces.rb on lines 4..16
lib/facts/windows/netmask_interfaces.rb on lines 4..16
lib/facts/windows/network6_interfaces.rb on lines 4..16
lib/facts/windows/network_interfaces.rb on lines 4..16

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

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

  module Linux
    class Network6Interfaces
      FACT_NAME = 'network6_.*'
      TYPE = :legacy

Severity: Major
Found in lib/facts/linux/network6_interfaces.rb and 15 other locations - About 40 mins to fix
lib/facts/linux/ipaddress6_interfaces.rb on lines 4..16
lib/facts/linux/ipaddress_interfaces.rb on lines 4..16
lib/facts/linux/macaddress_interfaces.rb on lines 4..16
lib/facts/linux/mtu_interfaces.rb on lines 4..16
lib/facts/linux/netmask6_interfaces.rb on lines 4..16
lib/facts/linux/netmask_interfaces.rb on lines 4..16
lib/facts/linux/network_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress6_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress_interfaces.rb on lines 4..16
lib/facts/windows/macaddress_interfaces.rb on lines 4..16
lib/facts/windows/mtu_interfaces.rb on lines 4..16
lib/facts/windows/netmask6_interfaces.rb on lines 4..16
lib/facts/windows/netmask_interfaces.rb on lines 4..16
lib/facts/windows/network6_interfaces.rb on lines 4..16
lib/facts/windows/network_interfaces.rb on lines 4..16

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

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

  module Windows
    class NetmaskInterfaces
      FACT_NAME = 'netmask_.*'
      TYPE = :legacy

Severity: Major
Found in lib/facts/windows/netmask_interfaces.rb and 15 other locations - About 40 mins to fix
lib/facts/linux/ipaddress6_interfaces.rb on lines 4..16
lib/facts/linux/ipaddress_interfaces.rb on lines 4..16
lib/facts/linux/macaddress_interfaces.rb on lines 4..16
lib/facts/linux/mtu_interfaces.rb on lines 4..16
lib/facts/linux/netmask6_interfaces.rb on lines 4..16
lib/facts/linux/netmask_interfaces.rb on lines 4..16
lib/facts/linux/network6_interfaces.rb on lines 4..16
lib/facts/linux/network_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress6_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress_interfaces.rb on lines 4..16
lib/facts/windows/macaddress_interfaces.rb on lines 4..16
lib/facts/windows/mtu_interfaces.rb on lines 4..16
lib/facts/windows/netmask6_interfaces.rb on lines 4..16
lib/facts/windows/network6_interfaces.rb on lines 4..16
lib/facts/windows/network_interfaces.rb on lines 4..16

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

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

  module Linux
    class IpaddressInterfaces
      FACT_NAME = 'ipaddress_.*'
      TYPE = :legacy

Severity: Major
Found in lib/facts/linux/ipaddress_interfaces.rb and 15 other locations - About 40 mins to fix
lib/facts/linux/ipaddress6_interfaces.rb on lines 4..16
lib/facts/linux/macaddress_interfaces.rb on lines 4..16
lib/facts/linux/mtu_interfaces.rb on lines 4..16
lib/facts/linux/netmask6_interfaces.rb on lines 4..16
lib/facts/linux/netmask_interfaces.rb on lines 4..16
lib/facts/linux/network6_interfaces.rb on lines 4..16
lib/facts/linux/network_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress6_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress_interfaces.rb on lines 4..16
lib/facts/windows/macaddress_interfaces.rb on lines 4..16
lib/facts/windows/mtu_interfaces.rb on lines 4..16
lib/facts/windows/netmask6_interfaces.rb on lines 4..16
lib/facts/windows/netmask_interfaces.rb on lines 4..16
lib/facts/windows/network6_interfaces.rb on lines 4..16
lib/facts/windows/network_interfaces.rb on lines 4..16

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

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

      def check_other_facts
        product_name = Facter::Resolvers::Linux::DmiBios.resolve(:product_name)
        bios_vendor = Facter::Resolvers::Linux::DmiBios.resolve(:bios_vendor)
        return 'kvm' if bios_vendor&.include?('Amazon EC2')
        return unless product_name
Severity: Minor
Found in lib/facts/linux/is_virtual.rb and 1 other location - About 40 mins to fix
lib/facts/linux/virtual.rb on lines 44..50

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

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

  module Windows
    class NetworkInterfaces
      FACT_NAME = 'network_.*'
      TYPE = :legacy

Severity: Major
Found in lib/facts/windows/network_interfaces.rb and 15 other locations - About 40 mins to fix
lib/facts/linux/ipaddress6_interfaces.rb on lines 4..16
lib/facts/linux/ipaddress_interfaces.rb on lines 4..16
lib/facts/linux/macaddress_interfaces.rb on lines 4..16
lib/facts/linux/mtu_interfaces.rb on lines 4..16
lib/facts/linux/netmask6_interfaces.rb on lines 4..16
lib/facts/linux/netmask_interfaces.rb on lines 4..16
lib/facts/linux/network6_interfaces.rb on lines 4..16
lib/facts/linux/network_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress6_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress_interfaces.rb on lines 4..16
lib/facts/windows/macaddress_interfaces.rb on lines 4..16
lib/facts/windows/mtu_interfaces.rb on lines 4..16
lib/facts/windows/netmask6_interfaces.rb on lines 4..16
lib/facts/windows/netmask_interfaces.rb on lines 4..16
lib/facts/windows/network6_interfaces.rb on lines 4..16

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

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

  module Linux
    class NetmaskInterfaces
      FACT_NAME = 'netmask_.*'
      TYPE = :legacy

Severity: Major
Found in lib/facts/linux/netmask_interfaces.rb and 15 other locations - About 40 mins to fix
lib/facts/linux/ipaddress6_interfaces.rb on lines 4..16
lib/facts/linux/ipaddress_interfaces.rb on lines 4..16
lib/facts/linux/macaddress_interfaces.rb on lines 4..16
lib/facts/linux/mtu_interfaces.rb on lines 4..16
lib/facts/linux/netmask6_interfaces.rb on lines 4..16
lib/facts/linux/network6_interfaces.rb on lines 4..16
lib/facts/linux/network_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress6_interfaces.rb on lines 4..16
lib/facts/windows/ipaddress_interfaces.rb on lines 4..16
lib/facts/windows/macaddress_interfaces.rb on lines 4..16
lib/facts/windows/mtu_interfaces.rb on lines 4..16
lib/facts/windows/netmask6_interfaces.rb on lines 4..16
lib/facts/windows/netmask_interfaces.rb on lines 4..16
lib/facts/windows/network6_interfaces.rb on lines 4..16
lib/facts/windows/network_interfaces.rb on lines 4..16

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

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