bio-miga/miga

View on GitHub

Showing 179 of 1,600 total issues

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 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 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 clean_fasta_file has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def clean_fasta_file(file)
    tmp_fh = nil
    tmp_path = nil
    begin
      if file =~ /\.gz/
Severity: Minor
Found in lib/miga/common/format.rb - About 1 hr to fix

Method advance has 37 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 }
    if @_advance_time[:n] > n
      @_advance_time[:last] = nil
Severity: Minor
Found in lib/miga/common.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 download_file_ftp has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def download_file_ftp(connection, file = nil, target = nil)
    # Open connection unless passed
    close_conn = false
    if connection.is_a?(String) || connection.is_a?(Symbol) ||
          connection.is_a?(URI)
Severity: Minor
Found in lib/miga/common/net.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 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 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 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 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 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 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 remote_list has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def remote_list
    cli.say 'Downloading genome list'
    current_page = 1
    total_pages  = 1
    ds = {}
Severity: Minor
Found in lib/miga/cli/action/download/seqcode.rb - About 1 hr to fix

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

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

Severity
Category
Status
Source
Language