wurmlab/GeneValidator

View on GitHub

Showing 74 of 132 total issues

Method run_validations has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def run_validations(iterator)
      p = Pool.new(@opt[:num_threads]) if @opt[:num_threads] > 1

      check_if_maker_input?

Severity: Minor
Found in lib/genevalidator/validation.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 run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def run(hits = @hits, prediction = @prediction)
      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_rank.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 initialize has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(short_header, header, description, msg, query_length,
                   no_of_hits, median, mean, smallest_hit, largest_hit,
                   extreme_hits, percentage)
Severity: Major
Found in lib/genevalidator/validation_length_rank.rb - About 1 hr to fix

    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

          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

            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

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

                              GV.plot_lines = 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

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

                                    def run(identifier, accession)
                                      # first try to extract from previously created raw_sequences HASH
                                      raw_seq = extract_from_index(accession) if opt[:raw_sequences]
                                      # then try to just extract that sequence based on accession.
                                      if opt[:db] !~ /remote/ && (raw_seq.nil? || raw_seq =~ /Error/i)
                              Severity: Minor
                              Found in lib/genevalidator/get_raw_sequences.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

                              Severity
                              Category
                              Status
                              Source
                              Language