bio-miga/miga

View on GitHub

Showing 1,637 of 1,651 total issues

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

  def perform
    # Input data
    ref_db = reference_db
    norun = %w[
      haai_distances aai_distances ani_distances clade_finding
Severity: Minor
Found in lib/miga/cli/action/classify_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 add_metadata has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def add_metadata(obj, cli = self)
    raise "Unsupported object: #{obj.class}" unless obj.respond_to? :metadata

    (cli[:metadata] || '').split(',').each do |pair|
      (k, v) = pair.split('=')
Severity: Minor
Found in lib/miga/cli/objects_helper.rb - About 2 hrs 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 parse_cli has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

  def parse_cli
    cli.defaults = {
      query: false, universe: :ncbi, db: :nuccore, get_md: false, only_md: false
    }
    cli.parse do |opt|
Severity: Major
Found in lib/miga/cli/action/get.rb - About 2 hrs to fix

Method has too many lines. [20/10]
Confirmed

  def test_import_dataset
    p1 = project
    d = p1.add_dataset('d1')
    File.open(
      File.join(p1.path, 'data', '01.raw_reads', "#{d.name}.1.fastq"), 'w'
Severity: Minor
Found in test/project_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. [20/10]
Open

  def test_daemon_operations
    d = TestWithDaemon.new(tmpdir)
    FileUtils.touch(d.output_file)
    assert_not_predicate(d, :active?)

Severity: Minor
Found in test/with_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.

Assignment Branch Condition size for test_flush is too high. [25.5/15]
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 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_in_loop is too high. [25.32/15]
Open

  def test_in_loop
    p = project
    d = daemon
    d.runopts(:latency, 0, true)
    assert_nil(d.loop_i)
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 check_datasets is too high. [25.46/15]
Open

  def check_datasets
    l_say(2, 'Checking datasets')
    o = false
    project.each_dataset do |ds|
      next unless ds.status == :incomplete
Severity: Minor
Found in lib/miga/daemon.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. [20/10]
Confirmed

    def ncbi_asm_acc2id(acc, retrials = 3)
      return acc if acc =~ /^\d+$/

      search_doc = MiGA::Json.parse(
        download(:ncbi_search, :assembly, acc, :json),
Severity: Minor
Found in lib/miga/remote_dataset.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. [20/10]
Open

  def load_status
    f_path = File.join(daemon_home, 'status.json')
    return unless File.size? f_path

    say 'Loading previous status in daemon/status.json:'
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. [20/10]
Open

  def perform
    cli.ensure_par(index: '-i')
    ds = cli.load_and_filter_datasets

    cli.say 'Indexing taxonomy'
Severity: Minor
Found in lib/miga/cli/action/tax_index.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. [20/10]
Open

  def read_distances
    p = cli.load_project
    cli[:metric] ||= p.clade? ? 'ani' : 'aai'
    res_n = "#{cli[:metric]}_distances"
    cli.say "Reading distances: 1-#{cli[:metric].upcase}"
Severity: Minor
Found in lib/miga/cli/action/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.

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

  def perform
    cli.ensure_par(result: '-r')
    obj = cli.load_project_or_dataset
    cli.say "Registering result: #{cli[:result]}"
    r = obj.add_result(cli[:result], true, force: cli[:force])
Severity: Minor
Found in lib/miga/cli/action/add_result.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. [20/10]
Open

  def remote_list
    if cli[:ncbi_list_json] && File.size?(cli[:ncbi_list_json])
      return read_ncbi_list_json(cli[:ncbi_list_json])
    end

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

  def perform
    cli.ensure_par(result: '-r')
    obj = cli.load_project_or_dataset
    cli.say "Registering result: #{cli[:result]}"
    r = obj.add_result(cli[:result], true, force: cli[:force])
Severity: Minor
Found in lib/miga/cli/action/add_result.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_ncbi_taxonomy_dump is too high. [25.26/15]
Open

  def load_ncbi_taxonomy_dump
    return unless cli[:ncbi_taxonomy_dump]

    if cli[:ncbi_taxonomy_dump] == true
      cli.say 'Downloading and reading NCBI Taxonomy dump'

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

  def remote_list
    cli.say 'Downloading genome list'
    extra = { sp_reps_only: cli[:reference].to_s }
    json = MiGA::RemoteDataset.download(
      :gtdb, :taxon, cli[:taxon], :genomes, nil, extra

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

  def check_files(cli)
    cli.say 'Looking for outdated files in results'
    n, k = cli.load_project.dataset_names.size, 0
    cli.load_project.each_dataset do |d|
      cli.advance('Datasets:', k += 1, n, false)

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

  def check_rdp_classifier
    cli.print 'Looking for RDP classifier... '
    miga_db = File.join(ENV['MIGA_HOME'], '.miga_db')
    file = 'classifier.jar'
    path = File.join(miga_db, file)

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