taiki45/mixed_gauge

View on GitHub

Showing 2 of 2 total issues

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

      def check_coverage(all_start_points, all_end_points)
        all_end_points.each_with_index do |end_point, i|
          break if all_end_points.size == i + 1

          next_start_point = all_start_points[i + 1]
Severity: Minor
Found in lib/mixed_gauge/cluster_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 put! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def put!(attributes)
        raise '`distkey` is not defined. Use `def_distkey`.' unless distkey
        @before_put_callback.call(attributes) if @before_put_callback

        if (key = attributes[distkey]) || attributes[distkey.to_s]
Severity: Minor
Found in lib/mixed_gauge/model.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

Severity
Category
Status
Source
Language