bio-miga/miga

View on GitHub

Showing 839 of 1,651 total issues

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

  def opt_object(opt, what = %i[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

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

  def partial_bidir_tmp(project, ref_ds)
    n = ref_ds.size
    chunks = partial_bidir_chunks(n)

    # Check first if a previous run is complete (and recover it)
Severity: Minor
Found in lib/miga/cli/action/doctor/distances.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 check_directories has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def check_directories
    each_project do |project|
      d = project_daemon(project)
      next if d.active?

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

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

    cli.parse do |opt|
      opt.separator 'You can create multiple datasets with a single command; ' \
        'simply pass all the files at the end: {FILES...}'
      opt.separator 'If -D is passed, only one dataset will be added. ' \
        'Otherwise, dataset names will be determined by the file paths (see -R)'
Severity: Minor
Found in lib/miga/cli/action/add.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. [44/25]
Open

    what.each do |w|
      case w
      when :project
        opt.on(
          '-P', '--project PATH',
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 has too many lines. [12/10]
Open

  def test_net_ftp
    cjac = 'ftp://ftp.ebi.ac.uk/pub/databases/ena/tsa/' \
           'public/gap/GAPJ01.fasta.gz'
    n = 'Cjac_L14'
    rd = MiGA::RemoteDataset.new(cjac, :assembly_gz, :web)
Severity: Minor
Found in test/remote_dataset_test.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [12/10]
Open

  def test_coupled_raw_reads
    dir = 'data/01.raw_reads'
    fq = file_path(dir, '.1.fastq')
    File.open(fq, 'w') { |fh| fh.puts '@1', 'ACTAC', '+', '####' }
    fq = file_path(dir, '.2.fastq')
Severity: Minor
Found in test/result_stats_test.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for test_encoding is too high. [17.26/15]
Open

  def test_encoding
    # Test original encoding
    t1 = '()!@*#àøo'
    t2 = "#{t1}"
    assert_equal(t1, t2)
Severity: Minor
Found in test/net_test.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [12/10]
Open

  def test_daemmon_status
    d = TestWithDaemon.new(tmpdir)
    out = capture_stdout { d.status }.string
    assert_match(/Not running/, out)

Severity: Minor
Found in test/with_daemon_test.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for test_dataset is too high. [17.26/15]
Open

  def test_dataset
    initialize_miga_home
    d = dataset

    ti = MiGA::TaxIndex.new
Severity: Minor
Found in test/tax_index_test.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [12/10]
Open

  def test_encoding
    # Test original encoding
    t1 = '()!@*#àøo'
    t2 = "#{t1}"
    assert_equal(t1, t2)
Severity: Minor
Found in test/net_test.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for test_download_file_ftp is too high. [17.26/15]
Open

  def test_download_file_ftp
    declare_remote_access
    f = tmpfile('t/test.txt')
    d = File.dirname(f)
    assert(!Dir.exist?(d))
Severity: Minor
Found in test/net_test.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [12/10]
Open

  def test_save
    declare_forks
    md1 = MiGA::Metadata.new(tmpfile('md_save.json'))
    FileUtils.touch(md1.lock_file)
    fork do
Severity: Minor
Found in test/metadata_test.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [12/10]
Open

  def test_advance
    m = MiGA::MiGA.new

    # Check advance when missing total and n
    o = capture_stderr { m.advance('x', 0) }.string
Severity: Minor
Found in test/common_test.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for initialize is too high. [17.75/15]
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 by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for test_append is too high. [17.03/15]
Open

  def test_append
    tx = MiGA::Taxonomy.new ''
    assert_equal('', "#{tx}")
    tx << ['domain:Public', 'family:GNU']
    assert_equal('GNU', tx[:f])
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for test_maxjobs_runopts is too high. [17.03/15]
Open

  def test_maxjobs_runopts
    d1 = daemon
    helper_datasets_with_results(3)
    d1.runopts(:maxjobs, 2)
    assert_equal(0, d1.jobs_running.size)
Severity: Minor
Found in test/daemon_test.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [12/10]
Open

  def test_aai_taxtest
    distant_intax = MiGA::TaxDist.aai_taxtest(35.0, :intax, engine: :diamond)
    assert_equal(:root, distant_intax[:most_likely][0])
    assert_equal(:d, distant_intax[:probably][0])
    assert_nil(distant_intax[:possibly_even])
Severity: Minor
Found in test/tax_dist_test.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [12/10]
Open

  def initialize(path, opts = {})
    @path = File.expand_path(path)
    @options = opts
    {
      json: nil,
Severity: Minor
Found in lib/miga/lair.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for initialize is too high. [17.92/15]
Open

  def initialize(ids, db, universe)
    ids = [ids] unless ids.is_a? Array
    @ids = (ids.is_a?(Array) ? ids : [ids])
    @db = db.to_sym
    @universe = universe.to_sym
Severity: Minor
Found in lib/miga/remote_dataset.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Severity
Category
Status
Source
Language