MurgaNikolay/chef-eye

View on GitHub
libraries/config_render.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

      def generate_multiply_renderers(method, renderer_name)
        return if method_with_block?(method)
        return unless MULTIPLY.include?(method.name)
        # multiply called
        parameters = method.parameters
Severity: Minor
Found in libraries/config_render.rb - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Method generate_general_renderers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def generate_general_renderers(method, renderer_name)
        return if method_with_block?(method)
        return if MULTIPLY.include?(method.name)
        parameters = method.parameters
        self.class.send(:define_method, renderer_name) do |args|
Severity: Minor
Found in libraries/config_render.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 delete_keys_recursive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def delete_keys_recursive(keys, leave = [])
      each_with_object({}) do |(k, v), h|
        next h if keys.include?(k)
        v = v.delete_keys_recursive(keys, leave) if v.is_a?(::Hash) && !leave.include?(k)
        h[k] = v
Severity: Minor
Found in libraries/config_render.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 generate_block_renderers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def generate_block_renderers(method, renderer_name)
        return unless method_with_block?(method)
        parameters = method.parameters
        if parameters.size > 1
          self.class.send(:define_method, renderer_name) do |value|
Severity: Minor
Found in libraries/config_render.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