bio-miga/miga

View on GitHub

Showing 838 of 1,651 total issues

Method merge_bidir_tmp has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def merge_bidir_tmp(tmp)
    tmp_done = File.join(tmp, 'chunks.txt')
    chunks = File.readlines(tmp_done)[0].chomp.to_i

    lower_tr = []
Severity: Minor
Found in lib/miga/cli/action/doctor/distances.rb - About 1 hr to fix

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

  def parse_cli
    cli.defaults = { units: false, tabular: 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/summary.rb - About 1 hr to fix

Method perform has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perform
    cli.ensure_par(result: '-r')
    ds = cli.load_and_filter_datasets
    cli.say 'Loading results'
    k = 0
Severity: Minor
Found in lib/miga/cli/action/summary.rb - About 1 hr to fix

Method ncbi_asm_get has 26 lines of code (exceeds 25 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 1 hr to fix

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

    cli.parse do |opt|
      cli.opt_object(opt, [:project, :project_type_req])
      opt.on(
        '-n', '--name STRING',
        'Name of the project'
Severity: Minor
Found in lib/miga/cli/action/new.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 merge_bidir_tmp has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def merge_bidir_tmp(tmp)
    tmp_done = File.join(tmp, 'chunks.txt')
    chunks = File.readlines(tmp_done)[0].chomp.to_i

    lower_tr = []
Severity: Minor
Found in lib/miga/cli/action/doctor/distances.rb - About 55 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_to has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def save_to(project, name = nil, is_ref = true, metadata_def = {})
    name ||= ids.join('_').miga_name
    project = MiGA::Project.new(project) if project.is_a? String
    MiGA::Dataset.exist?(project, name) and
      raise "Dataset #{name} exists in the project, aborting..."
Severity: Minor
Found in lib/miga/remote_dataset.rb - About 55 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 net_method has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def net_method(method, uri, *opts)
    attempts ||= 0
    uri = URI.parse(uri) if uri.is_a? String
    DEBUG "#{method.to_s.upcase}: #{uri} #{opts}"
    case method.to_sym
Severity: Minor
Found in lib/miga/common/net.rb - About 55 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 run_daemon has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def run_daemon
    return if cli[:prepare_and_exit]

    cmd  = ['daemon', 'run', '-P', cli[:outdir], '--shutdown-when-done']
    cmd += ['--json', cli[:daemon_json]] if cli[:daemon_json]
Severity: Minor
Found in lib/miga/cli/action/wf.rb - About 55 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_dataset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def add_dataset(name)
    unless metadata[:datasets].include? name
      d = MiGA::Dataset.new(self, name)
      @metadata[:datasets] << name
      @dataset_names_hash[name] = true if @dataset_names_hash
Severity: Minor
Found in lib/miga/project/dataset.rb - About 55 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 format_result_stats has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def format_result_stats(res)
    res.stats.map do |k, v|
      v = [v, ''] unless v.is_a? Array
      v[0] = ('%.3g' % v[0]) if v[0].is_a? Float
      "<b>#{format_name(k)}:</b> #{v[0]}#{v[1]}<br/>"
Severity: Minor
Found in lib/miga/cli/action/browse.rb - About 55 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 configure_qsub_msub_daemon has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def configure_qsub_msub_daemon(v)
    flavor      = v[:type] == 'msub' ? 'msub' :
                  cli.ask_user('Select qsub flavor', 'torque', %w[torque sge])
    queue       = cli.ask_user('What queue should I use?', nil, nil, true)
    v[:latency] = cli.ask_user('How long should I sleep? (in secs)', '150').to_i
Severity: Minor
Found in lib/miga/cli/action/init/daemon_helper.rb - About 55 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 each_file has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def each_file(&blk)
    return to_enum(:each_file) unless block_given?

    @data[:files] ||= {}
    self[:files].each do |k, files|
Severity: Minor
Found in lib/miga/result.rb - About 55 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 closest_relative_tax has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def closest_relative_tax(cr)
    cli.puts "Closest relative: #{cr[0]} with AAI: #{cr[1]}."
    p = cli.load_project
    if cli[:ref_project]
      if (ref = p.option(:ref_project)).nil?
Severity: Minor
Found in lib/miga/cli/action/tax_test.rb - About 55 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 run_block has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def run_block(&blk)
    busy_attempts ||= 0
    io_attempts ||= 0
    SQLite3::Database.new(path) { |conn| blk[conn] }
  rescue SQLite3::BusyException => e
Severity: Minor
Found in lib/miga/sqlite.rb - About 55 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 stop has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def stop(opts = [], wait = true)
    if active?
      say 'Sending termination message'
      FileUtils.touch(terminate_file)
      sleep(0.5) while active? if wait
Severity: Minor
Found in lib/miga/common/with_daemon.rb - About 55 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_entry has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def save_entry(name, body, p)
    cli.say "  Locating remote dataset: #{name}"
    body[:md][:metadata_only] = true if cli[:only_md]
    rd = MiGA::RemoteDataset.new(body[:ids], body[:db], body[:universe])
    if cli[:get_md]
Severity: Minor
Found in lib/miga/cli/action/download/base.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    if cli[:result] && r = cli.load_result
      cli[:remove] ? r.remove! : r.unlink
    elsif d = cli.load_dataset
      cli.load_project.unlink_dataset(d.name)
Severity: Minor
Found in lib/miga/cli/action/rm.rb - About 55 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_opts has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

          universe, db, ids, format, file = nil, extra = {}, obj = nil)
Severity: Major
Found in lib/miga/remote_dataset/download.rb - About 50 mins to fix

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

    cli.parse do |opt|
      opt.on(
        '--aai',
        'Use Average Amino Acid Identity (AAI) as genome similarity metric',
        'By default: Use Average Nucleotide Identity (ANI)'
Severity: Minor
Found in lib/miga/cli/action/derep_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.

Severity
Category
Status
Source
Language