wurmlab/GeneValidator

View on GitHub

Showing 132 of 132 total issues

Method multiple_align_mafft has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def multiple_align_mafft(prediction, hits)
      raise unless prediction.is_a?(Query) && hits[0].is_a?(Query)

      opt = ['--maxiterate', '1000', '--localpair', '--anysymbol', '--quiet',
             '--thread', @num_threads.to_s]
Severity: Minor
Found in lib/genevalidator/validation_alignment.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

Function addPlot has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  GV.addPlot = function (jsonData, target, type, title, footer, xtitle, ytitle, aux1, aux2) {
    var legend;
    if (footer === '') {
      legend = [];
    } else {
Severity: Minor
Found in aux/source_assets/js/plots.js - About 1 hr to fix

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

      Method plot_alignment has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def plot_alignment(freq, ma = @multiple_alignment)
            # get indeces of consensus in the multiple alignment
            consensus = get_consensus(ma[0..ma.length - 2])
            consensus_idxs = consensus.split(//).each_index.select { |j| isalpha(consensus[j]) }
            consensus_ranges = array_to_ranges(consensus_idxs)
      Severity: Minor
      Found in lib/genevalidator/validation_alignment.rb - About 1 hr to fix

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

            var yAxis = d3.svg.axis()
              .scale(y)
              .orient("left")
              .tickFormat(d3.format("d"))
              .ticks(8);
        Severity: Major
        Found in aux/source_assets/js/plots.js and 2 other locations - About 1 hr to fix
        aux/source_assets/js/plots.js on lines 399..403
        aux/source_assets/js/plots.js on lines 458..462

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

        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 3 locations. Consider refactoring.
        Open

            var yAxis = d3.svg.axis()
                          .scale(y)
                          .orient("left")
                          .tickFormat(d3.format("d"))
                          .ticks(8);
        Severity: Major
        Found in aux/source_assets/js/plots.js and 2 other locations - About 1 hr to fix
        aux/source_assets/js/plots.js on lines 280..284
        aux/source_assets/js/plots.js on lines 399..403

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

        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 3 locations. Consider refactoring.
        Open

            var yAxis = d3.svg.axis()
                          .scale(y)
                          .orient("left")
                          .tickFormat(d3.format("d"))
                          .ticks(8);
        Severity: Major
        Found in aux/source_assets/js/plots.js and 2 other locations - About 1 hr to fix
        aux/source_assets/js/plots.js on lines 280..284
        aux/source_assets/js/plots.js on lines 458..462

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

        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

        Function addPlot has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          GV.addPlot = function (jsonData, target, type, title, footer, xtitle, ytitle, aux1, aux2) {
        Severity: Major
        Found in aux/source_assets/js/plots.js - About 1 hr to fix

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

                if sd_y == 0
                  cond1_y = true
                  cond2_y = true
                  cond3_y = true
                else
          Severity: Major
          Found in lib/genevalidator/validation_gene_merge.rb and 1 other location - About 1 hr to fix
          lib/genevalidator/validation_gene_merge.rb on lines 308..315

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

          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 sd_x == 0
                  cond1_x = true
                  cond2_x = true
                  cond3_x = true
                else
          Severity: Major
          Found in lib/genevalidator/validation_gene_merge.rb and 1 other location - About 1 hr to fix
          lib/genevalidator/validation_gene_merge.rb on lines 323..330

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

          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 clusterization_by_length has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def clusterization_by_length(_debug = false,
                                           lst = @hits,
                                           predicted_seq = @prediction)
                raise TypeError unless lst[0].is_a?(Query) && predicted_seq.is_a?(Query)
          
          
          Severity: Minor
          Found in lib/genevalidator/validation_length_cluster.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 get_sm_pssm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_sm_pssm(ma, threshold = 0.7)
                sm = ''
                freq = []
                (0..ma[0].length - 1).each do |i|
                  freqs = Hash.new(0)
          Severity: Minor
          Found in lib/genevalidator/validation_alignment.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 conclude has 26 lines of code (exceeds 25 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 1 hr to fix

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

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

                  def initialize(message = 'Not enough evidence', validation_result = :no,
                                 short_header = '', header = '', description = '',
                                 approach = '', explanation = '', conclusion = '')
              Severity: Major
              Found in lib/genevalidator/validation_report.rb - About 1 hr to fix

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

                    def initialize(short_header, header, description, orfs, coverage,
                                   longest_orf_frame, threshold = 80, expected = :yes)
                Severity: Major
                Found in lib/genevalidator/validation_open_reading_frame.rb - About 1 hr to fix

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

                      def initialize(short_header, header, description, gaps = 0, extra_seq = 0,
                                     consensus = 1, threshold = 20, expected = :yes)
                  Severity: Major
                  Found in lib/genevalidator/validation_alignment.rb - About 1 hr to fix

                    Function plot_align has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      GV.plot_align = function (data, target, title, footer, xTitle, yTitle, no_lines, yValues) {
                    Severity: Major
                    Found in aux/source_assets/js/plots.js - About 1 hr to fix

                      Function plot_scatter has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        GV.plot_scatter = function (data, target, title, footer, xTitle, yTitle, yLine, slope) {
                      Severity: Major
                      Found in aux/source_assets/js/plots.js - About 1 hr to fix

                        Method overview_hash has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                              def overview_hash(scores_from_json, quartiles, nee, no_mafft, no_internet,
                                                map_errors, run_time, insufficient_BLAST_hits)
                        Severity: Major
                        Found in lib/genevalidator/output.rb - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language