newmen/versatile-diamond

View on GitHub
analyzer/lib/concepts/surface_spec.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method opposite_relation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def opposite_relation(first, second, relation)
        target_lattice = first.lattice || second.lattice
        if target_lattice
          other_lattice = first.lattice == target_lattice ? second.lattice : nil
          target_lattice.opposite_relation(other_lattice, relation)
Severity: Minor
Found in analyzer/lib/concepts/surface_spec.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 link_together has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def link_together(*atoms, instance)
        if instance != undirected_bond
          raise Position::UnspecifiedAtoms unless at_least_one_latticed?(atoms)
          super(*sort(atoms), instance)
          find_positions
Severity: Minor
Found in analyzer/lib/concepts/surface_spec.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 find_positions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def find_positions
        atom_instances.combination(2).each do |atoms|
          next if !at_least_one_latticed?(atoms) || relation_between(*atoms)
          first, second = sort(atoms)

Severity: Minor
Found in analyzer/lib/concepts/surface_spec.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