newmen/versatile-diamond

View on GitHub
analyzer/lib/generators/code/algorithm/specie_backbone.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Class SpecieBackbone has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

        class SpecieBackbone < BaseBackbone
          extend Forwardable

          # Initializes backbone by specie and grouped nodes of it
          # @param [EngineCode] generator the major engine code generator
Severity: Minor
Found in analyzer/lib/generators/code/algorithm/specie_backbone.rb - About 2 hrs to fix

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

              def clear_excess_rels(graph)
                all_nodes_lists = collect_nodes(graph)
                real_nodes = all_nodes_lists.reduce(:+).uniq.reject(&:none?)
                real_species = real_nodes.map(&:uniq_specie).uniq
                eq_nums = (real_nodes.size == real_species.size)
    Severity: Minor
    Found in analyzer/lib/generators/code/algorithm/specie_backbone.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 uniq_anchored? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

              def uniq_anchored?(nodes, lists_of_nodes)
                return false unless nodes.all?(&:anchor?)
                all_other_nodes = lists_of_nodes.flatten - nodes
                other_anchored_nodes = all_other_nodes.select(&:anchor?)
                return false if !all_other_nodes.empty? && other_anchored_nodes.empty?
    Severity: Minor
    Found in analyzer/lib/generators/code/algorithm/specie_backbone.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 setup_anchored_order has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

              def setup_anchored_order(graph, all_nodes_lists)
                through_sequence(graph, all_nodes_lists) do |acc, nodes, _|
                  if acc[nodes]
                    keep_anchored_rels(acc, nodes)
                  else
    Severity: Minor
    Found in analyzer/lib/generators/code/algorithm/specie_backbone.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