Showing 189 of 197 total issues
Method setup_by_other
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def setup_by_other(target, other, own, foreign)
return own if target.gas?
original_own = own
own = SpecificAtom.new(own) unless own.specific?
- 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
File dependent_wrapped_spec.rb
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
module VersatileDiamond
using Patches::RichArray
module Organizers
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 swap_atom
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def swap_atom(spec, from, to, reverse_too: true)
is_source = @source.include?(spec)
@result.each do |_, mapping|
mapping.each do |specs, atoms|
- 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 position
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def position(*atom_strs, **options)
target, spec, atom, used_atom_str = nil
atom_strs.each do |atom_str|
atom_sym = atom_str.to_sym
- 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
File base_context_provider.rb
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
module VersatileDiamond
using Patches::RichArray
module Generators
module Code
Class Graph
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Graph
include Modules::ExcessPositionChecker
include Concepts::AtomsSwapper
extend Forwardable
Class SpecieBackbone
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class SpecieBackbone < BaseBackbone
extend Forwardable
# Initializes backbone by specie and grouped nodes of it
# @param [EngineCode] generator the major engine code generator
Method extends_if_possible
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def extends_if_possible(type, source, products, bonds_sum_limit, deep, &block)
specs = eval(type.to_s)
combinations(specs).each do |combination|
bonds_sum = specs.reduce(0) do |acc, spec|
acc +
- 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 find_positions_for
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def find_positions_for(reaction)
return if complex_source.one? || complex_source.size == complex_products.size
main_spec, idx =
complex_source.one? ? [complex_source.first, 0] : [complex_products.first, 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
File specie.rb
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
module VersatileDiamond
using Patches::RichString
module Generators
module Code
Method convert_rate
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def convert_rate(value, gases_num, dimension = nil)
return 0 if value == 0
dimension ||= @rate
syntax_error('.is_not_set') unless dimension
Class AtomsChangeUnit
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class AtomsChangeUnit
include Modules::ProcsReducer
# @param [Expressions::TargetsDictionary] dict
# @param [ChangesContextProvider] context
Method build_sequence_from
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def build_sequence_from(graph, nodes, visited)
result = []
nodes_queue = nodes.dup
until nodes_queue.empty?
- 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
Class SymmetriesDetector
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class SymmetriesDetector
include Modules::ListsComparer
include SymmetryHelper
extend Forwardable
Class TypicalReaction
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class TypicalReaction < SpeciesReaction
# Initializes typical reaction class code generator
def initialize(*)
super
Class MappingResult
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class MappingResult
attr_reader :source, :products, :reaction_type
# Recombines passed mapping result to list where each item is two spec_atom
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 generate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def generate(no_term_specs: false, no_base_specs: false, no_spec_specs: false, no_reactions: false)
@atoms_format = '%25s | %5s | %10s | %4s | %s'
puts @atoms_format % %w(Image Index Lattice Name Parents)
print_atoms('Atoms', classifier.props)
puts
- 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 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"