princelab/mspire

View on GitHub

Showing 80 of 80 total issues

Method bin has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    def self.bin(bins, objects, *data_capture_obj, &block)
      data_capture = data_capture_obj.first || bins

      if objects.size > 0
        obj_e = objects.each ; obj = obj_e.next  
Severity: Minor
Found in lib/mspire/bin.rb - About 6 hrs 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_digestion_file has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  def create_digestion_file(fasta_file, opts={})
    opts = DEFAULT_PEPTIDE_CENTRIC_DB.merge(opts)

    (missed_cleavages, enzyme, cleave_initiator_methionine, expand_aa) = opts.values_at(:missed_cleavages, :enzyme, :cleave_initiator_methionine, :expand_aa) 
    start_time = Time.now
Severity: Minor
Found in lib/mspire/ident/peptide/db/creator.rb - About 4 hrs 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 write has 99 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def write(mzml_filenames, config={})

      base = config[:combine] || mzml_filenames.first.chomp(File.extname(mzml_filenames.first))
      config[:imzml_filename] = base + ".imzML"
      config[:ibd_filename] = base + ".ibd"
Severity: Major
Found in lib/mspire/imzml/writer.rb - About 3 hrs to fix

    Method merge_centroids has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

          def merge_centroids(peaklists, opts={})
            opts[:return_data] = true if opts[:only_data]
    
            # Create Mspire::Bin objects
            bins = opts[:bins] ? opts[:bins] : create_bins(peaklists, opts)
    Severity: Minor
    Found in lib/mspire/peaklist.rb - About 3 hrs 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 write has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def write(mzml_filenames, config={})
    
          base = config[:combine] || mzml_filenames.first.chomp(File.extname(mzml_filenames.first))
          config[:imzml_filename] = base + ".imzML"
          config[:ibd_filename] = base + ".ibd"
    Severity: Minor
    Found in lib/mspire/imzml/writer.rb - About 3 hrs 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

    File writer.rb has 304 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'nokogiri'
    require 'securerandom'
    require 'cv'
    require 'mspire/mzml'
    require 'mspire/mzml/spectrum'
    Severity: Minor
    Found in lib/mspire/imzml/writer.rb - About 3 hrs to fix

      Method hash_like_from_digestion_file has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

        def hash_like_from_digestion_file(digestion_file, min_length, data_type=:hash)
          case data_type
          when :trie
            trie = get_a_trie
            ::IO.foreach(digestion_file) do |line|
      Severity: Minor
      Found in lib/mspire/ident/peptide/db/creator.rb - About 3 hrs 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 from_xml has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.from_xml(xml, link)
          da = self.new 
          binary_n = da.describe_from_xml!(xml, link[:ref_hash])
      
          if (dp_id = xml[:dataProcessingRef])
      Severity: Minor
      Found in lib/mspire/mzml/data_array.rb - About 2 hrs 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 read_header! has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def read_header!(list_type_to_default_data_processing_id)
          @io.rewind
      
          string = get_header_string(@io)
          doc = Nokogiri::XML.parse(string, nil, @encoding, Mspire::Mzml::Parser::NOBLANKS)
      Severity: Major
      Found in lib/mspire/mzml/reader.rb - About 2 hrs to fix

        Method to_xml has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def to_xml(filename=nil)
              # TODO: support indexed mzml files
              io = filename ? File.open(filename, 'w') : StringIO.new
              xml = Builder::XmlMarkup.new(:target => io, :indent => 2)
              xml.instruct!
        Severity: Minor
        Found in lib/mspire/mzml.rb - About 2 hrs 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 parser has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.parser
            return @parser if @parser
        
            default_config = "config.yaml"
            scan_patterns = %w(flyback meandering random)
        Severity: Major
        Found in lib/mspire/imzml/writer/commandline.rb - About 2 hrs to fix

          Method run has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            def run(normalize=true, opts={})
              exe = executable
              puts "using #{exe}" if $VERBOSE
              executable_base = exe.split('-')[0]
          
          
          Severity: Minor
          Found in lib/mspire/quant/qspec.rb - About 2 hrs 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 hash_like_from_digestion_file has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def hash_like_from_digestion_file(digestion_file, min_length, data_type=:hash)
              case data_type
              when :trie
                trie = get_a_trie
                ::IO.foreach(digestion_file) do |line|
          Severity: Minor
          Found in lib/mspire/ident/peptide/db/creator.rb - About 1 hr to fix

            Method to_binary has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

              def to_binary
                # single pass over params for speed
                pack_code = nil
                compression = nil
                each_accessionable_param do |param|
            Severity: Minor
            Found in lib/mspire/mzml/data_array.rb - About 1 hr 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 x_y_positions has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def x_y_positions(config)
                  (scan_pattern, scan_type, scan_direction, scan_sequence, shots_per_pos) = config.values_at(:scan_pattern, :scan_type, :linescan_direction, :linescan_sequence, :shots_per_position).map(&:to_s)
                  shots_per_pos = shots_per_pos.to_i
                  #puts "EXAMIN ARGS: "
                  #p [ scan_pattern, scan_type, scan_direction, scan_sequence, shots_per_pos, shots_per_pos]
            Severity: Minor
            Found in lib/mspire/imzml/writer.rb - About 1 hr 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 to_xml has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def to_xml(builder=nil)
                xmlb = builder || Nokogiri::XML::Builder.new
                hash = {:base_name => base_name, :msManufacturer => ms_manufacturer, :msModel => ms_model, :msIonization => ms_ionization, :msMassAnalyzer => ms_mass_analyzer, :msDetector => ms_detector, :raw_data_type => raw_data_type, :raw_data => raw_data}
                hash.each {|k,v| hash.delete(k) unless v }
                xmlb.msms_run_summary(hash) do |xmlb|
            Severity: Minor
            Found in lib/mspire/ident/pepxml/msms_run_summary.rb - About 1 hr 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 image_hash_to_cvs has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def image_hash_to_cvs(hash)
                  cvs = []
                  cvs << case hash[:data_structure].to_sym
                  when :processed ; 'IMS:1000031'
                  when :continuous ; 'IMS:1000030'
            Severity: Minor
            Found in lib/mspire/imzml/writer.rb - About 1 hr to fix

              Method merge_centroids has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def merge_centroids(peaklists, opts={})
                      opts[:return_data] = true if opts[:only_data]
              
                      # Create Mspire::Bin objects
                      bins = opts[:bins] ? opts[:bins] : create_bins(peaklists, opts)
              Severity: Minor
              Found in lib/mspire/peaklist.rb - About 1 hr to fix

                Method create_digestion_file has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def create_digestion_file(fasta_file, opts={})
                    opts = DEFAULT_PEPTIDE_CENTRIC_DB.merge(opts)
                
                    (missed_cleavages, enzyme, cleave_initiator_methionine, expand_aa) = opts.values_at(:missed_cleavages, :enzyme, :cleave_initiator_methionine, :expand_aa) 
                    start_time = Time.now
                Severity: Minor
                Found in lib/mspire/ident/peptide/db/creator.rb - About 1 hr to fix

                  Method peptide_hits_to_protein_groups has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def self.peptide_hits_to_protein_groups(peptide_hits, update_peptide_hits=false, &sort_by)
                          update_peptide_hits = 'protein_groups='.to_sym if (update_peptide_hits==true)
                          sort_by ||= PRIORITIZE_PROTEINS
                          # note to self: I wrote this in 2011, so I think I know what I'm doing now
                          protein_to_peptides = Hash.new {|h,k| h[k] = Set.new }
                  Severity: Minor
                  Found in lib/mspire/ident/protein_group.rb - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language