princelab/mspire

View on GitHub

Showing 80 of 80 total issues

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

    Method create_bins has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def create_bins(peaklists, opts)
            min, max = min_max_x(peaklists)
    
            divisions = []
            bin_width = opts[:bin_width]
    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 in_groups has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def in_groups(number, fill_with = nil)
        # size / number gives minor group size;
        # size % number gives how many objects need extra accomodation;
        # each group hold either division or division + 1 items.
        division = size / number
    Severity: Minor
    Found in lib/core_ext/array/in_groups.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 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.from_xml(xml, link)
            ref_hash = link[:ref_hash]
            file_content_n = xml.child
            obj = self.new( Mspire::Mzml::FileContent.new.describe_self_from_xml!(file_content_n, ref_hash) )
    
    
    Severity: Minor
    Found in lib/mspire/mzml/file_description.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 mixed_target_decoy has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def mixed_target_decoy(best_to_worst, target_setlike, opts={})
            opts = {:monotonic => true}.merge(opts)
            num_target = 0 ; num_decoy = 0
            monotonic = opts[:monotonic]
            sorted_target_hits = []
    Severity: Minor
    Found in lib/mspire/error_rate/qvalue.rb - About 1 hr to fix

      Method db_from_fasta_digestion_file has a Cognitive Complexity of 9 (exceeds 5 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 55 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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def initialize(arg=nil, opts={})
              @peptide_hits = []
              @reference_hash = {}
              @searches = []
      
      
      Severity: Minor
      Found in lib/mspire/ident/search.rb - About 55 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 to_xml has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def to_xml(builder)
              atts = {}
              if @source_file
                atts[:sourceFileRef] = @source_file.id
                atts[:externalSpectrumRef] = @spectrum_id
      Severity: Minor
      Found in lib/mspire/mzml/precursor.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

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

            def mixed_target_decoy(best_to_worst, target_setlike, opts={})
              opts = {:monotonic => true}.merge(opts)
              num_target = 0 ; num_decoy = 0
              monotonic = opts[:monotonic]
              sorted_target_hits = []
      Severity: Minor
      Found in lib/mspire/error_rate/qvalue.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

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

          def scan(seq, offset, limit, &block) # :nodoc:
            scanner.string = seq
            scanner.pos = offset
      
            while scanner.search_full(cleave_regexp, true, false)
      Severity: Minor
      Found in lib/mspire/digester.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

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

          def select_indices(range, exclude_begin=false)
            indices = []
            _mzs = mzs
            lo_i = _mzs.bsearch_lower_boundary {|v| v <=> range.begin }
            return indices unless lo_i
      Severity: Minor
      Found in lib/mspire/spectrum_like.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

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

            def to_xml(builder, default_ids)
              atts = data_array_xml_atts
              if @data_processing && default_ids[:chromatogram_data_processing] != @data_processing.id 
                atts[:dataProcessingRef] = @data_processing.id 
              end
      Severity: Minor
      Found in lib/mspire/mzml/chromatogram.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

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

            def to_xml(builder, default_ids)
              atts = {}
              if @from_external_source_file
                atts[:sourceFileRef] = @spectrum.source_file.id
                atts[:externalSpectrumRef] = @spectrum.id
      Severity: Minor
      Found in lib/mspire/mzml/scan.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

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

            def min_max_x(peaklists)
              # find the min and max across all spectra
              first_peaklist = peaklists.first
              min = first_peaklist.first.x; max = first_peaklist.last.x
              peaklists.each do |peaklist|
      Severity: Minor
      Found in lib/mspire/peaklist.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

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

          def to_plms1(use_scan_nums=true)
            spectrum_index = self.index_list[:spectrum]
      
            scan_nums = spectrum_index.create_scan_to_index.keys if use_scan_nums
      
      
      Severity: Minor
      Found in lib/mspire/mzml/plms1.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

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

        def self.run(argv, globalopts=[])
          begin
            opts = parser.parse(argv)
          rescue Trollop::HelpNeeded
            return parser.educate
      Severity: Minor
      Found in lib/mspire/imzml/writer/commandline.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

      Avoid deeply nested control flow statements.
      Open

                    obj=obj_e.next rescue done=true && break
      Severity: Major
      Found in lib/mspire/bin.rb - About 45 mins to fix

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

          def to_xml(builder=nil)
            # TODO: out_data and out_data_type are optional in later pepxml versions...
            # should work that in...
            attrs = [:base_name, :search_engine, :precursor_mass_type, :fragment_mass_type, :out_data_type, :out_data, :search_id]
            hash = Hash[ attrs.map {|at| v=send(at) ; [at, v] if v }.compact ]
        Severity: Minor
        Found in lib/mspire/ident/pepxml/search_summary.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

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

              def self.from_xml(xml, link)
                obj = self.new(xml[:id])
                next_n = obj.describe_from_xml!(xml, link[:ref_hash])
                if next_n && (next_n.name == 'componentList')
                  obj.components = next_n.children.map do |component_n|
        Severity: Minor
        Found in lib/mspire/mzml/instrument_configuration.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

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

              def self.from_xml(xml, link)
                obj = self.new(xml[:id])
        
                obj.data_processing = link[:data_processing_hash][xml[:dataProcessingRef]] || link[:spectrum_default_data_processing]
        
        
        Severity: Minor
        Found in lib/mspire/mzml/chromatogram.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

        Severity
        Category
        Status
        Source
        Language