wurmlab/GeneValidator

View on GitHub

Showing 74 of 132 total issues

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

    def run(lst = @hits)
      if type.to_s != 'nucleotide'
        @validation_report = ValidationReport.new('', :unapplicable)
        return @validation_report
      end
Severity: Minor
Found in lib/genevalidator/validation_blast_reading_frame.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 check_multiple_coverage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def check_multiple_coverage(hit_alignment, query_alignment, hsp, coverage,
                                ranges_prediction)
      # for each hsp of the curent hit
      # iterate through the alignment and count the matching residues
      [*(0..hit_alignment.length - 1)].each do |i|
Severity: Minor
Found in lib/genevalidator/validation_duplication.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 calculate_run_time has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def calculate_run_time(json_data)
        run_time = Hash.new(Pair1.new(0, 0))
        json_data.map do |row|
          row[:validations].each do |short_header, v|
            next if v[:run_time].nil? || v[:run_time].zero?
Severity: Minor
Found in lib/genevalidator/output.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

Function plot_bars has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  GV.plot_bars = function (alldata, target, title, footer, xTitle, yTitle, bar) {
Severity: Major
Found in aux/source_assets/js/plots.js - About 50 mins to fix

    Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(short_header, header, description, pvalue, averages,
                       threshold = 0.05, expected = :yes)
    Severity: Major
    Found in lib/genevalidator/validation_duplication.rb - About 50 mins to fix

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

            def iterate_xml(file, db_type)
              n = Bio::BlastXMLParser::XmlIterator.new(opt[:blast_xml_file]).to_enum
              n.each do |iter|
                iter.each do |hit|
                  raise BLASTDBError if hit.hit_id =~ /\|BL_ORD_ID\|/
      Severity: Minor
      Found in lib/genevalidator/get_raw_sequences.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(short_header, header, description, splice_sites, exons,
                         expected = :yes)
      Severity: Minor
      Found in lib/genevalidator/validation_maker_qi.rb - About 45 mins to fix

        Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def initialize(short_header, header, description, query_length, limits,
                           expected = :yes)
        Severity: Minor
        Found in lib/genevalidator/validation_length_cluster.rb - About 45 mins to fix

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

              def conclude
                if @result == :yes
                  'There is no evidence based on the top 10 BLAST hits to suggest any' \
                  ' problems with the query sequence.'
                else
          Severity: Minor
          Found in lib/genevalidator/validation_alignment.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 check_validations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_validations(vals)
                # check the class type of the elements in the list
                vals.each { |v| raise ValidationClassError unless v.is_a? ValidationTest }
                # check alias duplication
                aliases = vals.map(&:cli_name)
          Severity: Minor
          Found in lib/genevalidator/validation.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 conclude has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def conclude
                if @unimodality
                  'This suggest that the query sequence represents a single gene.'
                else
                  diff = @result == :yes ? ' within' : ' outside'
          Severity: Minor
          Found in lib/genevalidator/validation_gene_merge.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

          Function plot_simple_bars has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            GV.plot_simple_bars = function (alldata, target, title, footer, xTitle, yTitle) {
          Severity: Minor
          Found in aux/source_assets/js/plots.js - About 45 mins to fix

            Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def initialize(short_header, header, description, slope, unimodality,
                               expected = :no)
            Severity: Minor
            Found in lib/genevalidator/validation_gene_merge.rb - About 45 mins to fix

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

                    def general_overview(o)
                      good_pred = o[:good_scores] == 1 ? 'One' : "#{o[:good_scores]} are"
                      bad_pred  = o[:bad_scores] == 1 ? 'One' : "#{o[:bad_scores]} are"
              
                      plural = 'prediction was' if o[:insufficient_BLAST_hits] == 1
              Severity: Minor
              Found in lib/genevalidator/output.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 run
                    # Run BLAST on all sequences (generates @opt[:blast_xml_file])
                    # if no BLAST OUTPUT file provided...
                    unless @opt[:blast_xml_file] || @opt[:blast_tabular_file]
                      blast_xml_fname = "#{dirs[:filename]}.blast_xml"
              Severity: Minor
              Found in lib/genevalidator.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 cond1_x && cond2_x && cond3_x && cond1_y && cond2_y && cond3_y
                      true
                    else
                      false
                    end
              Severity: Major
              Found in lib/genevalidator/validation_gene_merge.rb - About 40 mins to fix

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

                    def check_multiple_coverage(hit_alignment, query_alignment, hsp, coverage,
                                                ranges_prediction)
                Severity: Minor
                Found in lib/genevalidator/validation_duplication.rb - About 35 mins to fix

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

                      def initialize(short_header, header, description, frames,
                                     expected = :yes)
                  Severity: Minor
                  Found in lib/genevalidator/validation_blast_reading_frame.rb - About 35 mins to fix

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

                        def run
                          raise NotEnoughHitsError if hits.length < opt[:min_blast_hits]
                          raise unless prediction.is_a?(Query) && hits[0].is_a?(Query)
                    
                          start = Time.now
                    Severity: Minor
                    Found in lib/genevalidator/validation_length_cluster.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_orfs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_orfs(_orf_length = 100, prediction = @prediction)
                          '-' if prediction.type != 'nucleotide'
                    
                          seq = Bio::Sequence::NA.new(prediction.raw_sequence)
                    
                    
                    Severity: Minor
                    Found in lib/genevalidator/validation_open_reading_frame.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

                    Severity
                    Category
                    Status
                    Source
                    Language