bio-miga/miga

View on GitHub

Showing 116 of 2,560 total issues

Method check_mts has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def check_mts(cli)
    cli.say 'Looking for unarchived MyTaxa Scan runs'
    cli.load_project.each_dataset do |d|
      res = d.result(:mytaxa_scan)
      next if res.nil?
Severity: Minor
Found in lib/miga/cli/action/doctor.rb - About 3 hrs 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 traverse_taxonomy has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def traverse_taxonomy(tab, dist)
    cli.say 'Traversing taxonomy'
    rank_i = 0
    Taxonomy.KNOWN_RANKS.each do |rank|
      next if rank == :ns
Severity: Minor
Found in lib/miga/cli/action/tax_dist.rb - About 3 hrs 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 22 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    cli[:compute] = false if cli[:try_load] and
      (not r[:stats].nil?) and (not r[:stats].empty?)
    r = cli.load_result
    if cli[:compute]
Severity: Minor
Found in lib/miga/cli/action/stats.rb - About 3 hrs 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 load_and_filter_datasets has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def load_and_filter_datasets(silent = false)
    return @objects[:filtered_datasets] unless @objects[:filtered_datasets].nil?
    say 'Listing datasets'
    ds = self[:dataset].nil? ?
      load_project.datasets : [load_dataset(silent)].compact
Severity: Minor
Found in lib/miga/cli/objects_helper.rb - About 3 hrs 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 seqs_length has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def seqs_length(file, format, opts = {})
    fh = file =~ /\.gz/ ? Zlib::GzipReader.open(file) : File.open(file, 'r')
    l = []
    gc = 0
    i = 0 # <- Zlib::GzipReader doesn't set `$.`
Severity: Minor
Found in lib/miga/common/format.rb - About 2 hrs 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 21 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    cli.ensure_par(result: '-r')
    ds = cli.load_and_filter_datasets
    cli.say 'Loading results'
    stats = ds.map do |d|
Severity: Minor
Found in lib/miga/cli/action/summary.rb - About 2 hrs 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 opts_for_wf has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def opts_for_wf(opt, files_desc, params = {})
    {
      multi: false, cleanup: true, project_type: false, ncbi: true
    }.each { |k, v| params[k] = v if params[k].nil? }
    opt.on(
Severity: Major
Found in lib/miga/cli/action/wf.rb - About 2 hrs to fix

Method compute_essential_genes has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def compute_essential_genes(r)
    stats = {}
    d = cli.load_dataset
    if d.is_multi?
      stats = {median_copies: 0, mean_copies: 0}
Severity: Minor
Found in lib/miga/cli/action/stats.rb - About 2 hrs 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_entries has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def download_entries(ds, p)
    cli.say "Downloading #{ds.size} " + (ds.size == 1 ? 'entry' : 'entries')
    p.do_not_save = true if cli[:save_every] != 1
    ignore = !cli[:ignore_until].nil?
    downloaded = 0
Severity: Minor
Found in lib/miga/cli/action/ncbi_get.rb - About 2 hrs 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_cli has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def parse_cli
    cli.defaults = {query: false, universe: :ncbi, db: :nuccore,
      get_md: false, only_md: false}
    cli.parse do |opt|
      cli.opt_object(opt, [:project, :dataset, :dataset_type])
Severity: Major
Found in lib/miga/cli/action/get.rb - About 2 hrs to fix

Method get_files_and_type has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def get_files_and_type
    files = cli.files
    file_type = nil
    if files.empty?
      cli.ensure_par({dataset: '-D'},
Severity: Minor
Found in lib/miga/cli/action/add.rb - About 2 hrs 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_cli has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def parse_cli
    cli.defaults = {daemon_opts: []}
    cli.expect_operation = true
    cli.parse do |opt|
      opt.separator 'Available operations:'
Severity: Major
Found in lib/miga/cli/action/daemon.rb - About 2 hrs to fix

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

  def perform
    ds = cli.load_and_filter_datasets(cli[:silent])
    exit(ds.empty? ? 1 : 0) if cli[:silent]
    io = cli[:output].nil? ? $stdout : File.open(cli[:output], 'w')
    if !cli[:datum].nil?
Severity: Minor
Found in lib/miga/cli/action/ls.rb - About 2 hrs 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_sub_cli has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def get_sub_cli
    return [cli] if cli[:file].nil?
    glob = []
    File.open(cli[:file], 'r') do |fh|
      h = nil
Severity: Minor
Found in lib/miga/cli/action/get.rb - About 2 hrs 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 opts_for_wf has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def opts_for_wf(opt, files_desc, params = {})
    {
      multi: false, cleanup: true, project_type: false, ncbi: true
    }.each { |k, v| params[k] = v if params[k].nil? }
    opt.on(
Severity: Minor
Found in lib/miga/cli/action/wf.rb - About 2 hrs 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_pvalues has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def self.aai_pvalues(aai, test)
    Zlib::GzipReader.open(aai_path(test)) do |fh|
      keys = nil
      fh.each_line do |ln|
        row = ln.chomp.split(/\t/)
Severity: Minor
Found in lib/miga/tax_dist.rb - About 2 hrs 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 test_preprocessing has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def test_preprocessing
    p1 = $p1
    assert(p1.done_preprocessing?)
    d1 = p1.add_dataset("BAH")
    assert(! p1.done_preprocessing?)
Severity: Minor
Found in test/project_test.rb - About 1 hr to fix

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

  def parse_cli
    cli.expect_files = true
    cli.defaults = {
      ref: true, ignore_dups: false,
      regexp: MiGA::Cli.FILE_REGEXP
Severity: Minor
Found in lib/miga/cli/action/add.rb - About 1 hr to fix

Method tabulate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def tabulate(header, values, tabular = false)
    fields = [header.map(&:to_s)]
    fields << fields.first.map { |h| h.gsub(/\S/, '-') } unless tabular
    fields += values.map { |r| r.map { |cell| cell.nil? ? '?' : cell.to_s } }
    clen = tabular ? Array.new(header.size, 0) :
Severity: Minor
Found in lib/miga/common/format.rb - About 1 hr 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_object has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def opt_object(opt, what = [:project, :dataset])
    what.each do |w|
      case w
      when :project
        opt.on(
Severity: Minor
Found in lib/miga/cli/opt_helper.rb - About 1 hr to fix
Severity
Category
Status
Source
Language