bio-miga/miga

View on GitHub

Showing 178 of 1,593 total issues

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

  def parse_cli
    cli.expect_files = true
    cli.defaults = { ref: true, ignore_dups: false }
    cli.parse do |opt|
      opt.separator 'You can create multiple datasets with a single command; ' \
Severity: Minor
Found in lib/miga/cli/action/add.rb - About 1 hr to fix

Method check_directories has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def check_directories
    each_project do |project|
      d = project_daemon(project)
      next if d.active?

Severity: Minor
Found in lib/miga/lair.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_files_and_type has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def get_files_and_type
    files = cli.files
    file_type = nil
    if files.empty?
      cli.ensure_par({ dataset: '-D' },
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 remote_list has a Cognitive Complexity of 15 (exceeds 5 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

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 ncbi_asm_json_doc has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def ncbi_asm_json_doc
    return @_ncbi_asm_json_doc unless @_ncbi_asm_json_doc.nil?

    if db == :assembly && %i[ncbi gtdb seqcode].include?(universe)
      metadata[:ncbi_asm] ||= ids.first
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 save_bidirectional has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def save_bidirectional(a, dist)
    each_database_file(a) do |db_file, metric, result, rank|
      next if rank == :haai # No need for hAAI to be bidirectional
      next if result == :taxonomy # Taxonomy is never bidirectional

Severity: Minor
Found in lib/miga/cli/action/doctor/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 next_task has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def next_task(tasks = nil, save = false)
    tasks ||= result_dirs.keys
    tasks.find do |t|
      if ignore_task?(t)
        # Do not run if this step is to be ignored
Severity: Minor
Found in lib/miga/common/with_result.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 opt_object has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def opt_object(opt, what = %i[project dataset])
    what.each do |w|
      case w
      when :project
        opt.on(
Severity: Minor
Found in lib/miga/cli/opt_helper.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_ssu has 46 lines of code (exceeds 25 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 1 hr to fix

Method opt_object has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

  def parse_cli
    cli.defaults = { info: false, processing: false, silent: false }
    cli.parse do |opt|
      cli.opt_object(opt, [:project, :dataset_opt])
      cli.opt_filter_datasets(opt)
Severity: Minor
Found in lib/miga/cli/action/ls.rb - About 1 hr to fix

Method check_dist_eval has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def check_dist_eval(cli, p, res)
    y = { notok: Set.new, fix: Set.new }
    Zlib::GzipReader.open(res.file_path(:matrix)) do |fh|
      lineno = 0
      fh.each_line do |ln|
Severity: Minor
Found in lib/miga/cli/action/doctor/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 14 (exceeds 5 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

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 unregistered_datasets has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def unregistered_datasets
    datasets = []
    MiGA::Dataset.RESULT_DIRS.values.each do |dir|
      dir_p = "#{path}/data/#{dir}"
      next unless Dir.exist? dir_p
Severity: Minor
Found in lib/miga/project/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 perform has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    p = cli.load_project
    if not cli[:datum].nil?
      v = p.metadata[cli[:datum]]
      cli.puts v.nil? ? '?' : v
Severity: Minor
Found in lib/miga/cli/action/about.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 each_project has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def each_project(dir = path)
    Dir.entries(dir).each do |f|
      next if %w[. ..].include?(f) # Ruby <= 2.3 doesn't have Dir.children

      f = File.join(dir, f)
Severity: Minor
Found in lib/miga/lair.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 reference_db has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def reference_db
    cli.say "Locating reference database"
    ref_db_path = cli[:db_path]
    if ref_db_path.nil?
      if cli[:download]
Severity: Minor
Found in lib/miga/cli/action/classify_wf.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 run_cmd has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run_cmd(cmd, opts = {})
    opts = run_cmd_opts(opts)
    cmd = cmd.shelljoin if cmd.is_a?(Array)
    spawn_opts = {}
    spawn_opts[:out] = opts[:stdout] if opts[:stdout]
Severity: Minor
Found in lib/miga/common/system_call.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

Severity
Category
Status
Source
Language