bio-miga/miga

View on GitHub

Showing 1,599 of 1,613 total issues

Assignment Branch Condition size for format_table is too high. [21.47/15]
Open

  def format_table(ds, header, &blk)
    io = cli[:output].nil? ? $stdout : File.open(cli[:output], 'w')
    cli.say 'Collecting metadata'
    k = 0
    cli.table(
Severity: Minor
Found in lib/miga/cli/action/ls.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. [16/10]
Open

  def add_result_distances_nonref(base)
    return nil unless
      result_files_exist?(base, %w[.aai-medoids.tsv .aai.db]) ||
      result_files_exist?(base, %w[.ani-medoids.tsv .ani.db]) ||
      result_files_exist?(base, %w[.empty])
Severity: Minor
Found in lib/miga/dataset/result/add.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. [16/10]
Open

  def install_library(cli, paths, language, pkg)
    case language
    when :r
      r_cmd = "install.packages('#{pkg}', repos='http://cran.rstudio.com/')"
      run_r_cmd(cli, paths, r_cmd)
Severity: Minor
Found in lib/miga/cli/action/init.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.

File daemon.rb has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'miga/project'
require 'miga/common/with_daemon'
require 'miga/daemon/base'

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

File wf.rb has 262 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module MiGA::Cli::Action::Wf
  def default_opts_for_wf
    cli.expect_files = true
    cli.defaults = {
      clean: false, project_type: :genomes, dataset_type: :popgenome,
Severity: Minor
Found in lib/miga/cli/action/wf.rb - About 2 hrs to fix

Method download_datasets has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def download_datasets
    # Download datasets from NCBI
    unless cli[:ncbi_taxon].nil?
      what = cli[:ncbi_ref] ? '--reference' :
             cli[:ncbi_draft] ? '--all' : '--complete'
Severity: Minor
Found in lib/miga/cli/action/wf.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 get_sub_cli has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def get_sub_cli
    return [cli] if cli[:file].nil? || cli[:ignore_file]

    glob = []
    cli_default = cli.original_argv + ['--ignore-file']
Severity: Minor
Found in lib/miga/cli/action/get.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 aai_pvalues has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def aai_pvalues(aai, test, opts = {})
      y = {}
      Zlib::GzipReader.open(aai_path(test, opts)) do |fh|
        keys = nil
        fh.each_line do |ln|
Severity: Minor
Found in lib/miga/tax_dist.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 partial_bidir_tmp has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def partial_bidir_tmp(project, ref_ds)
    n = ref_ds.size

    # Read data first (threaded)
    tmp = File.join(project.path, 'doctor-bidirectional.tmp')
Severity: Minor
Found in lib/miga/cli/action/doctor/distances.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

Assignment Branch Condition size for test_single_raw_reads is too high. [20.22/15]
Open

  def test_single_raw_reads
    dir = 'data/01.raw_reads'
    fq = file_path(dir, '.1.fastq')
    File.open(fq, 'w') { |fh| fh.puts '@1', 'ACTAC', '+', '####' }
    touch_done(dir)
Severity: Minor
Found in test/result_stats_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. [15/10]
Open

  def test_taxonomy
    # Prepare result
    dir = 'data/09.distances/05.taxonomy'
    FileUtils.touch(file_path(dir, '.aai-medoids.tsv'))
    FileUtils.touch(file_path(dir, '.aai.db'))
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_defaults is too high. [20.1/15]
Open

  def test_defaults
    tmp1 = Tempfile.new('test-parse-1.json')
    tmp1.puts '{"a": 123, "k": false, "t": null}'
    tmp1.close
    assert_equal({ a: 123, k: false, t: nil }, MiGA::Json.parse(tmp1.path))
Severity: Minor
Found in test/json_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. [15/10]
Open

  def test_profile_advance
    d2 = project.add_dataset('ds_profile_advance')
    assert_equal(0, d2.profile_advance(true).first)
    assert_equal(0, d2.profile_advance(true).last)
    assert_equal(0, d2.profile_advance(true).inject(:+))
Severity: Minor
Found in test/dataset_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_unlink is too high. [20.4/15]
Open

  def test_unlink
    r = project.add_result(:clade_finding)
    path = r.path
    done = r.path(:done)
    data = r.file_path(:empty)
Severity: Minor
Found in test/result_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. [15/10]
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 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. [15/10]
Open

  def test_debug
    assert_respond_to(MiGA::MiGA, :DEBUG)
    assert_respond_to(MiGA::MiGA, :DEBUG_ON)
    assert_respond_to(MiGA::MiGA, :DEBUG_OFF)
    MiGA::MiGA.DEBUG_ON
Severity: Minor
Found in test/common_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. [15/10]
Open

  def save
    return if self[:never_save]
    return if !saved_hash.nil? && saved_hash == data.hash

    MiGA::MiGA.DEBUG "Metadata.save #{path}"
Severity: Minor
Found in lib/miga/metadata.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. [15/10]
Open

  def test_overwrite_result
    r = dataset.add_result(:trimmed_reads)
    r[:ephemeral] = '@'
    r[:versions] = { you: 'best' }
    r.save
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.

Method has too many lines. [15/10]
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 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. [15/10]
Open

  def test_next_host
    d1 = daemon
    f = tmpfile('nodes.txt')
    File.open(f, 'w') { |h| h.puts 'localhost' }
    assert_equal(true, d1.next_host)
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.

Severity
Category
Status
Source
Language