bio-miga/miga

View on GitHub

Showing 186 of 1,651 total issues

Method advance has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def advance(step, n = 0, total = nil, bin = true)
    # Initialize advance timing
    @_advance_time ||= { last: nil, n: 0, avg: nil, total: total }
    if @_advance_time[:n] > n || total != @_advance_time[:total]
      @_advance_time[:last] = nil
Severity: Minor
Found in lib/miga/common.rb - About 1 hr to fix

Method load_status has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
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 - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    r = cli.load_result or return

    cli[:compute] = false if cli[:try_load] && !r[:stats]&.empty?

Severity: Minor
Found in lib/miga/cli/action/stats.rb - About 1 hr 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 test_preprocessing has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def test_preprocessing
    d2 = project.add_dataset('ds_preprocessing')
    assert_nil(d2.first_preprocessing)
    assert_nil(d2.next_preprocessing)
    assert_not_predicate(d2, :done_preprocessing?)
Severity: Minor
Found in test/dataset_test.rb - About 1 hr to fix

Method opt_filter_datasets has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def opt_filter_datasets(opt, what = %i[ref multi markers active taxonomy])
    what.each do |w|
      case w
      when :ref
        opt.on(
Severity: Minor
Found in lib/miga/cli/opt_helper.rb - About 1 hr to fix

Method compute_stats_essential_genes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def compute_stats_essential_genes
    stats = {}
    if source.multi?
      stats = { median_copies: 0, mean_copies: 0 }
      File.open(file_path(:report), 'r') do |fh|
Severity: Minor
Found in lib/miga/result/stats.rb - About 1 hr to fix

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

  def parse_cli
    default_opts_for_wf
    cli.defaults = {
      metric: :ani, threshold: 95.0, criterion: :quality,
      summaries: true, collection: true
Severity: Minor
Found in lib/miga/cli/action/derep_wf.rb - About 1 hr to fix

Method configure_slurm_daemon has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def configure_slurm_daemon(v)
    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
    v[:maxjobs] = cli.ask_user('How many jobs can I launch at once?', '300').to_i
    v[:ppn]     = cli.ask_user('How many CPUs can I use per job?', '2').to_i
Severity: Minor
Found in lib/miga/cli/action/init/daemon_helper.rb - About 1 hr to fix

Method perform has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perform
    ds = cli.load_and_filter_datasets(cli[:silent])
    p  = cli.load_project
    exit(ds.empty? ? 1 : 0) if cli[:silent]

Severity: Minor
Found in lib/miga/cli/action/ls.rb - About 1 hr to fix

Method parse_cli has 36 lines of code (exceeds 25 allowed). Consider refactoring.
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 - About 1 hr to fix

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

  def parse_cli
    cli.expect_files = true
    cli.files_label  = 'CMD'
    cli.defaults = {
      raise: false, return: :status, source: :miga_env,
Severity: Minor
Found in lib/miga/cli/action/cmd.rb - About 1 hr to fix

Method create_dataset has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
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 - About 1 hr 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_cell has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def merge_bidir_tmp_cell(dist_x, dist_y)
    # Find missing values
    dist = {}
    datasets = Set.new
    dist_x.each do |metric, distances_x|
Severity: Minor
Found in lib/miga/cli/action/doctor/distances.rb - About 1 hr 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 runopts has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def runopts(k, v = nil, force = false)
    k = k.to_sym
    unless v.nil?
      case k
      when :latency, :maxjobs, :ppn, :ppn_project, :format_version, :verbosity,
Severity: Minor
Found in lib/miga/daemon/base.rb - About 1 hr 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 12 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    ds = cli.load_and_filter_datasets(cli[:silent])
    p  = cli.load_project
    exit(ds.empty? ? 1 : 0) if cli[:silent]

Severity: Minor
Found in lib/miga/cli/action/ls.rb - About 1 hr 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 ask_user has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def ask_user(question, default = nil, answers = nil, force = false)
    ans = " (#{answers.join(' / ')})" unless answers.nil?
    dft = " [#{default}]" unless default.nil?
    print "#{question}#{ans}#{dft} > "
    if self[:auto] && !force
Severity: Minor
Found in lib/miga/cli.rb - About 1 hr 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 remote_list has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
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

Severity: Minor
Found in lib/miga/cli/action/download/ncbi.rb - About 1 hr 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_type_status_ncbi_asm has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def get_type_status_ncbi_asm(metadata)
    from_type = nil

    # Try first from previously pulled NCBI metadata
    if metadata[:ncbi_dataset]
Severity: Minor
Found in lib/miga/remote_dataset.rb - About 1 hr 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_software_requirements has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def check_software_requirements(rc_fh)
    cli.puts 'Looking for requirements:'
    opt_groups = {
      mytaxa: 'MyTaxa',
      rdp: 'RDP classifier',
Severity: Minor
Found in lib/miga/cli/action/init.rb - About 1 hr 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 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    # Check first if a previous run is complete (and recover it)
Severity: Minor
Found in lib/miga/cli/action/doctor/distances.rb - About 1 hr to fix
Severity
Category
Status
Source
Language