bio-miga/miga

View on GitHub

Showing 1,637 of 1,651 total issues

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

  def perform
    # Input data
    norun = %w[
      project_stats haai_distances aai_distances ani_distances clade_finding
    ]
Severity: Minor
Found in lib/miga/cli/action/quality_wf.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 perform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    cli.files
    cli.say 'Running command:'
    cmd = cli.files.size == 1 ? cli.files[0] : cli.files
    cli.say cmd
Severity: Minor
Found in lib/miga/cli/action/cmd.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 check_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def check_type
    raise MiGA::Error.new('Undefined dataset type') unless type
    return false if type == :empty

    unless self.class.KNOWN_TYPES[type]
Severity: Minor
Found in lib/miga/dataset/type.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

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

Gem::Specification.new do |s|
  # Basic information
  s.name    = 'miga-base'
  s.version    = MiGA::MiGA.FULL_VERSION
  s.date    = MiGA::MiGA.VERSION_DATE.to_s
Severity: Minor
Found in miga-base.gemspec 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 add_result_ssu has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def add_result_ssu(base, opts)
    return MiGA::Result.new("#{base}.json") if result(:assembly).nil?
    return nil unless result_files_exist?(base, '.ssu.fa')

    r = add_files_to_ds_result(
Severity: Minor
Found in lib/miga/dataset/result/add.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

Avoid too many return statements within this method.
Open

    check_target and return
Severity: Major
Found in lib/miga/cli/action/db.rb - About 30 mins to fix

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

    Taxonomy.KNOWN_RANKS.each do |rank|
      next if rank == :ns

      rank_n = 0
      rank_i += 1
Severity: Minor
Found in lib/miga/cli/action/tax_dist.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. [27/25]
Open

    cli.parse do |opt|
      opt.separator 'To separate command flags from MiGA flags, use --:'
      opt.separator 'miga cmd --verbose -- rbm.rb --version'
      opt.separator ''
      opt.separator 'To run the command as is (no escaping), use single-quotes:'
Severity: Minor
Found in lib/miga/cli/action/cmd.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.

Avoid parameter lists longer than 5 parameters. [7/5]
Open

    def download_opts(
          universe, db, ids, format, file = nil, extra = {}, obj = nil)
Severity: Minor
Found in lib/miga/remote_dataset/download.rb by rubocop

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

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

  def assert_valid_option_value(key, value, from_string = false)
    opt = assert_has_option(key)
    value = option_from_string(key, value) if from_string

    # nil is always valid, and so are supported tokens
Severity: Minor
Found in lib/miga/common/with_option.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_alternative has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_alternative(tax, replace = true)
    return if tax.nil?
    raise 'Unsupported taxonomy class.' unless tax.is_a? MiGA::Taxonomy

    alt_ns = alternative(tax.namespace)
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 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 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

Severity
Category
Status
Source
Language