uniak/puppet-networkdevice

View on GitHub
lib/puppet/util/network_device/dsl.rb

Summary

Maintainability
B
4 hrs
Test Coverage

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

  def evaluate_new_params
    Puppet::Util::NetworkDevice::Sorter.new(@params).tsort.each do |param|
      #Skip if the param has already been evaluated
      next if param.evaluated
      if param.cmd != false
Severity: Minor
Found in lib/puppet/util/network_device/dsl.rb - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

  def register_array(param, match_re, fetch_cmd, cmd, &block)
Severity: Minor
Found in lib/puppet/util/network_device/dsl.rb - About 35 mins to fix

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

      def params_to_hash
        @params.inject({}) {|res, data|
          unless respond_to?(:skip_params_to_hash) && skip_params_to_hash.include?(data[0])
            unless data[1].value.nil? || data[1].value.to_s.empty?
              if data[1].value.is_a?(Hash)
    Severity: Minor
    Found in lib/puppet/util/network_device/dsl.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 register_new_module has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def register_new_module(mod, path_addition = "")
        @included_modules ||= []
        unless @included_modules.include?(mod)
          Puppet::Util::Autoload.new(self, File.join(mod_path_base, path_addition), :wrap => false).load(mod)
          if path_addition.empty?
    Severity: Minor
    Found in lib/puppet/util/network_device/dsl.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

    There are no issues that match your filters.

    Category
    Status