bio-miga/miga

View on GitHub

Showing 179 of 1,600 total issues

Method compute_stats_ssu has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

  def compute_stats_ssu
    stats = {
      ssu: 0, complete_ssu: 0, ssu_fragment: [0.0, '%'],
      lsu: 0, complete_lsu: 0, lsu_fragment: [0.0, '%']
    }
Severity: Minor
Found in lib/miga/result/stats.rb - About 4 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 seqs_length has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def seqs_length(file, format, opts = {})
    opts[:gc] = true if opts[:skew]
    fh = file =~ /\.gz/ ? Zlib::GzipReader.open(file) : File.open(file, 'r')
    l = []
    gc = 0
Severity: Minor
Found in lib/miga/common/format.rb - About 4 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 opts_for_wf has 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def opts_for_wf(opt, files_desc, params = {})
    {
      multi: false, cleanup: true, project_type: false, ncbi: true, qual: true
    }.each { |k, v| params[k] = v if params[k].nil? }
    opt.on(
Severity: Major
Found in lib/miga/cli/action/wf.rb - About 3 hrs to fix

Method load_and_filter_datasets has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def load_and_filter_datasets(silent = false)
    return @objects[:filtered_datasets] unless @objects[:filtered_datasets].nil?

    say 'Listing datasets'
    ds =
Severity: Minor
Found in lib/miga/cli/objects_helper.rb - About 3 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

File daemon_test.rb has 318 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'test_helper'
require 'daemon_helper'
require 'miga/daemon'

class DaemonTest < Test::Unit::TestCase
Severity: Minor
Found in test/daemon_test.rb - About 3 hrs to fix

Method perform has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
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 - About 3 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 merge_bidir_tmp has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def merge_bidir_tmp(tmp)
    dist = { aai: {}, ani: {} }
    cli[:threads].times do |i|
      cli.advance('Merging:', i + 1, cli[:threads], false)
      file = File.join(tmp, "#{i}.json")
Severity: Minor
Found in lib/miga/cli/action/doctor/distances.rb - About 3 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 perform has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    cli.ensure_par(result: '-r')
    ds = cli.load_and_filter_datasets
    cli.say 'Loading results'
    k = 0
Severity: Minor
Found in lib/miga/cli/action/summary.rb - About 3 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 traverse_taxonomy has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def traverse_taxonomy(tab, dist)
    cli.say 'Traversing taxonomy'
    rank_i = 0
    Taxonomy.KNOWN_RANKS.each do |rank|
      next if rank == :ns
Severity: Minor
Found in lib/miga/cli/action/tax_dist.rb - About 3 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_entries has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def download_entries(ds, p)
    cli.say "Downloading #{ds.size} " + (ds.size == 1 ? 'entry' : 'entries')
    p.do_not_save = true if cli[:save_every] != 1
    ignore = !cli[:ignore_until].nil?
    downloaded = 0
Severity: Minor
Found in lib/miga/cli/action/download/base.rb - About 3 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

File remote_dataset.rb has 297 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'miga/taxonomy'
require 'miga/remote_dataset/download'

##
# MiGA representation of datasets with data in remote locations.
Severity: Minor
Found in lib/miga/remote_dataset.rb - About 3 hrs to fix

Method configure_qsub_msub_daemon has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def configure_qsub_msub_daemon(v)
    flavor      = v[:type] == 'msub' ? 'msub' :
                  cli.ask_user('Select qsub flavor', 'torque', %w[torque sge])
    queue       = cli.ask_user('What queue should I use?', nil, nil, true)
    v[:latency] = cli.ask_user('How long should I sleep? (in secs)', '150').to_i
Severity: Major
Found in lib/miga/cli/action/init/daemon_helper.rb - About 2 hrs to fix

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

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

Method check_mts has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def check_mts(cli)
    cli.say 'Looking for unarchived MyTaxa Scan runs'
    cli.load_project.each_dataset do |d|
      res = d.result(:mytaxa_scan)
      next if res.nil?
Severity: Minor
Found in lib/miga/cli/action/doctor/operations.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 perform has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    unless cli[:value].nil?
      cli.ensure_par(
        { key: '-k' },
        '%<name>s is mandatory when --value is set: provide %<flag>s'
Severity: Minor
Found in lib/miga/cli/action/option.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 check_db has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def check_db(cli)
    cli.say 'Checking integrity of databases'
    p = cli.load_project
    n = p.dataset_names.size
    (0 .. cli[:threads] - 1).map do |i|
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

Severity
Category
Status
Source
Language