bio-miga/miga

View on GitHub

Showing 838 of 1,651 total issues

Assignment Branch Condition size for check_rdp_classifier is too high. [21.61/15]
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 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 each_database_file is too high. [21.42/15]
Open

  def each_database_file(dataset, &blk)
    ref_db = {
      haai: ['01.haai', :aai], aai: ['02.aai', :aai], ani: ['03.ani', :ani]
    }
    qry_db = {

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

  def check_cds(cli)
    cli.say 'Looking for unzipped genes or proteins'
    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 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 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

Assignment Branch Condition size for copy_file_to_project is too high. [21.31/15]
Open

  def copy_file_to_project(file, file_type, d, p)
    return if file.nil?

    r_dir = Dataset.RESULT_DIRS[file_type[1]]
    r_path = File.expand_path("data/#{r_dir}/#{d.name}", p.path)
Severity: Minor
Found in lib/miga/cli/action/add.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 parse_cli
    cli.defaults = { info: false, processing: false, tabular: false }
    cli.parse do |opt|
      cli.opt_object(opt, [:project])
      opt.on(
Severity: Minor
Found in lib/miga/cli/action/about.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 generate_summary_page is too high. [21.05/15]
Open

  def generate_summary_page(path, p)
    b = File.basename(path, '.tsv')
    table = '<table class="table table-hover table-responsive">'
    File.open(path, 'r') do |fh|
      fh.each do |ln|
Severity: Minor
Found in lib/miga/cli/action/browse.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 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.

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.

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 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 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 run_cmd has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def run_cmd(cmd, opts = {})
    opts = run_cmd_opts(opts)
    cmd = cmd.shelljoin if cmd.is_a?(Array)
    spawn_opts = {}
    spawn_opts[:out] = opts[:stdout] if opts[:stdout]
Severity: Minor
Found in lib/miga/common/system_call.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

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.

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.

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.

Severity
Category
Status
Source
Language