bio-miga/miga

View on GitHub

Showing 186 of 1,651 total issues

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

  def each_database_file(dataset, &blk)
    ref_db = {
      haai: ['01.haai', :aai], aai: ['02.aai', :aai], ani: ['03.ani', :ani]
    }
    qry_db = {
Severity: Minor
Found in lib/miga/cli/action/doctor/databases.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 fix_essential_genes_by_domain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def fix_essential_genes_by_domain
    return if file_path(:raw_report)

    tax = source.metadata[:tax]
    return unless tax.nil? || %w[Archaea Bacteria].include?(tax[:d])
Severity: Minor
Found in lib/miga/result/stats.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 daemon_loop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def daemon_loop
    l_say(3, 'Daemon loop start')
    reload_project
    check_datasets or check_project
    if shutdown_when_done? && (jobs_running.size + jobs_to_run.size).zero?
Severity: Minor
Found in lib/miga/daemon.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 save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def save
    return if self[:never_save]
    return if !saved_hash.nil? && saved_hash == data.hash

    MiGA::MiGA.DEBUG "Metadata.save #{path}"
Severity: Minor
Found in lib/miga/metadata.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 aai_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def aai_path(test, opts = {})
      opts[:engine] ||= :blast
      engine = opts[:engine].to_s.downcase.to_sym
      test = test.to_s.downcase.to_sym
      return nil unless %i[intax novel].include? test
Severity: Minor
Found in lib/miga/tax_dist.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_clade_finding has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_result_clade_finding(base, _opts)
    if result_files_exist?(base, %w[.empty])
      r = MiGA::Result.new("#{base}.json")
      r.add_file(:empty, 'miga-project.empty')
      return r
Severity: Minor
Found in lib/miga/project/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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(argv)
    @data = {}
    @defaults = { verbose: false, tabular: false }
    @opt_common = true
    @original_argv = argv.dup
Severity: Minor
Found in lib/miga/cli.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 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 check_mdfiles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def check_mdfiles(cli)
    cli.say 'Looking for unregistered files in the metadata folder'
    md = File.join(cli.load_project.path, 'metadata')
    Dir.each_child(md) do |file|
      expected_ds = File.basename(file, '.json')
Severity: Minor
Found in lib/miga/cli/action/doctor/operations.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 get_ncbi_taxid_from_ncbi has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_ncbi_taxid_from_ncbi
    # Try first from Assembly data
    return get_ncbi_taxid_from_web if db == :assembly

    # Try from previously pulled NCBI data
Severity: Minor
Found in lib/miga/remote_dataset.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 << has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def <<(value)
    case value
    when Hash
      value.each do |r, n|
        next if n.nil? || n == ''
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 sorted_ranks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def sorted_ranks(force_ranks = false, with_namespace = false)
    @@KNOWN_RANKS.map do |r|
      next if
        (r == :ns && !with_namespace) || (ranks[r].nil? && !force_ranks)

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

  def perform
    cli.ensure_par(result: '-r')
    obj = cli.load_project_or_dataset
    cli.say "Registering result: #{cli[:result]}"
    r = obj.add_result(cli[:result], true, force: cli[:force])
Severity: Minor
Found in lib/miga/cli/action/add_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 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 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 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 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

Severity
Category
Status
Source
Language