newmen/versatile-diamond

View on GitHub
analyzer/lib/generators/code/symmetries_detector.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class SymmetriesDetector has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

      class SymmetriesDetector
        include Modules::ListsComparer
        include SymmetryHelper
        extend Forwardable

Severity: Minor
Found in analyzer/lib/generators/code/symmetries_detector.rb - About 2 hrs to fix

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

            def overlaps_for(atoms, complex_child: false)
              @self_insec.each_with_object([]) do |intersec, all_overlaps|
                overlap = {}
                check_lambda = presented_in(overlap)
    
    
    Severity: Minor
    Found in analyzer/lib/generators/code/symmetries_detector.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 deep_parents_swapper has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            def deep_parents_swapper(pair)
              if spec.complex?
                if pair.all? { |a| spec.twins_num(a) == 1 }
                  twins = twins_of(pair)
                  return store_symmetry(Hash[[pair]]) if twins.first == twins.last
    Severity: Minor
    Found in analyzer/lib/generators/code/symmetries_detector.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 add_symmetries_for! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def add_symmetries_for!(atoms, **kwargs)
              overlaps_for(atoms, **kwargs).each do |overlap|
                next if @symmetries.keys.any? do |pairs|
                  pairs.size == overlap.size && pairs.all?(&presented_in(overlap))
                end
    Severity: Minor
    Found in analyzer/lib/generators/code/symmetries_detector.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

    There are no issues that match your filters.

    Category
    Status