newmen/versatile-diamond

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

Summary

Maintainability
C
1 day
Test Coverage

Class BaseGroupedNodes has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

        class BaseGroupedNodes
          include Modules::ExtendedCombinator
          include Modules::GraphDupper
          include Modules::ListsComparer
          extend Forwardable
Severity: Minor
Found in analyzer/lib/generators/code/algorithm/base_grouped_nodes.rb - About 3 hrs to fix

    File base_grouped_nodes.rb has 260 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module VersatileDiamond
      using Patches::RichArray
    
      module Generators
        module Code
    Severity: Minor
    Found in analyzer/lib/generators/code/algorithm/base_grouped_nodes.rb - About 2 hrs to fix

      Method non_complete_groups has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

                def non_complete_groups
                  flatten_face_grouped_nodes.each_with_object([]) do |group, acc|
                    next unless group.one?
                    rels = small_ungrouped_graph[group.first]
                    next unless rels.one?
      Severity: Minor
      Found in analyzer/lib/generators/code/algorithm/base_grouped_nodes.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 collaps_similar_key_nodes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

                def collaps_similar_key_nodes(graph)
                  result = {}
                  shrink_graph = graph.dup
                  until shrink_graph.empty?
                    nodes, rels = shrink_graph.shift
      Severity: Minor
      Found in analyzer/lib/generators/code/algorithm/base_grouped_nodes.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 accurate_combine_relations has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

                def accurate_combine_relations(group, &block)
                  accurate_node_groups_from(group).each do |nodes, nbrs|
                    next if lists_are_identical?(nodes, nbrs)
      
                    relation = nil
      Severity: Minor
      Found in analyzer/lib/generators/code/algorithm/base_grouped_nodes.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 accurate_node_groups_from has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

                def accurate_node_groups_from(nodes)
                  small_rels = nodes.map { |node| small_ungrouped_graph[node] }
      
                  accurate_groups = []
                  all_subsets_of(nodes.zip(small_rels)).each do |subsets|
      Severity: Minor
      Found in analyzer/lib/generators/code/algorithm/base_grouped_nodes.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 reorder_vertices has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

                def reorder_vertices(graph)
                  graph.each_with_object({}) do |(key, rels), acc|
                    if key.one?
                      acc[key] = rels.map { |nbrs, rp| [nbrs.sort, rp] }.sort_by(&:first)
                    else
      Severity: Minor
      Found in analyzer/lib/generators/code/algorithm/base_grouped_nodes.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 similar_combine_relations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

                def similar_combine_relations(group, &block)
                  group.each do |node|
                    nodes = [node]
                    rels = small_ungrouped_graph[node]
      
      
      Severity: Minor
      Found in analyzer/lib/generators/code/algorithm/base_grouped_nodes.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 build_complete_grouped_graph has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

                def build_complete_grouped_graph
                  graph = {}
                  store_proc = proc do |nodes, nbrs_with_rel_param|
                    graph[nodes] ||= []
                    graph[nodes] << nbrs_with_rel_param if nbrs_with_rel_param
      Severity: Minor
      Found in analyzer/lib/generators/code/algorithm/base_grouped_nodes.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