wurmlab/GeneValidator

View on GitHub

Showing 74 of 132 total issues

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

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

    def run
      raise unless prediction.is_a?(Query)

      start  = Time.now

Severity: Minor
Found in lib/genevalidator/validation_maker_qi.rb - About 25 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 length_validation_scores has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def length_validation_scores(validations, scores)
      lcv = validations.select { |v| v.class == LengthClusterValidationOutput }
      lrv = validations.select { |v| v.class == LengthRankValidationOutput }
      if lcv.length == 1 && lrv.length == 1
        score_lcv = (lcv[0].result == lcv[0].expected)
Severity: Minor
Found in lib/genevalidator/validation.rb - About 25 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_csv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def write_csv
      return unless @opt[:output_formats].include? 'csv'
      File.open(@dirs[:csv_file], 'a') do |file|
        file.puts csv_header.join(',')
        @json_data.each do |data|
Severity: Minor
Found in lib/genevalidator/output_files.rb - About 25 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 remove_isolated_residues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def remove_isolated_residues(seq, len = 2)
      gap_starts = seq.to_enum(:scan, /(-\w{1,#{len}}-)/i).map { |_m| $`.size + 1 }
      # remove isolated residues
      gap_starts.each do |i|
        (i..i + len - 1).each { |j| seq[j] = '-' if isalpha(seq[j]) }
Severity: Minor
Found in lib/genevalidator/validation_alignment.rb - About 25 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 iterate_tabular has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def iterate_tabular(file, db_type)
        table_headers = opt[:blast_tabular_options].split(/[ ,]/)
        tab_file      = File.read(opt[:blast_tabular_file])
        rows = CSV.parse(tab_file, col_sep: "\t",
                                   skip_lines: /^#/,
Severity: Minor
Found in lib/genevalidator/get_raw_sequences.rb - About 25 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 extract_from_local_db has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def extract_from_local_db(batch, accno = nil, idx_file = nil)
        efile = Tempfile.new('blast_out')
        cmd = batch ? batch_raw_seq_cmd(idx_file) : single_raw_seq_cmd(accno, efile.path)
        `#{cmd}`
        raw_seqs = batch ? File.read(opt[:raw_sequences]) : efile.read
Severity: Minor
Found in lib/genevalidator/get_raw_sequences.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

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

      def run_blast_on_input_file
        remote = opt[:db].match?(/remote/) ? true : false
        print_blast_info_text(remote)

        log_file = File.join(dirs[:tmp_dir], 'blast_cmd_output.txt')
Severity: Minor
Found in lib/genevalidator/blast.rb - About 25 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