bio-miga/miga

View on GitHub
lib/miga/cli/action/derep_wf.rb

Summary

Maintainability
A
1 hr
Test Coverage

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

  def parse_cli
    default_opts_for_wf
    cli.defaults = {
      metric: :ani, threshold: 95.0, criterion: :quality,
      summaries: true, collection: true
Severity: Minor
Found in lib/miga/cli/action/derep_wf.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 dereplicate is too high. [35.74/15]
Open

  def dereplicate(p)
    return if cli[:prepare_and_exit]

    cli.say 'Extracting genomospecies clades'
    r = p.result(:clade_finding) or raise 'Result unavailable: run failed'
Severity: Minor
Found in lib/miga/cli/action/derep_wf.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. [20/10]
Open

  def dereplicate(p)
    return if cli[:prepare_and_exit]

    cli.say 'Extracting genomospecies clades'
    r = p.result(:clade_finding) or raise 'Result unavailable: run failed'
Severity: Minor
Found in lib/miga/cli/action/derep_wf.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 parse_cli is too high. [23.41/15]
Open

  def parse_cli
    default_opts_for_wf
    cli.defaults = {
      metric: :ani, threshold: 95.0, criterion: :quality,
      summaries: true, collection: true
Severity: Minor
Found in lib/miga/cli/action/derep_wf.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 representatives is too high. [17.15/15]
Open

  def representatives(p)
    cli.say 'Identifying representatives'
    f = File.join(cli[:outdir], 'representatives.txt')
    if cli[:criterion] == :medoids
      FileUtils.cp(p.result(:clade_finding).file_path(:medoids_gsp), f)
Severity: Minor
Found in lib/miga/cli/action/derep_wf.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 perform is too high. [16.06/15]
Open

  def perform
    # Input data
    p = create_project(
      :assembly,
      { run_clades: false },
Severity: Minor
Found in lib/miga/cli/action/derep_wf.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. [11/10]
Open

  def perform
    # Input data
    p = create_project(
      :assembly,
      { run_clades: false },
Severity: Minor
Found in lib/miga/cli/action/derep_wf.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 parse_cli has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def parse_cli
    default_opts_for_wf
    cli.defaults = {
      metric: :ani, threshold: 95.0, criterion: :quality,
      summaries: true, collection: true
Severity: Minor
Found in lib/miga/cli/action/derep_wf.rb - About 1 hr 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.

Missing top-level class documentation comment.
Open

class MiGA::Cli::Action::DerepWf < MiGA::Cli::Action
Severity: Minor
Found in lib/miga/cli/action/derep_wf.rb by rubocop

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

Unused block argument - v. You can omit the argument if you don't care about it.
Open

      ) { |v| cli[:criterion] = :medoids }
Severity: Minor
Found in lib/miga/cli/action/derep_wf.rb by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

    if cli[:collection]
Severity: Minor
Found in lib/miga/cli/action/derep_wf.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

Unused block argument - v. You can omit the argument if you don't care about it.
Open

      ) { |v| cli[:criterion] = :quality }
Severity: Minor
Found in lib/miga/cli/action/derep_wf.rb by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

Missing magic comment # frozen_string_literal: true.
Open

# @package MiGA
Severity: Minor
Found in lib/miga/cli/action/derep_wf.rb by rubocop

This cop is designed to help upgrade to Ruby 3.0. It will add the comment # frozen_string_literal: true to the top of files to enable frozen string literals. Frozen string literals may be default in Ruby 3.0. The comment will be added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+.

Example: EnforcedStyle: when_needed (default)

# The `when_needed` style will add the frozen string literal comment
# to files only when the `TargetRubyVersion` is set to 2.3+.
# bad
module Foo
  # ...
end

# good
# frozen_string_literal: true

module Foo
  # ...
end

Example: EnforcedStyle: always

# The `always` style will always add the frozen string literal comment
# to a file, regardless of the Ruby version or if `freeze` or `<<` are
# called on a string literal.
# bad
module Bar
  # ...
end

# good
# frozen_string_literal: true

module Bar
  # ...
end

Example: EnforcedStyle: never

# The `never` will enforce that the frozen string literal comment does
# not exist in a file.
# bad
# frozen_string_literal: true

module Baz
  # ...
end

# good
module Baz
  # ...
end

Redundant curly braces around a hash parameter.
Open

      { run_mytaxa_scan: false, run_ssu: false }
Severity: Minor
Found in lib/miga/cli/action/derep_wf.rb by rubocop

This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

Example: EnforcedStyle: braces

# The `braces` style enforces braces around all method
# parameters that are hashes.

# bad
some_method(x, y, a: 1, b: 2)

# good
some_method(x, y, {a: 1, b: 2})

Example: EnforcedStyle: no_braces (default)

# The `no_braces` style checks that the last parameter doesn't
# have braces around it.

# bad
some_method(x, y, {a: 1, b: 2})

# good
some_method(x, y, a: 1, b: 2)

Example: EnforcedStyle: context_dependent

# The `context_dependent` style checks that the last parameter
# doesn't have braces around it, but requires braces if the
# second to last parameter is also a hash literal.

# bad
some_method(x, y, {a: 1, b: 2})
some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)

# good
some_method(x, y, a: 1, b: 2)
some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

There are no issues that match your filters.

Category
Status