princelab/mspire

View on GitHub

Showing 80 of 80 total issues

Avoid deeply nested control flow statements.
Open

              value = (block.nil? ? obj : block.call(obj))
Severity: Major
Found in lib/mspire/bin.rb - About 45 mins to fix

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

      def num_tol_term(prev_aa, middle, next_aa)
        raise NotImplementedError, 'need to implement for N terminal sense'  if sense == 'N'
        no_cut = @no_cut || ''
        num_tol = 0
        last_of_middle = middle[-1,1]
    Severity: Minor
    Found in lib/mspire/ident/pepxml/sample_enzyme.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

    Consider simplifying this complex logical expression.
    Open

              if cbin.begin <= value
                until cbin === value && data_capture[bin_i] << obj
                  bin_i += 1
                  cbin=bins[bin_i] || (done=true && break)
                end
    Severity: Major
    Found in lib/mspire/bin.rb - About 40 mins to fix

      Method site_digest has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def site_digest(seq, max_misses=0, offset=0, length=seq.length-offset, &block) # :yields: start_index, end_index
      Severity: Minor
      Found in lib/mspire/digester.rb - About 35 mins to fix

        Method [] has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.[](*args)
                #puts "param args #{args.inspect}"
                unit = 
                  case args.size
                  when 1
        Severity: Minor
        Found in lib/mspire/cv/param.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def to_xml(builder)
                atts = { id: @id,
                  defaultInstrumentConfigurationRef: @default_instrument_configuration.id
                }
                atts[:defaultSourceFileRef] = @default_source_file.id if @default_source_file
        Severity: Minor
        Found in lib/mspire/mzml/run.rb - About 35 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 cleavage_sites has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def cleavage_sites(seq, offset=0, length=seq.length-offset)
              return [0, 1] if seq.size == 1  # adding exceptions is lame--algorithm should just work
        
              adjustment = cterm_cleavage ? 0 : 1
              limit = offset + length
        Severity: Minor
        Found in lib/mspire/digester.rb - About 35 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 args_to_hashes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.args_to_hashes(args, replicate_postfix="-rep")
            # groupname => files
            condition_to_samplenames = {}
            samplename_to_filename = {}
            args.each do |arg|
        Severity: Minor
        Found in lib/mspire/quant/cmdline.rb - About 35 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 get_header_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def get_header_string(io)
            chunk_size = 2**12
            loc = 0
            string = ''
            while chunk = @io.read(chunk_size)
        Severity: Minor
        Found in lib/mspire/mzml/reader.rb - About 35 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 num_missed_cleavages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def num_missed_cleavages(aaseq)
            seq_to_scan = '  ' + aaseq + '  ' 
            raise NotImplementedError, 'need to implement for N terminal sense'  if sense == 'N'
            @num_missed_cleavages_regex = 
              if @num_missed_cleavages_regex ; @num_missed_cleavages_regex
        Severity: Minor
        Found in lib/mspire/ident/pepxml/sample_enzyme.rb - About 35 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 write_binary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def write_binary(filename, spectra_iterator, config)
              config = DEFAULTS.merge(config)
              raise ":data_structure must be :continuous or :processed" unless [:processed, :continuous].include?(config[:data_structure])
              (mz_dtype, mz_prec, int_dtype, int_prec) = config.values_at(:mz_data_type, :mz_precision, :intensity_data_type, :intensity_precision)
              mz_prec_in_bytes = mz_prec / 8
        Severity: Minor
        Found in lib/mspire/imzml/writer.rb - About 35 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 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.from_xml(xml, link)
                scan_list = self.new
                scan_n = scan_list.describe_from_xml!(xml, link[:ref_hash])
                if scan_n
                  loop do
        Severity: Minor
        Found in lib/mspire/mzml/scan_list.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 from_xml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.from_xml(io, xml, link)
        
                # expects that the DataProcessing objects to link to have *already* been
                # parsed (parse the defaultDataProcessingRef's after grabbing the
                # index, then grab the DataProcessing object associated with that id).
        Severity: Minor
        Found in lib/mspire/mzml/run.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def initialize(*args)
              self.unit = 
                if args.size > 1 && ((args.last.is_a?(::CV::Param) || args.last =~ /^[A-Za-z]+:\d+$/))
                  unit_arg = args.pop
                  unit_arg.is_a?(::CV::Param) ? unit_arg : Mspire::CV::Param[unit_arg]
        Severity: Minor
        Found in lib/mspire/user_param.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.run(argv)
        
              parser = Trollop::Parser.new do
                banner "usage: mspire <subcommand> [OPTIONS]"
                text ""
        Severity: Minor
        Found in lib/mspire/commandline.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 split has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def split(split_multipeaks_mthd=:zero)
              if split_multipeaks_mthd == :zero
                split_on_zeros
              else
                boundaries = peak_boundaries(0.0)
        Severity: Minor
        Found in lib/mspire/peaklist.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 cast_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def cast_method
              xref = @tagvalues['xref'].first
              @cast_method = 
                if xref.nil? || (@cast_method == false)
                  false
        Severity: Minor
        Found in lib/obo/ontology.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 write_data_array has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def write_data_array(fh, values, dtype=:float, precision=32)
              pack_code = 
                case dtype
                when :float
                  precision == 64 ? 'E*' : 'e*'
        Severity: Minor
        Found in lib/mspire/imzml/writer.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 experiment_hash_to_cvs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def experiment_hash_to_cvs(hash)
              cvs = { 
                :matrix_solution_concentration => "MS:1000835",
                :matrix_solution => "MS:1000834",
                :solvent => 'IMS:1001211',
        Severity: Minor
        Found in lib/mspire/imzml/writer.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 write has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def write(filename=nil, ascii=false)
              if ascii
                write_ascii(filename)
              else
                write_file_or_string(filename) do |out|
        Severity: Minor
        Found in lib/mspire/plms1.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

        Severity
        Category
        Status
        Source
        Language