bio-miga/miga

View on GitHub

Showing 1,599 of 1,613 total issues

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

  def dereplicate(p)
    return if cli[:prepare_and_exit]

    cli.say 'Extracting genomospecies clades'
    r = p.result(:clade_finding) or raise 'Result unavailable: run failed'
Severity: Minor
Found in lib/miga/cli/action/derep_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. [20/10]
Open

  def parse_cli
    cli.defaults = { try_load: false }
    cli.parse do |opt|
      cli.opt_object(opt, [:project, :dataset_opt, :result])
      opt.on(
Severity: Minor
Found in lib/miga/cli/action/stats.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 create_dataset(file, p)
    name = cli[:dataset]
    if name.nil?
      ref_file = file.is_a?(Array) ? file.first : file
      m = cli[:regexp].match(ref_file)
Severity: Minor
Found in lib/miga/cli/action/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.

Cyclomatic complexity for perform is too high. [16/6]
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 checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

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

  def parse_cli
    default_opts_for_wf
    cli.defaults = {
      download: false, summaries: true, pvalue: 0.1,
      local: File.expand_path('.miga_db', ENV['MIGA_HOME'])
Severity: Minor
Found in lib/miga/cli/action/classify_wf.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 perform is too high. [25.57/15]
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 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 list_local is too high. [25.67/15]
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 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 add_result_mytaxa(base, _opts)
    if multi?
      return nil unless
        result_files_exist?(base, '.mytaxa') ||
        result_files_exist?(base, '.nomytaxa.txt')
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.

Assignment Branch Condition size for check_type is too high. [25.32/15]
Open

  def check_type
    raise MiGA::Error.new('Undefined dataset type') unless type
    return false if type == :empty

    unless self.class.KNOWN_TYPES[type]
Severity: Minor
Found in lib/miga/dataset/type.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]
Open

  def add_result_mytaxa_scan(base, _opts)
    if nonmulti?
      return nil unless
        result_files_exist?(base, %w[.pdf .mytaxa]) ||
        result_files_exist?(base, '.nomytaxa.txt')
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.

Assignment Branch Condition size for test_verbosity is too high. [24.52/15]
Open

  def test_verbosity
    d1 = daemon
    d1.runopts(:verbosity, 0)
    out = capture_stderr { d1.in_loop }.string
    assert_empty(out)
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_next_host is too high. [24.33/15]
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 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 compute_stats_cds is too high. [24.06/15]
Open

  def compute_stats_cds
    s = MiGA::MiGA.seqs_length(file_path(:proteins), :fasta)
    stats = {
      predicted_proteins: s[:n],
      average_length: [s[:avg], 'aa']
Severity: Minor
Found in lib/miga/result/stats.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

Cyclomatic complexity for ncbi_asm_json_doc is too high. [15/6]
Open

  def ncbi_asm_json_doc
    return @_ncbi_asm_json_doc unless @_ncbi_asm_json_doc.nil?

    if db == :assembly && %i[ncbi gtdb seqcode].include?(universe)
      metadata[:ncbi_asm] ||= ids.first
Severity: Minor
Found in lib/miga/remote_dataset.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Assignment Branch Condition size for aai_pvalues is too high. [24.1/15]
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 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 remote_connection(host)
    host = known_hosts(host) if host.is_a?(Symbol)
    uri = host.is_a?(URI) ? host : URI.parse(host)
    @remote_connection_uri = uri

Severity: Minor
Found in lib/miga/common/net.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 next_task(tasks = nil, save = false)
    tasks ||= result_dirs.keys
    tasks.find do |t|
      if ignore_task?(t)
        # Do not run if this step is to be ignored
Severity: Minor
Found in lib/miga/common/with_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.

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

Severity
Category
Status
Source
Language