newmen/versatile-diamond

View on GitHub
analyzer/lib/generators/code/algorithm/units/context_base_unit.rb

Summary

Maintainability
C
1 day
Test Coverage

Class ContextBaseUnit has 53 methods (exceeds 20 allowed). Consider refactoring.
Open

        class ContextBaseUnit < GenerableUnit
          include Modules::ProcsReducer
          include Modules::ListsComparer
          extend Forwardable

Severity: Major
Found in analyzer/lib/generators/code/algorithm/units/context_base_unit.rb - About 7 hrs to fix

    File context_base_unit.rb has 363 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/units/context_base_unit.rb - About 4 hrs to fix

      Method iterate_crystal_relations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

                def iterate_crystal_relations(nbr, &block)
                  predefn_vars = dict.defined_vars # get before make inner nbr atoms var
                  self_var = dict.var_of(atoms)
                  nbr_var = dict.make_atom_s(nbr.atoms, name: 'neighbour')
                  lattice =
      Severity: Minor
      Found in analyzer/lib/generators/code/algorithm/units/context_base_unit.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