bio-miga/miga

View on GitHub

Showing 1,599 of 1,613 total issues

Assignment Branch Condition size for test_ncbi_datasets_download_request is too high. [22.56/15]
Open

  def test_ncbi_datasets_download_request
    # No remote access needed
    rd = MiGA::RemoteDataset.new(
      'GCF_004684205.1', :genome, :ncbi_datasets_download
    )
Severity: Minor
Found in test/remote_dataset_test.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for helper_daemon_launch_job is too high. [22.02/15]
Open

  def helper_daemon_launch_job(project_i = 0)
    declare_forks
    d1 = daemon(project_i)
    helper_datasets_with_results(1, project_i).first.inactivate!
    assert_equal(0, d1.jobs_to_run.size, 'The queue should be empty')
Severity: Minor
Found in test/daemon_helper.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [17/10]
Open

  def test_flush
    d1 = daemon
    p1 = project
    helper_datasets_with_results
    p1.add_dataset(MiGA::Dataset.new(p1, 'd1').name)
Severity: Minor
Found in test/daemon_test.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [17/10]
Open

  def test_status
    d = dataset
    assert_equal(:ignore_empty, d.result_status(:trimmed_reads))
    d.add_result(:trimmed_reads)
    assert_equal(:-, d.result_status(:raw_reads))
Severity: Minor
Found in test/result_test.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for test_advance is too high. [22.8/15]
Open

  def test_advance
    m = MiGA::MiGA.new

    # Check advance when missing total and n
    o = capture_stderr { m.advance('x', 0) }.string
Severity: Minor
Found in test/common_test.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [17/10]
Open

  def daemon_loop
    l_say(3, 'Daemon loop start')
    reload_project
    check_datasets or check_project
    if shutdown_when_done? && (jobs_running.size + jobs_to_run.size).zero?
Severity: Minor
Found in lib/miga/daemon.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [17/10]
Open

    def aai_taxtest(aai, test, opts = {})
      meaning = {
        most_likely: [0.00, 0.01],
        probably: [0.01, 0.10],
        possibly_even: [0.10, 0.50]
Severity: Minor
Found in lib/miga/tax_dist.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for fix_essential_genes_by_domain is too high. [22.72/15]
Open

  def fix_essential_genes_by_domain
    return if file_path(:raw_report)

    tax = source.metadata[:tax]
    return unless tax.nil? || %w[Archaea Bacteria].include?(tax[:d])
Severity: Minor
Found in lib/miga/result/stats.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for create is too high. [22.65/15]
Open

  def create
    unless MiGA::MiGA.initialized?
      warn 'Projects cannot be processed yet, first run: miga init'
    end

Severity: Minor
Found in lib/miga/project.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for option_from_string is too high. [22.38/15]
Open

  def option_from_string(key, value)
    opt = assert_has_option(key)

    if ['', 'nil'].include?(value)
      nil
Severity: Minor
Found in lib/miga/common/with_option.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for download_file_ftp is too high. [22.83/15]
Open

  def download_file_ftp(connection, file = nil, target = nil)
    # Open connection unless passed
    close_conn = false
    if connection.is_a?(String) || connection.is_a?(Symbol) ||
          connection.is_a?(URI)
Severity: Minor
Found in lib/miga/common/net.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for load_result is too high. [22.72/15]
Open

  def load_result
    return @objects[:result] unless @objects[:result].nil?

    ensure_par(result: '-r')
    obj = load_project_or_dataset
Severity: Minor
Found in lib/miga/cli/objects_helper.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Cyclomatic complexity for load_and_filter_datasets is too high. [13/6]
Open

  def load_and_filter_datasets(silent = false)
    return @objects[:filtered_datasets] unless @objects[:filtered_datasets].nil?

    say 'Listing datasets'
    ds =
Severity: Minor
Found in lib/miga/cli/objects_helper.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Perceived complexity for load_and_filter_datasets is too high. [14/7]
Open

  def load_and_filter_datasets(silent = false)
    return @objects[:filtered_datasets] unless @objects[:filtered_datasets].nil?

    say 'Listing datasets'
    ds =
Severity: Minor
Found in lib/miga/cli/objects_helper.rb by rubocop

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

Assignment Branch Condition size for perform is too high. [22.56/15]
Open

  def perform
    dist = read_distances
    Dir.mktmpdir do |dir|
      tab = get_tab_index(dir)
      dist = traverse_taxonomy(tab, dist)
Severity: Minor
Found in lib/miga/cli/action/tax_dist.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [17/10]
Open

  def parse_reports_as_datasets(reports)
    ds = {}
    reports.each do |r|
      asm = r[:accession]
      next if asm.nil? || asm.empty? || asm == '-'

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [17/10]
Open

  def perform
    cli.ensure_par(tarball: '-o')
    unless cli[:tarball] =~ /\.tar\.gz$/
      raise 'The tarball path (-o) must have .tar.gz extension'
    end
Severity: Minor
Found in lib/miga/cli/action/archive.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [17/10]
Open

  def cli_task_flags(opt)
    cli.opt_flag(
      opt, 'reference',
      'Download all reference genomes (ignore any other status)'
    )

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for closest_relative_tax is too high. [22.83/15]
Open

  def closest_relative_tax(cr)
    cli.puts "Closest relative: #{cr[0]} with AAI: #{cr[1]}."
    p = cli.load_project
    if cli[:ref_project]
      if (ref = p.option(:ref_project)).nil?
Severity: Minor
Found in lib/miga/cli/action/tax_test.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [17/10]
Open

  def query_probability_distributions(d, cr)
    cli.say 'Querying probability distributions'
    tax = closest_relative_tax(cr)
    if %w[intax both].include? cli[:test]
      r = test_closest_relative(cr, tax, :intax)
Severity: Minor
Found in lib/miga/cli/action/tax_test.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Severity
Category
Status
Source
Language