bio-miga/miga

View on GitHub

Showing 1,599 of 1,613 total issues

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

  def perform
    # Input data
    norun = %w[
      project_stats haai_distances aai_distances ani_distances clade_finding
    ]
Severity: Minor
Found in lib/miga/cli/action/quality_wf.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. [19/10]
Open

  def check_mytaxa_database(paths)
    cli.print 'Looking for MyTaxa DB... '
    mt = File.dirname(paths['MyTaxa'])
    dmnd_db = 'AllGenomes.faa.dmnd'
    miga_db = File.join(ENV['MIGA_HOME'], '.miga_db')

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. [19/10]
Open

  def opt_object_type(opt, obj, multi)
    conf =
      case obj
      when :dataset
        ['type', 'datasets', :dataset_type, MiGA::Dataset]
Severity: Minor
Found in lib/miga/cli/action/wf.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.

Perceived complexity for perform is too high. [16/7]
Open

  def perform
    # Load environment variables if requested (typically by the daemon)
    if cli[:env]
      cli[:project] ||= ENV['PROJECT']
      cli[:dataset] ||= ENV['DATASET']
Severity: Minor
Found in lib/miga/cli/action/run.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 create_remote_dataset is too high. [24.92/15]
Open

  def create_remote_dataset(sub_cli, p)
    sub_cli.ensure_par(dataset: '-D', ids: '-I')
    unless sub_cli[:api_key].nil?
      if sub_cli[:universe] == :web && sub_cli[:db] == :assembly_gz
        ENV['NCBI_API_KEY'] = sub_cli[:api_key]
Severity: Minor
Found in lib/miga/cli/action/get.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 unarchive is too high. [24.41/15]
Open

  def unarchive(file, db_name)
    cli.say "Unarchiving #{file}"
    tmp_archive = File.join(cli[:local], '.TMP_ARCHIVE')
    FileUtils.mkdir_p(tmp_archive)
    MiGA::MiGA.run_cmd <<~CMD
Severity: Minor
Found in lib/miga/cli/action/db.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. [19/10]
Open

  def list_local
    local_manif = local_manifest
    raise "Local manifest not found." unless local_manif
    databases =
      if %i[recommended test].include?(cli[:database])
Severity: Minor
Found in lib/miga/cli/action/db.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. [19/10]
Open

    def ncbi_gb_get(opts)
      # Simply use defaults, but ensure that the URL can be properly formed
      o = download_rest(opts.merge(universe: :ncbi, db: :nuccore))
      return o unless o.strip.empty?

Severity: Minor
Found in lib/miga/remote_dataset/download.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.

Class Daemon has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

class MiGA::Daemon < MiGA::MiGA
  include MiGA::Daemon::Base
  include MiGA::Common::WithDaemon
  extend MiGA::Common::WithDaemonClass

Severity: Minor
Found in lib/miga/daemon.rb - About 2 hrs to fix

Method parse_cli has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def parse_cli
    cli.defaults = { daemon_opts: [], show_log: false }
    cli.expect_operation = true
    cli.parse do |opt|
      opt.separator 'Available operations:'
Severity: Major
Found in lib/miga/cli/action/daemon.rb - About 2 hrs to fix

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

  def test_cds
    # Prepare result
    dir = 'data/06.cds'
    fa = file_path(dir, '.faa')
    File.open(fa, 'w') { |fh| fh.puts '>1', 'M' }
Severity: Minor
Found in test/result_stats_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_ncbi_datasets_request is too high. [23.35/15]
Open

  def test_ncbi_datasets_request
    rd = MiGA::RemoteDataset.new({ taxons: 'Bos' }, :genome, :ncbi_datasets)
    u = rd.download_uri
    h = rd.download_headers
    p = rd.download_payload
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 test_options is too high. [23.02/15]
Open

  def test_options
    d1 = daemon
    assert_respond_to(d1, :default_options)
    assert_equal(:normal, d1.default_options[:dir_mode])
    assert_equal(2, d1.runopts(:latency))
Severity: Minor
Found in test/daemon_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 test_set_bool is too high. [23.02/15]
Open

  def test_set_bool
    o = TestWithOption.new
    assert_nil(o.option(:bool))
    assert(!o.saved)
    assert_raise { o.set_option(:bool, 'true') }
Severity: Minor
Found in test/with_option_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. [18/10]
Open

  def test_daemon_launch
    lair = MiGA::Lair.new(tmpfile('sub'), latency: 1)
    p = MiGA::Project.load(File.join(lair.path, 'project3'))
    d = MiGA::Daemon.new(p)
    assert_not_predicate(d, :active?)
Severity: Minor
Found in test/lair_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_load is too high. [23.19/15]
Open

  def test_load
    md1 = MiGA::Metadata.new(tmpfile('md_load.json'), { t: 1 })
    assert_equal(1, md1[:t])

    declare_forks
Severity: Minor
Found in test/metadata_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 test_terminate is too high. [23.02/15]
Open

  def test_terminate
    d = daemon
    assert_not_predicate(d, :active?)
    assert_path_not_exist(d.alive_file)
    assert_path_not_exist(d.terminated_file)
Severity: Minor
Found in test/daemon_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 test_dataset_result_hooks is too high. [23.54/15]
Open

  def test_dataset_result_hooks
    $res = :test
    $counter = 1
    dataset.add_hook(:on_result_ready, :run_lambda, Proc.new { |r| $res = r })
    dataset.add_hook(
Severity: Minor
Found in test/hook_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. [18/10]
Open

  def test_aai_pvalues
    distant_intax = MiGA::TaxDist.aai_pvalues(35.0, :intax)
    assert_lt(distant_intax[:root], 0.05)
    assert_gt(distant_intax[:g], 0.05)
    assert_nil(distant_intax[:ns])
Severity: Minor
Found in test/tax_dist_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. [18/10]
Open

  def test_reset
    tx = MiGA::Taxonomy.new(
      'ns:Letters d:Latin s:A', nil,
      ['ns:Words d:English s:A', 'ns:Music d:Tone s:A']
    )
Severity: Minor
Found in test/taxonomy_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