bio-miga/miga

View on GitHub

Showing 838 of 1,651 total issues

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

  def perform
    cr = []
    cli.load_and_filter_datasets.each do |d|
      d_cr = d.closest_relatives(cli[:how_many], cli[:external], cli[:metric])
      d_cr ||= []
Severity: Minor
Found in lib/miga/cli/action/relatives.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 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 save_bidirectional(a, dist)
    each_database_file(a) do |db_file, metric, result, rank|
      next if rank == :haai # No need for hAAI to be bidirectional
      next if result == :taxonomy # Taxonomy is never bidirectional

Severity: Minor
Found in lib/miga/cli/action/doctor/base.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 configure_bash_daemon is too high. [24.7/15]
Open

  def configure_bash_daemon(v)
    v[:latency] = cli.ask_user('How long should I sleep? (in secs)', '2').to_i
    v[:maxjobs] = cli.ask_user('How many jobs can I launch at once?', '6').to_i
    v[:ppn]     = cli.ask_user('How many CPUs can I use per job?', '2').to_i
    v[:nodelist] = nil # <- To enable non-default with default SSH

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 merge_bidir_tmp_cell(dist_x, dist_y)
    # Find missing values
    dist = {}
    datasets = Set.new
    dist_x.each do |metric, distances_x|

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 merge_bidir_tmp_cell is too high. [24.82/15]
Open

  def merge_bidir_tmp_cell(dist_x, dist_y)
    # Find missing values
    dist = {}
    datasets = Set.new
    dist_x.each do |metric, distances_x|

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

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.

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

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

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' * 500) }
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_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.

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