Showing 4 of 4 total issues
Method get_const_atoms
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def get_const_atoms(formula = @formula, r = {})
formula.scan(COMPOUND_REGEXP).each do |const|
multipler = get_multipler const
if const[0] != '(' && multipler.zero?
r[const] = r[const] ? r[const] + 1 : 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 get_participant_row
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_participant_row(parti)
row = []
@species.keys.each do |key|
i = key == :reactants ? 1 : -1
@species[key].keys.each do |specie|
- 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 balance_rxn
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def balance_rxn
exp = ''
i = 0
bal_coeff = balanced_coeff_array
@species.keys.each do |key|
- 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 get_specie_info
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_specie_info(specie)
sc = get_stoichiometry specie
st = get_state specie
offset_sc = sc.zero? ? 0 : sc.to_s.length
offset_st = st.empty? ? 0 : st.length
- 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"