Showing 50 of 78 total issues
File asms_2002_scheme1.rb
has 490 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require_relative "../fragmentable"
module Rubabel
class Molecule
module Fragmentable
File asms_2002_scheme2.rb
has 421 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require_relative "../fragmentable"
# self.write( 'root.svg', :add_atom_index => true)
module Rubabel
class Molecule
File asms_2002_scheme3-5.rb
has 412 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require_relative "../fragmentable"
# self.write( 'root.svg', :add_atom_index => true)
module Rubabel
class Molecule
Method fragment
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
def fragment(rules: @@rules- @@rearrangements, errors: :ignore, uniq: false, rearrange: true, fragment_adduct_state: DEFAULT_OPTIONS[:fragment_adduct_state], add_rule_names: false)
only_uniqs = true # Option is currently ignored.
# opts = DEFAULT_OPTIONS.merge(opts)
rules.each do |rule|
raise ArgumentError, "bad rule: #{rule}\nThe allowed rules are #{@@rules.entries.join(", ")}" unless @@rules.include?(rule)
- 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 fragment
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def fragment(rules: @@rules- @@rearrangements, errors: :ignore, uniq: false, rearrange: true, fragment_adduct_state: DEFAULT_OPTIONS[:fragment_adduct_state], add_rule_names: false)
only_uniqs = true # Option is currently ignored.
# opts = DEFAULT_OPTIONS.merge(opts)
rules.each do |rule|
raise ArgumentError, "bad rule: #{rule}\nThe allowed rules are #{@@rules.entries.join(", ")}" unless @@rules.include?(rule)
Method jasms_2002_scheme1_b_d1_water_loss
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rearrangements << def jasms_2002_scheme1_b_d1_water_loss(only_uniqs: true, fragment_adduct_state: :as_published)
fragment_sets = []
fragment = lambda do |lo, lc, lh|
#duplications and mapping
nmol = self.dup
Method jasms_2002_scheme1_c_e2aprime_formaldehyde_loss
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rule_names << def jasms_2002_scheme1_c_e2aprime_formaldehyde_loss(only_uniqs: true, fragment_adduct_state: :as_published)
fragment_sets = []
fragment = lambda do |*arr|
#duplications and mapping
(nmol,(carbon1, carbon2, oxygen, carbon3)) = self.dup_molecule(arr)
Method jasms_2002_scheme1_c_e1aprime
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rule_names << def jasms_2002_scheme1_c_e1aprime(only_uniqs: true, fragment_adduct_state: :as_published)
fragment_sets = []
fragment = lambda do |co, c1, c3, lo, n|
#duplications and mapping
nmol = self.dup
Method jasms_2002_scheme1_c_e1bprime
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rule_names << def jasms_2002_scheme1_c_e1bprime(only_uniqs: true, fragment_adduct_state: :as_published)
fragment_sets = []
fragment = lambda do |n, c2, lo|
#duplications and mapping
nmol = self.dup
Method jasms_2002_scheme1_c_e1b_to_d1bprime
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rule_names << def jasms_2002_scheme1_c_e1b_to_d1bprime(only_uniqs: true, fragment_adduct_state: :as_published)
fragment_sets = []
fragment = lambda do |co, c, n|
#duplications and mapping
nmol = self.dup
Method jasms_2002_scheme1_c_e1
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rule_names << def jasms_2002_scheme1_c_e1(only_uniqs: true, fragment_adduct_state: :as_published)
fragment_sets = []
fragment = lambda do |n, cc, o, tbvc|
#duplications and mapping
nmol = self.dup
Method jasms_2002_scheme1_a_c1
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rule_names << def jasms_2002_scheme1_a_c1(only_uniqs: true, fragment_adduct_state: :as_published)
# Create a fragmentation block method
fragment_sets = []
fragment = lambda do |tbcc, o, lc|
# Duplication and mapping identity to new atoms
Method jasms_2002_2_e2_b_formaldehyde_loss
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rule_names << def jasms_2002_2_e2_b_formaldehyde_loss(only_uniqs: true, fragment_adduct_state: :as_published)
fragment_sets = []
fragment = lambda do |*arr|
# duplicate
(nmol, (nitrogen, c1, c2, ester_oxygen, c3)) = self.dup_molecule(arr)
Method jasms_2002_5_e5_formaldehyde_loss
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rule_names << def jasms_2002_5_e5_formaldehyde_loss(only_uniqs: true, fragment_adduct_state: :as_published)
fragment_sets = []
fragment = lambda do |*arr|
# duplicate
(nmol, (nitrogen, ring_carbon, lost_carbon, lost_oxygen, ring_carbon2)) = self.dup_molecule(arr)
Method jasms_2002_scheme1_b_d1
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rule_names << def jasms_2002_scheme1_b_d1(only_uniqs: true, fragment_adduct_state: :as_published)
fragment_sets = []
fragment = lambda do |n, tcc, o|
#duplications and mapping
nmol = self.dup
Method jasms_2002_2_f2_b_methoxy_loss
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rearrangements << def jasms_2002_2_f2_b_methoxy_loss(only_uniqs: true, fragment_adduct_state: :as_published)
fragment_sets = []
fragment = lambda do |*arr|
# duplicate
(nmol, (c1, lost_carbon, oxygen, c2)) = self.dup_molecule(arr)
Method jasms_2002_2_e1
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rule_names << def jasms_2002_2_e1(only_uniqs: true, fragment_adduct_state: :as_published)
fragment_sets = []
fragment = lambda do |*arr|
# duplicate
(nmol, (nitrogen, carbonyl_carbon, carbonyl_oxygen, alcohol_carbon, alcohol_oxygen)) = self.dup_molecule(arr)
Method jasms_2002_scheme1_b_d1_formaldehyde_loss
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rearrangements << def jasms_2002_scheme1_b_d1_formaldehyde_loss(only_uniqs: true, fragment_adduct_state: :as_published)
fragment_sets = []
fragment = lambda do |tco, leavingc, leftc|
#duplications and mapping
nmol = self.dup
Method jasms_2002_scheme1_c_e1_aprimeprime_formaldehyde_loss
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rearrangements << def jasms_2002_scheme1_c_e1_aprimeprime_formaldehyde_loss(only_uniqs: true, fragment_adduct_state: :as_published)
fragment_sets = []
fragment = lambda do |*arr|
#duplications and mapping
(nmol,(cyclized_oxygen, freed_carbon, carbon_linked_to_nitrogen, carbon_linker, nitrogen)) = self.dup_molecule(arr)
Method jasms_2002_4_g2a_formaldehyde_loss
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
::Rule_names << def jasms_2002_4_g2a_formaldehyde_loss(only_uniqs: true, fragment_adduct_state: :as_published)
fragment_sets = []
fragment = lambda do |*arr|
# duplicate
(nmol, (ring_carbon, ring_oxygen, c3, link_carbon)) = self.dup_molecule(arr)