Class AtomProperties
has 73 methods (exceeds 20 allowed). Consider refactoring. Open
class AtomProperties
include Modules::ListsComparer
include Modules::OrderProvider
include Lattices::BasicRelations
File atom_properties.rb
has 571 lines of code (exceeds 250 allowed). Consider refactoring. Open
module VersatileDiamond
using Patches::RichArray
using Patches::RichString
module Organizers
Method to_s
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def to_s
return @_to_s if @_to_s
name = atom_name.to_s
- Read upRead up
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 to_s
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_s
return @_to_s if @_to_s
name = atom_name.to_s
Method merge_props
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def merge_props(other, &block)
same_unit_states = UNIT_STATES.all? { |mn| send(mn) == other.send(mn) }
is_valid_lts = lattice == other.lattice ||
(!lattice && other.lattice) || (lattice && !other.lattice)
- Read upRead up
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 common_plus
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def common_plus(other, total_props)
lattices_num = total_props[:nbr_lattices].select(&:last).size
total_unfixed = total_props[:relevants].include?(UNFIXED)
return if total_unfixed && lattices_num > 1
- Read upRead up
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 safe_plus
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def safe_plus(other)
both = [self, other]
smallests_of_both = both.map do |props|
props.smallests.empty? ? Set[props] : props.smallests
end
- Read upRead up
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 initialize
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(*args)
if args.one?
arg = args.first
if arg.is_a?(Array)
@props = arg
Method initialize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def initialize(*args)
if args.one?
arg = args.first
if arg.is_a?(Array)
@props = arg
- Read upRead up
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 remake_relations
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def remake_relations(spec, atom)
# only bonds without relevat states and positions
bonds = spec.relations_of(atom, with_atoms: true).select { |_, r| r.bond? }
result = []
- Read upRead up
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 <=>
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def <=>(other)
if self == other
0
elsif include?(other)
1
Method common_plus
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def common_plus(other, total_props)
lattices_num = total_props[:nbr_lattices].select(&:last).size
total_unfixed = total_props[:relevants].include?(UNFIXED)
return if total_unfixed && lattices_num > 1
Consider simplifying this complex logical expression. Open
elsif arg.is_a?(Hash)
@props = [
arg[:atom_name] || raise(ArgumentError, 'Undefined atom name'),
arg[:valence] || raise(ArgumentError, 'Undefined valence'),
arg[:lattice] || raise(ArgumentError, 'Undefined lattice'),
Consider simplifying this complex logical expression. Open
if rel.multi?
g = many_nls_groups.find { |g| g.size == rel.arity }
frl = g && g.pop
frl && (rel.arity - 1).times(&g.public_method(:pop))
else
Method contained_in?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def contained_in?(other)
return false unless same_basic_values?(other)
return false unless other.contain_all_relevants?(self)
if incoherent? && other.relevant?
other.eq_relevant_bonds?(self)
- Read upRead up
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 produce_props
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def produce_props(other, &block)
unit_props = UNIT_STATES.zip([atom_name, valence]).to_h
all_lattices = [self, other].map(&:lattice).uniq
any_unfixed = [self, other].any?(&:unfixed?)
iterating_lattices =
- Read upRead up
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"