princelab/mspire

View on GitHub
lib/mspire/ident/peptide/db/creator.rb

Summary

Maintainability
D
1 day
Test Coverage

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 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 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 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 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 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 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

          There are no issues that match your filters.

          Category
          Status