princelab/msplinter

View on GitHub

Showing 78 of 78 total issues

Method jasms_2002_2_f1_aprime has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      ::Rule_names << def jasms_2002_2_f1_aprime(only_uniqs: true, fragment_adduct_state: :as_published)
        fragment_sets = []
        fragment = lambda do |*arr|
          # duplicate
          (nmol, (cyclized_oxygen, linked_to_nitrogen_carbon, attacked_carbon, lost_oxygen)) = self.dup_molecule(arr)
Severity: Minor
Found in lib/rubabel/molecule/fragmentable/asms_2002_scheme2.rb - About 1 hr to fix

    Method jasms_2002_2_f1_bprime has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          ::Rule_names << def jasms_2002_2_f1_bprime(only_uniqs: true, fragment_adduct_state: :as_published)
            fragment_sets = []
            fragment = lambda do |*arr|
              # duplicate
              (nmol, (lost_oxygen, attacked_carbon, nitrogen)) = self.dup_molecule(arr)
    Severity: Minor
    Found in lib/rubabel/molecule/fragmentable/asms_2002_scheme2.rb - About 1 hr to fix

      Method jasms_2002_5_e1_water_loss has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            ::Rule_names << def jasms_2002_5_e1_water_loss(only_uniqs: true, fragment_adduct_state: :as_published)
              fragment_sets = []
              fragment = lambda do |*arr|
                # duplicate
                (nmol, (alcohol_carbon, alcohol_oxygen, attacked_carbon, lost_oxygen)) = self.dup_molecule(arr)
      Severity: Minor
      Found in lib/rubabel/molecule/fragmentable/asms_2002_scheme3-5.rb - About 1 hr to fix

        Method jasms_2002_3_b1 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              ::Rule_names << def jasms_2002_3_b1(only_uniqs: true, fragment_adduct_state: :as_published)
                fragment_sets = []
                fragment = lambda do |*arr|
                  # duplicate
                  (nmol, (alcohol_oxygen, alcohol_carbon, link_carbon, nitrogen, carbonyl, carbonyl_oxygen)) = self.dup_molecule(arr)
        Severity: Minor
        Found in lib/rubabel/molecule/fragmentable/asms_2002_scheme3-5.rb - About 1 hr to fix

          Method jasms_2002_4_g2a_prime has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                ::Rule_names << def jasms_2002_4_g2a_prime(only_uniqs: true, fragment_adduct_state: :as_published)
                  fragment_sets = []
                  fragment = lambda do |*arr|
                    # duplicate
                    (nmol, (alcohol_oxygen, alcohol_carbon, nitrogen)) = self.dup_molecule(arr)
          Severity: Minor
          Found in lib/rubabel/molecule/fragmentable/asms_2002_scheme3-5.rb - About 1 hr to fix

            Method jasms_2002_4_g2a_prime_water_loss has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  ::Rule_names << def jasms_2002_4_g2a_prime_water_loss(only_uniqs: true, fragment_adduct_state: :as_published)
                    fragment_sets = []
                    fragment = lambda do |*arr|
                      # duplicate
                      (nmol, (alcohol_oxygen, alcohol_carbon, ring_carbon)) = self.dup_molecule(arr)
            Severity: Minor
            Found in lib/rubabel/molecule/fragmentable/asms_2002_scheme3-5.rb - About 1 hr to fix

              Method nitrogen_cyclization has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    ::Rule_names << def nitrogen_cyclization
                      #TODO remove this next line
                      only_uniqs = true
                      fragment_sets = []
                      # Create a fragmentation block method
              Severity: Minor
              Found in lib/rubabel/molecule/fragmentable/nitrogen_cyclization_rule.rb - About 1 hr to fix

                Method carbonyl_oxygen_dump has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                      ::Rule_names << def carbonyl_oxygen_dump(only_uniqs: true, fragment_adduct_state: :as_published)
                        fragment_sets = []
                        only_uniqs = true
                        fragment = lambda do |carbon, oxygen, carbon_nbr|
                          appendage = oxygen.atoms.find {|a| a.el != :C }
                Severity: Minor
                Found in lib/rubabel/molecule/fragmentable/tamil_rules.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

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        fragment = lambda do |leaving_oxygen, attacked_carbon, anionic_oxygen|
                          # Duplication and mapping identity to new atoms
                          nmol = self.dup
                          leaving_group_oxygen = nmol.atom(leaving_oxygen.id)
                          product_carbon_to_link = nmol.atom(attacked_carbon.id)
                Severity: Minor
                Found in lib/rubabel/molecule/fragmentable/fragmentable_rule_example.rb and 1 other location - About 45 mins to fix
                lib/rubabel/molecule/fragmentable/paoc_rule.rb on lines 12..26

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 39.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        fragment = lambda do |leaving_oxygen, attacked_carbon, anionic_oxygen|
                          # Duplication and mapping identity to new atoms
                          nmol = self.dup
                          leaving_group_oxygen = nmol.atom(leaving_oxygen.id)
                          product_carbon_to_link = nmol.atom(attacked_carbon.id)
                Severity: Minor
                Found in lib/rubabel/molecule/fragmentable/paoc_rule.rb and 1 other location - About 45 mins to fix
                lib/rubabel/molecule/fragmentable/fragmentable_rule_example.rb on lines 15..29

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 39.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        fragment = lambda do |electrophile, center, center_nbr|
                          (nmol, (nele, ncarb, ncarb_nbr)) = self.dup_molecule([electrophile, center, center_nbr])
                          nmol.delete_bond(nele, ncarb)
                          ncarb_nbr.get_bond(ncarb) + 1
                          nmol.split
                Severity: Minor
                Found in lib/rubabel/molecule/fragmentable/tamil_rules.rb and 1 other location - About 25 mins to fix
                lib/rubabel/molecule/fragmentable/tamil_rules.rb on lines 12..16

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 31.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                  matches = q_lists.map.with_index do |list, i|
                    scores = list.map do |peak|
                      # finds closest match in the GS spectrum
                      closest_match = gold_standard_spectrum[gold_standard_spectrum.find_nearest_index(peak.first)]
                
                
                Severity: Minor
                Found in generate_comparison_scores.rb and 1 other location - About 25 mins to fix
                andromeda.rb on lines 54..60

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 31.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                    matches = q_lists.map.with_index do |list, i|
                      scores = list.map do |peak|
                        closest_match = gold_standard_spectrum[gold_standard_spectrum.find_nearest_index(peak.first)]
                        
                        #putsv "Potential problem with #{closest_match}: bigger peak nearby" if larger_peaks_nearby(gold_standard_spectrum, closest_match)
                Severity: Minor
                Found in andromeda.rb and 1 other location - About 25 mins to fix
                generate_comparison_scores.rb on lines 132..139

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 31.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        fragment = lambda do |electrophile, center, center_nbr|
                          (nmol, (nele, ncarb, ncarb_nbr)) = self.dup_molecule([electrophile, center, center_nbr])
                          nmol.delete_bond(nele, ncarb)
                          ncarb_nbr.get_bond(ncarb) + 1
                          nmol.split
                Severity: Minor
                Found in lib/rubabel/molecule/fragmentable/tamil_rules.rb and 1 other location - About 25 mins to fix
                lib/rubabel/molecule/fragmentable/tamil_rules.rb on lines 29..33

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 31.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Method jasms_2002_scheme1_c_e2aprime_formaldehyde_loss has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                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)
                Severity: Minor
                Found in lib/rubabel/molecule/fragmentable/asms_2002_scheme1.rb - About 25 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 create_bins has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def create_bins(true_values, comparison_values, bin_width: PPM_BIN_DEFAULT)
                  min, max = [true_values.minmax, comparison_values.minmax].flatten.minmax
                  divisions = []
                
                  puts "using bin width: #{bin_width}" if $VERBOSE
                Severity: Minor
                Found in generate_comparison_scores.rb - About 25 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

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        fragment = lambda do |carbon, oxygen|
                          nmol = self.dup
                          ncarbon = nmol.atom(carbon.id)
                          noxygen = nmol.atom(oxygen.id)
                          nmol.delete_bond(ncarbon, noxygen)
                Severity: Minor
                Found in lib/rubabel/molecule/fragmentable/tamil_rules.rb and 1 other location - About 20 mins to fix
                lib/rubabel/molecule/fragmentable/tamil_rules.rb on lines 44..51

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 28.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        fragment = lambda do |carbon, oxygen|
                          nmol = self.dup
                          ncarbon = nmol.atom(carbon.id)
                          noxygen = nmol.atom(oxygen.id)
                          nmol.delete_bond(ncarbon, noxygen)
                Severity: Minor
                Found in lib/rubabel/molecule/fragmentable/tamil_rules.rb and 1 other location - About 20 mins to fix
                lib/rubabel/molecule/fragmentable/tamil_rules.rb on lines 61..68

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 28.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language