bio-miga/miga

View on GitHub

Showing 179 of 1,600 total issues

Method launch_job has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def launch_job(job, hostk = nil)
    # Execute job
    job[:cmd] = job_cmd(job)
    MiGA::MiGA.DEBUG "CMD: #{job[:cmd]}"
    case runopts(:type)
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 use_ncbi_taxonomy_dump has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def use_ncbi_taxonomy_dump(path, cli = nil)
      raise "Directory doesn't exist: #{path}" unless File.directory?(path)

      # Structure: { TaxID => ["name", "rank", parent TaxID] }
      MiGA::MiGA.DEBUG "Loading NCBI Taxonomy dump: #{path}"
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 compute_stats_taxonomy has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def compute_stats_taxonomy
    stats = {}
    return stats unless file_path(:intax_test)

    File.open(file_path(:intax_test), 'r') do |fh|
Severity: Minor
Found in lib/miga/result/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_start has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def test_start
    p = project
    d = daemon
    d.runopts(:latency, 0, true)
    assert_equal(0, d.latency)
Severity: Minor
Found in test/daemon_test.rb - About 1 hr to fix

Method load_and_filter_datasets has 31 lines of code (exceeds 25 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 1 hr to fix

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

  def perform
    p = cli.load_project
    if !cli[:taxfile].nil?
      cli.say 'Reading tax-file and registering taxonomy'
      tfh = File.open(cli[:taxfile], 'r')
Severity: Minor
Found in lib/miga/cli/action/tax_set.rb - About 1 hr to fix

Method configure_ssh_daemon has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def configure_ssh_daemon(v)
    v[:latency] = cli.ask_user('How long should I sleep? (in secs)', '3').to_i
    v[:nodelist] = cli.ask_user(
      'What environmental variable points to node list?', '$MIGA_NODELIST'
    )
Severity: Minor
Found in lib/miga/cli/action/init/daemon_helper.rb - About 1 hr to fix

Method import_dataset has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def import_dataset(ds, method = :hardlink)
    raise "Impossible to import dataset, it already exists: #{ds.name}." if
      MiGA::Dataset.exist?(self, ds.name)

    # Import dataset results
Severity: Minor
Found in lib/miga/project/dataset.rb - About 1 hr to fix

Method configure_bash_daemon has 29 lines of code (exceeds 25 allowed). Consider refactoring.
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
Severity: Minor
Found in lib/miga/cli/action/init/daemon_helper.rb - About 1 hr to fix

Method get_sub_cli has 29 lines of code (exceeds 25 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 1 hr to fix

Method check_software_requirements has 29 lines of code (exceeds 25 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

Method get_type_status_ncbi_asm has 28 lines of code (exceeds 25 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

Method check_mts has 28 lines of code (exceeds 25 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 1 hr to fix

Method merge_bidir_tmp has 28 lines of code (exceeds 25 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 1 hr to fix

Method cli_save_actions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def cli_save_actions(opt)
    cli.opt_flag(
      opt, 'only-metadata',
      'Create datasets without input data but retrieve all metadata',
      :only_md
Severity: Minor
Found in lib/miga/cli/action/download/base.rb - About 1 hr to fix

Method opt_common has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def opt_common(opt)
    return unless @opt_common

    if interactive
      opt.on(
Severity: Minor
Found in lib/miga/cli/opt_helper.rb - About 1 hr to fix

Method read_distances has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def read_distances
    p = cli.load_project
    cli[:metric] ||= p.clade? ? 'ani' : 'aai'
    res_n = "#{cli[:metric]}_distances"
    cli.say "Reading distances: 1-#{cli[:metric].upcase}"
Severity: Minor
Found in lib/miga/cli/action/tax_dist.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 compute_stats_cds has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
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 - 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_ess has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def check_ess(cli)
    cli.say 'Looking for outdated essential genes'
    cli.load_project.each_dataset do |d|
      res = d.result(:essential_genes)
      next if res.nil?
Severity: Minor
Found in lib/miga/cli/action/doctor/operations.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 find_software has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def find_software(exec)
    path = nil
    loop do
      d_path = File.dirname(run_cmd(cli, ['which', exec], raise: false))
      if cli[:ask] || d_path == '.'
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

Severity
Category
Status
Source
Language