princelab/mspire

View on GitHub

Showing 80 of 80 total issues

Method run has 36 lines of code (exceeds 25 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 1 hr to fix

    Method create_file_description has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_file_description(source_files, config)
          Mspire::Mzml::FileDescription.new  do |fd|
    
            fd.file_content = Mspire::Mzml::FileContent.new.describe_many!( [
              'MS:1000579', # MS1 Spectrum
    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 from_xml has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.from_xml(xml, link)
            obj = self.new(xml[:id])
            obj.spot_id = xml[:spotID]
    
            obj.data_processing = link[:data_processing_hash][xml[:dataProcessingRef]] || link[:spectrum_default_data_processing]
    Severity: Minor
    Found in lib/mspire/mzml/spectrum.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 12 (exceeds 5 allowed). Consider refactoring.
    Open

          def to_xml(builder, default_ids)
            io = builder.target!
    
            atts = data_array_xml_atts
            if @data_processing && default_ids[:spectrum_data_processing] != @data_processing.id 
    Severity: Minor
    Found in lib/mspire/mzml/spectrum.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 inverse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def inverse
        i = Hash.new
        self.each_pair do |k,v|
          if (Array === v) ; v.each{ |x| i[x] = ( i.has_key?(x) ? [k,i[x]].flatten : k ) }
          else ; i[v] = ( i.has_key?(v) ? [k,i[v]].flatten : k ) end
    Severity: Minor
    Found in lib/hash/inverse.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 peak_boundaries has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def peak_boundaries(gt=0.0)
          in_peak = false
          prev_y = gt
          prev_prev_y = gt
          peak_inds = []
    Severity: Minor
    Found in lib/mspire/peaklist.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 cmdline has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.cmdline(argv)
        opt = DEFAULT_PEPTIDE_CENTRIC_DB.dup
    
        opts = OptionParser.new do |op|
          op.banner = "usage: #{File.basename($0)} <file>.fasta ..."
    Severity: Minor
    Found in lib/mspire/ident/peptide/db/creator.rb - About 1 hr to fix

      Method split_contiguous has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def split_contiguous(methd=:greedy_y, local_min_indices=nil)
            local_min_indices ||= ((pb=peak_boundaries.first) && pb.shift && pb.pop && pb)
      
            if local_min_indices.size == 0
              self
      Severity: Minor
      Found in lib/mspire/peaklist.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 peptide_hits_to_protein_groups has a Cognitive Complexity of 11 (exceeds 5 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

      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_scan_to_index has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def create_scan_to_index
              scan_re = /scan=(\d+)/
                scan_to_index = {}
              ids.each_with_index do |id, index|
                md = id.match(scan_re)
      Severity: Minor
      Found in lib/mspire/mzml/index.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 describe_from_xml! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def describe_from_xml!(xml_node, ref_hash=nil)
              # TODO: this was merely cleaned up from Paramable and should be
              # re-factored
              return nil unless (child_n = xml_node.child) 
              loop do
      Severity: Minor
      Found in lib/mspire/cv/paramable.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 11 (exceeds 5 allowed). Consider refactoring.
      Open

        def to_xml(opts={})
          opts ||= {}
          if opts.is_a?(String) 
            opts = ( opts.match(/\.xml$/) ?  {:outfile => opts} : {:outdir => opts } )
          end
      Severity: Minor
      Found in lib/mspire/ident/pepxml.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 describe_from_xml! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def describe_from_xml!(xml_node, ref_hash=nil)
            return nil unless (child_n = xml_node.child) 
            loop do
              array = 
                case child_n.name
      Severity: Minor
      Found in lib/mspire/paramable.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 31 lines of code (exceeds 25 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 1 hr to fix

        Method to_binary has 30 lines of code (exceeds 25 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

          Method db_from_fasta_digestion_file has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def db_from_fasta_digestion_file(digestion_file, opts={})
              opts = DEFAULT_PEPTIDE_CENTRIC_DB.merge(opts)
          
              start_time = Time.now
              puts "Organizing raw digestion #{digestion_file} ..." if $VERBOSE
          Severity: Minor
          Found in lib/mspire/ident/peptide/db/creator.rb - About 1 hr to fix

            Method from_xml has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def self.from_xml(xml, link)
                    obj = self.new(xml[:id])
                    obj.spot_id = xml[:spotID]
            
                    obj.data_processing = link[:data_processing_hash][xml[:dataProcessingRef]] || link[:spectrum_default_data_processing]
            Severity: Minor
            Found in lib/mspire/mzml/spectrum.rb - About 1 hr to fix

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

                def self.simple_search_hits(file, &block)
                  hit_values = File.open(file) do |io|
                    doc = Nokogiri::XML.parse(io, nil, nil, Nokogiri::XML::ParseOptions::DEFAULT_XML | Nokogiri::XML::ParseOptions::NOBLANKS | Nokogiri::XML::ParseOptions::STRICT)
                    # we can work with namespaces, or just remove them ...
                    doc.remove_namespaces!
              Severity: Minor
              Found in lib/mspire/ident/pepxml.rb - About 1 hr to fix

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

                    def peak_boundaries(gt=0.0)
                      in_peak = false
                      prev_y = gt
                      prev_prev_y = gt
                      peak_inds = []
                Severity: Minor
                Found in lib/mspire/peaklist.rb - About 1 hr to fix

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

                      def split_contiguous(methd=:greedy_y, local_min_indices=nil)
                        local_min_indices ||= ((pb=peak_boundaries.first) && pb.shift && pb.pop && pb)
                  
                        if local_min_indices.size == 0
                          self
                  Severity: Minor
                  Found in lib/mspire/peaklist.rb - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language