newmen/versatile-diamond

View on GitHub
analyzer/lib/organizers/chunks_combiner.rb

Summary

Maintainability
D
1 day
Test Coverage

Class ChunksCombiner has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

    class ChunksCombiner
      include Mcs::SpecsAtomsComparator
      include Modules::ExtendedCombinator
      include Modules::ListsComparer

Severity: Minor
Found in analyzer/lib/organizers/chunks_combiner.rb - About 4 hrs to fix

    File chunks_combiner.rb has 326 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module VersatileDiamond
      using Patches::RichArray
    
      module Organizers
    
    
    Severity: Minor
    Found in analyzer/lib/organizers/chunks_combiner.rb - About 3 hrs to fix

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

            def cross_mergeable(chunks, targets)
              all_groups = same_targets_groups(targets)
              sames_grs = all_groups.select { |gr| gr.size > 1 }
              uniqs = (all_groups - sames_grs).map(&:first)
      
      
      Severity: Minor
      Found in analyzer/lib/organizers/chunks_combiner.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 extend_variants has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def extend_variants(variants, chunks)
              previous_collected = chunks.dup
              chunks.each_with_object(variants) do |chunk, acc|
                independent_chunks = split_to_independent_chunks(chunk)
      
      
      Severity: Minor
      Found in analyzer/lib/organizers/chunks_combiner.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 same_targets_groups has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def same_targets_groups(targets)
              groups = []
              cheking_targets = (@general_targets + targets).uniq
              iterating_chunks = cheking_targets.dup
      
      
      Severity: Minor
      Found in analyzer/lib/organizers/chunks_combiner.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 lookup_exist_chunks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def lookup_exist_chunks(variants, presented_cmbs, chunks)
              presented_chunks = variants.to_a.select(&:last).map(&:last).uniq
              exist_chunks = chunks.map do |chunk|
                variants = check_same_then_swap(variants, presented_chunks, chunk)
                unless presented_chunks.any? { |ch| ch.same?(chunk) }
      Severity: Minor
      Found in analyzer/lib/organizers/chunks_combiner.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 iterate_permutations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def iterate_permutations(chunks, targets, &block)
              diff_chunks = drop_same_multitargets(chunks, targets)
              splitted_chunks_groups = possible_chunks_combinations(diff_chunks)
              permutate_targets(targets).reduce([]) do |a1, targets_maps|
                !a1.empty? ? a1 : splitted_chunks_groups.reduce(a1) do |a2, chunks_groups|
      Severity: Minor
      Found in analyzer/lib/organizers/chunks_combiner.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 extract_links has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def extract_links(links, target_specs, sidepiece_spec)
              select_spec_lambda = -> spec do
                spec == sidepiece_spec || target_specs.include?(spec)
              end
      
      
      Severity: Minor
      Found in analyzer/lib/organizers/chunks_combiner.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

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

            def swap_chunk(variants, from, to)
              swap_lambda = -> chunk { chunk == from ? to : chunk }
              variants.each_with_object({}) do |(cmb, chunk), acc|
                new_cmb = cmb.include?(from) ? cmb.map(&swap_lambda) : cmb
                acc[new_cmb] = swap_lambda[chunk]
      Severity: Minor
      Found in analyzer/lib/organizers/chunks_combiner.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