bio-miga/miga

View on GitHub

Showing 179 of 1,600 total issues

Method add_dataset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def add_dataset(name)
    unless metadata[:datasets].include? name
      d = MiGA::Dataset.new(self, name)
      @metadata[:datasets] << name
      @dataset_names_hash[name] = true if @dataset_names_hash
Severity: Minor
Found in lib/miga/project/dataset.rb - About 55 mins 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 net_method has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def net_method(method, uri, *opts)
    attempts ||= 0
    uri = URI.parse(uri) if uri.is_a? String
    DEBUG "#{method.to_s.upcase}: #{uri} #{opts}"
    case method.to_sym
Severity: Minor
Found in lib/miga/common/net.rb - About 55 mins 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 run_block has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def run_block(&blk)
    busy_attempts ||= 0
    io_attempts ||= 0
    SQLite3::Database.new(path) { |conn| blk[conn] }
  rescue SQLite3::BusyException => e
Severity: Minor
Found in lib/miga/sqlite.rb - About 55 mins 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 configure_qsub_msub_daemon has a Cognitive Complexity of 9 (exceeds 5 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: Minor
Found in lib/miga/cli/action/init/daemon_helper.rb - About 55 mins 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 each_file has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def each_file(&blk)
    return to_enum(:each_file) unless block_given?

    @data[:files] ||= {}
    self[:files].each do |k, files|
Severity: Minor
Found in lib/miga/result.rb - About 55 mins 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 run_daemon has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def run_daemon
    return if cli[:prepare_and_exit]

    cmd  = ['daemon', 'run', '-P', cli[:outdir], '--shutdown-when-done']
    cmd += ['--json', cli[:daemon_json]] if cli[:daemon_json]
Severity: Minor
Found in lib/miga/cli/action/wf.rb - About 55 mins 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 stop has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def stop(opts = [], wait = true)
    if active?
      say 'Sending termination message'
      FileUtils.touch(terminate_file)
      sleep(0.5) while active? if wait
Severity: Minor
Found in lib/miga/common/with_daemon.rb - About 55 mins 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 format_result_stats has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def format_result_stats(res)
    res.stats.map do |k, v|
      v = [v, ''] unless v.is_a? Array
      v[0] = ('%.3g' % v[0]) if v[0].is_a? Float
      "<b>#{format_name(k)}:</b> #{v[0]}#{v[1]}<br/>"
Severity: Minor
Found in lib/miga/cli/action/browse.rb - About 55 mins 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 closest_relative_tax has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def closest_relative_tax(cr)
    cli.puts "Closest relative: #{cr[0]} with AAI: #{cr[1]}."
    p = cli.load_project
    if cli[:ref_project]
      if (ref = p.option(:ref_project)).nil?
Severity: Minor
Found in lib/miga/cli/action/tax_test.rb - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    if cli[:result] && r = cli.load_result
      cli[:remove] ? r.remove! : r.unlink
    elsif d = cli.load_dataset
      cli.load_project.unlink_dataset(d.name)
Severity: Minor
Found in lib/miga/cli/action/rm.rb - About 55 mins 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_opts has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

          universe, db, ids, format, file = nil, extra = {}, obj = nil)
Severity: Major
Found in lib/miga/remote_dataset/download.rb - About 50 mins to fix

Method perform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    cli.load_project_or_dataset.each_result do |sym, res|
      cli.puts "#{"#{sym}\tjson\t" if cli[:details]}#{res.path}" if cli[:json]
      res.each_file do |k, f|
        cli.puts "#{"#{sym}\t#{k}\t" if cli[:details]}#{res.dir}/#{f}"
Severity: Minor
Found in lib/miga/cli/action/files.rb - About 45 mins 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 add_result has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def add_result(task, save = true, opts = {})
    task = task.to_sym
    return nil if result_dirs[task].nil?

    base = File.join(project.path, 'data', result_dirs[task], result_base)
Severity: Minor
Found in lib/miga/common/with_result.rb - About 45 mins 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 8 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    glob = get_sub_cli
    p = cli.load_project
    load_ncbi_taxonomy_dump
    glob.each do |sub_cli|
Severity: Minor
Found in lib/miga/cli/action/get.rb - About 45 mins 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_status has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def check_status(cli)
    cli.say 'Updating metadata status'
    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/operations.rb - About 45 mins 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_remote_dataset has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def create_remote_dataset(sub_cli, p)
    sub_cli.ensure_par(dataset: '-D', ids: '-I')
    unless sub_cli[:api_key].nil?
      if sub_cli[:universe] == :web && sub_cli[:db] == :assembly_gz
        ENV['NCBI_API_KEY'] = sub_cli[:api_key]
Severity: Minor
Found in lib/miga/cli/action/get.rb - About 45 mins 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 normalize_rank has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def normalize_rank(rank)
      return unless rank
      return rank.to_sym if @@_KNOWN_RANKS_H[rank.to_sym]

      rank = rank.to_s.downcase
Severity: Minor
Found in lib/miga/taxonomy/base.rb - About 45 mins 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 aai_taxtest has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def aai_taxtest(aai, test, opts = {})
      meaning = {
        most_likely: [0.00, 0.01],
        probably: [0.01, 0.10],
        possibly_even: [0.10, 0.50]
Severity: Minor
Found in lib/miga/tax_dist.rb - About 45 mins 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_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def download_file(ftp, path, reuse = false)
    cli.say "Downloading '#{path}'"
    file = File.expand_path(path, cli[:local])
    if reuse && File.exist?(file)
      cli.say "Reusing #{file}"
Severity: Minor
Found in lib/miga/cli/action/db.rb - About 45 mins 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 add_result_cds has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def add_result_cds(base, opts)
    return nil unless result_files_exist?(base, %w[.faa])

    r = add_files_to_ds_result(
      MiGA::Result.new("#{base}.json"), name,
Severity: Minor
Found in lib/miga/dataset/result/add.rb - About 45 mins 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