newmen/versatile-diamond

View on GitHub
analyzer/lib/mcs/species_comparator.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method resort_intersecs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def resort_intersecs(intersecs, first, second)
          fn, sn = first.name, second.name
          fs, ss = first.links.size, second.links.size
          intersecs.sort_by do |isec|
            isec.map do |v, w|
Severity: Minor
Found in analyzer/lib/mcs/species_comparator.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 select_maximals has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def select_maximals(intersecs)
          as_nums = intersecs.map do |isec|
            isec.reduce(0) do |acc, (v, w)|
              a, b = v.is_a?(Array) && w.is_a?(Array) ? [v, w].map(&:last) : [v, w]
              acc + (a.accurate_same?(b) ? 1 : 0)
Severity: Minor
Found in analyzer/lib/mcs/species_comparator.rb - About 55 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 intersec has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def intersec(first, second, **kwargs, &block)
          unless block_given?
            # because order of intersections should be constant
            @@_intersec_cache ||= {}
            key = [first, second, kwargs]
Severity: Minor
Found in analyzer/lib/mcs/species_comparator.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

There are no issues that match your filters.

Category
Status