bio-miga/miga

View on GitHub

Showing 838 of 1,651 total issues

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

  def check_digest(ver, file)
    cli.say 'Checking MD5 digest'
    cli.say "Expected: #{ver[:MD5]}"
    md5 = Digest::MD5.new
    size = File.size(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 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 ncbi_gb_get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def ncbi_gb_get(opts)
      # Simply use defaults, but ensure that the URL can be properly formed
      o = download_rest(opts.merge(universe: :ncbi, db: :nuccore))
      return o unless o.strip.empty?

Severity: Minor
Found in lib/miga/remote_dataset/download.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

Block has too many lines. [29/25]
Open

    cli.parse do |opt|
      opt.on(
        '--download-db',
        'Attempt to download the reference database (all default options)',
        'It is recommended to use "miga get_db" separately instead'
Severity: Minor
Found in lib/miga/cli/action/classify_wf.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Block has too many lines. [29/25]
Open

    what.each do |w|
      case w
      when :ref
        opt.on(
          '--[no-]ref',
Severity: Minor
Found in lib/miga/cli/opt_helper.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Method create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def create(path, force = false)
      # Deal with old results first
      r_old = load(path)
      return r_old if r_old && !force

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

  def last_alive(path)
    f = alive_file(path)
    f = terminated_file(path) unless File.exist? f
    c = File.read(f)
    return nil if c.nil? || c.empty?
Severity: Minor
Found in lib/miga/common/with_daemon_class.rb - About 35 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_encoding has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def normalize_encoding(body)
    # Test encodings
    body.force_encoding('utf-8')
    %w[iso8859-1 windows-1252 us-ascii ascii-8bit].each do |enc|
      break if body.valid_encoding?
Severity: Minor
Found in lib/miga/common/net.rb - About 35 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_file_to_tar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def add_file_to_tar(tar, rel_path, abs_path)
    if File.directory? abs_path
      Dir["#{abs_path}/*"].each do |f|
        add_file_to_tar(tar, File.join(rel_path, File.basename(f)), f)
      end
Severity: Minor
Found in lib/miga/cli/action/archive.rb - About 35 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 taxa_by_rank has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def taxa_by_rank(rank)
    rank = MiGA::Taxonomy.normalize_rank(rank)
    taxa = [@root]
    select = []
    loop do
Severity: Minor
Found in lib/miga/tax_index.rb - About 35 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 remote_connection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def remote_connection(host)
    host = known_hosts(host) if host.is_a?(Symbol)
    uri = host.is_a?(URI) ? host : URI.parse(host)
    @remote_connection_uri = uri

Severity: Minor
Found in lib/miga/common/net.rb - About 35 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 date_at has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def date_at(event)
    date = self[event]
    date ||= self[:started] if event == :start
    if date.nil?
      f = path event
Severity: Minor
Found in lib/miga/result/dates.rb - About 35 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