bio-miga/miga

View on GitHub

Showing 815 of 1,600 total issues

Method num_suffix has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def num_suffix(n, bin = false)
    p = ''
    { T: 4, G: 3, M: 2, K: 1 }.each do |k, x|
      v = (bin ? 1024 : 1e3)**x
      if n > v
Severity: Minor
Found in lib/miga/common.rb - About 25 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 parse_reports_as_datasets has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_reports_as_datasets(reports)
    ds = {}
    reports.each do |r|
      asm = r[:accession]
      next if asm.nil? || asm.empty? || asm == '-'
Severity: Minor
Found in lib/miga/cli/action/download/ncbi.rb - About 25 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 pull_hook has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def pull_hook(event, *event_args)
    event = event.to_sym
    event_queue = (hooks[event] || [])
    event_queue += (metadata[event] || []) if respond_to? :metadata
    event_queue.each do |i|
Severity: Minor
Found in lib/miga/common/hooks.rb - About 25 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 initialize_by_ranks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize_by_ranks(str, ranks)
    ranks = ranks.split(/\s+/) unless ranks.is_a? Array
    str = str.split(/\s+/) unless str.is_a? Array
    unless ranks.size == str.size
      raise "Unequal number of ranks and names: #{ranks} => #{str}"
Severity: Minor
Found in lib/miga/taxonomy.rb - About 25 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_assembly has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_result_assembly(base, opts)
    return nil unless result_files_exist?(base, '.LargeContigs.fna')

    r = add_files_to_ds_result(
      MiGA::Result.new("#{base}.json"), name,
Severity: Minor
Found in lib/miga/dataset/result/add.rb - About 25 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 recalculate_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def recalculate_status(save = true)
    old_status = metadata[:status]
    metadata[:status] =
      !active? ? 'inactive' : done_preprocessing? ? 'complete' : 'incomplete'
    if save && (old_status.nil? || old_status != metadata[:status])
Severity: Minor
Found in lib/miga/dataset/status.rb - About 25 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 profile_advance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def profile_advance(save = false)
    # Determine the start point
    first_task = first_preprocessing(save) or
      return Array.new(self.class.PREPROCESSING_TASKS.size, 0)

Severity: Minor
Found in lib/miga/dataset/result.rb - About 25 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_mytaxa has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_result_mytaxa(base, _opts)
    if multi?
      return nil unless
        result_files_exist?(base, '.mytaxa') ||
        result_files_exist?(base, '.nomytaxa.txt')
Severity: Minor
Found in lib/miga/dataset/result/add.rb - About 25 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 ncbi_asm_get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def ncbi_asm_get(opts)
      require 'tempfile'
      require 'zip'

      zipped = download(
Severity: Minor
Found in lib/miga/remote_dataset/download.rb - About 25 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_mytaxa_scan has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_result_mytaxa_scan(base, _opts)
    if nonmulti?
      return nil unless
        result_files_exist?(base, %w[.pdf .mytaxa]) ||
        result_files_exist?(base, '.nomytaxa.txt')
Severity: Minor
Found in lib/miga/dataset/result/add.rb - About 25 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 db_requested has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def db_requested(manif)
    [:recommended, :test].each do |n|
      if cli[:database] == n
        raise "This host has no #{n} database" if manif[n].nil?

Severity: Minor
Found in lib/miga/cli/action/db.rb - About 25 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 list_local has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def list_local
    local_manif = local_manifest
    raise "Local manifest not found." unless local_manif
    databases =
      if %i[recommended test].include?(cli[:database])
Severity: Minor
Found in lib/miga/cli/action/db.rb - About 25 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 opt_common has a Cognitive Complexity of 6 (exceeds 5 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 25 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 uri_safe_join has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def uri_safe_join(*parts)
  safe = parts.map { |i| i.is_a?(Array) ? i.join(',') : i.to_s }
  last = safe.pop
  safe.map! { |i| i[-1] == '/' ? i : "#{i}/" }
  safe << last
Severity: Minor
Found in lib/miga/remote_dataset/base.rb - About 25 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

Avoid more than 3 levels of block nesting.
Open

          left_time > 1440 ? ('%.1fd left' % (left_time / 1440)) :
          left_time > 60 ? ('%.1fh left' % (left_time / 60)) :
          ('%.1fm left' % left_time)
Severity: Minor
Found in lib/miga/common.rb by rubocop

This cop checks for excessive nesting of conditional and looping constructs.

You can configure if blocks are considered using the CountBlocks option. When set to false (the default) blocks are not counted towards the nesting level. Set to true to count blocks as well.

The maximum level of nesting allowed is configurable.

Severity
Category
Status
Source
Language