newmen/versatile-diamond

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

Summary

Maintainability
B
4 hrs
Test Coverage

Class AtomVariable has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

        class AtomVariable < Core::Variable
          include LatticePositionReference

          # @param [Instances::SpecieInstance] specie
          # @return [Core::OpCall]

    Method iterate_over_lattice has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

              def iterate_over_lattice(defined_vars, nbr_var, lattice, rel_params, body)

      Method all_crystal_nbrs has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                def all_crystal_nbrs(defined_vars, nbrs_arr, lattice, rel_params, body)

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

                  def recharge(delta)
                    if delta == 0
                      raise ArgumentError, 'Cannot recharge with 0 delta'
                    elsif delta.abs > instance.valence
                      raise ArgumentError, 'Too large delta for atom recharging'

        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