wurmlab/GeneValidator

View on GitHub

Showing 132 of 132 total issues

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def wss(objects = nil)
      if objects.nil?
        objects = @objects.map { |x| Array.new(x[1], x[0]) }.flatten
      end

Severity: Minor
Found in lib/genevalidator/clusterization.rb and 1 other location - About 45 mins to fix
lib/genevalidator/clusterization.rb on lines 215..225

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 40.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      case 'align':
        if (aux2 !== null) {
          aux2 = aux2.split(',');
        }
        GV.plot_align(jsonData, target, title, legend, xtitle, ytitle, aux1, aux2);
Severity: Minor
Found in aux/source_assets/js/plots.js and 1 other location - About 40 mins to fix
aux/source_assets/js/plots.js on lines 196..201

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      case 'lines':
        if (aux2 !== null) {
          aux2 = aux2.split(',');
        }
        GV.plot_lines(jsonData, target, title, legend, xtitle, ytitle, aux1, aux2);
Severity: Minor
Found in aux/source_assets/js/plots.js and 1 other location - About 40 mins to fix
aux/source_assets/js/plots.js on lines 202..207

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        var x = d3.scale.linear()
          .domain([xMin-padding, xMax+padding])
          .range([13, width]);
    Severity: Minor
    Found in aux/source_assets/js/plots.js and 1 other location - About 40 mins to fix
    aux/source_assets/js/plots.js on lines 390..392

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 48.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        var x = d3.scale.linear()
                  .domain([xMin-padding, xMax+padding])
                  .range([13, width]);
    Severity: Minor
    Found in aux/source_assets/js/plots.js and 1 other location - About 40 mins to fix
    aux/source_assets/js/plots.js on lines 271..273

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 48.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                  if (json.validations[i].graphs !== undefined) {
                    GV.generatePlotCommands(json.validations[i].graphs, target);
                  }
        Severity: Minor
        Found in aux/source_assets/js/plots.js and 1 other location - About 35 mins to fix
        aux/source_assets/js/plots.js on lines 149..151

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                if (json.validations[val].graphs !== undefined) {
                  GV.generatePlotCommands(json.validations[val].graphs, target);
                }
        Severity: Minor
        Found in aux/source_assets/js/plots.js and 1 other location - About 35 mins to fix
        aux/source_assets/js/plots.js on lines 143..145

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

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

            def copy_raw_seq_files(prev_tmp_dir)
              return if @opt[:raw_sequences]
              return unless @opt[:validations].include?('align') ||
                            @opt[:validations].include?('dup')
              prev_raw_seq = Dir[File.join(prev_tmp_dir, '*raw_seq')]
        Severity: Minor
        Found in lib/genevalidator.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 unimodality_test has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def unimodality_test(xx, yy)
              mean_x = xx.mean
              median_x = xx.median
              mode_x = xx.mode
              sd_x = xx.standard_deviation
        Severity: Minor
        Found in lib/genevalidator/validation_gene_merge.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 check_validations_output has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def check_validations_output(vals)
              raise NoValidationError if @run_output.validations.empty?
              vals.each do |v|
                raise ReportClassError unless v.validation_report.is_a? ValidationReport
              end
        Severity: Minor
        Found in lib/genevalidator/validation.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 validation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def validation
              # chack if there are different reading frames
              count_p = 0
              count_n = 0
              frames.each do |x, _y|
        Severity: Minor
        Found in lib/genevalidator/validation_blast_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

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

            def create_validation_hash(row)
              row[:validations] = {}
              @validations.each do |item|
                val     = add_basic_validation_info(item)
                explain = add_explanation_data(item) if item.color != 'warning'
        Severity: Minor
        Found in lib/genevalidator/output.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_an_index_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def write_an_index_file(output_file, db_type)
                file = File.open(output_file, 'w+')
                iterate_xml(file, db_type) if opt[:blast_xml_file]
                iterate_tabular(file, db_type) if opt[:blast_tabular_file]
              rescue BLASTDBError
        Severity: Minor
        Found in lib/genevalidator/get_raw_sequences.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