bio-miga/miga

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

Summary

Maintainability
A
2 hrs
Test Coverage

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

  def parse_cli
    cli.defaults = { daemon_opts: [] }
    cli.expect_operation = true
    cli.parse do |opt|
      opt.separator 'Available operations:'
Severity: Minor
Found in lib/miga/cli/action/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 parse_cli is too high. [49.24/15]
Open

  def parse_cli
    cli.defaults = { daemon_opts: [] }
    cli.expect_operation = true
    cli.parse do |opt|
      opt.separator 'Available operations:'
Severity: Minor
Found in lib/miga/cli/action/lair.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

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

    cli.parse do |opt|
      opt.separator 'Available operations:'
      {
        start: 'Start an instance of the application',
        stop: 'Start an instance of the application',
Severity: Minor
Found in lib/miga/cli/action/lair.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.

Assignment Branch Condition size for perform is too high. [27.37/15]
Open

  def perform
    cli.ensure_par(path: '-p')
    k_opts = %i[
      json latency wait_for keep_inactive trust_timestamp name dry exclude
    ]
Severity: Minor
Found in lib/miga/cli/action/lair.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 parse_cli has 72 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/lair.rb - About 2 hrs to fix

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

  def perform
    cli.ensure_par(path: '-p')
    k_opts = %i[
      json latency wait_for keep_inactive trust_timestamp name dry exclude
    ]
Severity: Minor
Found in lib/miga/cli/action/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.

Prefer annotated tokens (like %<foo>s</foo>) over unannotated tokens (like %s).
Open

      }.each { |k, v| opt.separator sprintf('    %*s%s', -33, k, v) }
Severity: Minor
Found in lib/miga/cli/action/lair.rb by rubocop

Use a consistent style for named format string tokens.

Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

Example: EnforcedStyle: annotated (default)

# bad
format('%{greeting}', greeting: 'Hello')
format('%s', 'Hello')

# good
format('%<greeting>s', greeting: 'Hello')</greeting>

Example: EnforcedStyle: template

# bad
format('%<greeting>s', greeting: 'Hello')
format('%s', 'Hello')

# good
format('%{greeting}', greeting: 'Hello')</greeting>

Example: EnforcedStyle: unannotated

# bad
format('%<greeting>s', greeting: 'Hello')
format('%{greeting}', 'Hello')

# good
format('%s', 'Hello')</greeting>

Missing magic comment # frozen_string_literal: true.
Open

# @package MiGA
Severity: Minor
Found in lib/miga/cli/action/lair.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

Missing top-level class documentation comment.
Open

class MiGA::Cli::Action::Lair < MiGA::Cli::Action
Severity: Minor
Found in lib/miga/cli/action/lair.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

Favor String#% over sprintf.
Open

      }.each { |k, v| opt.separator sprintf('    %*s%s', -33, k, v) }
Severity: Minor
Found in lib/miga/cli/action/lair.rb by rubocop

This cop enforces the use of a single string formatting utility. Valid options include Kernel#format, Kernel#sprintf and String#%.

The detection of String#% cannot be implemented in a reliable manner for all cases, so only two scenarios are considered - if the first argument is a string literal and if the second argument is an array literal.

Example: EnforcedStyle: format(default)

# bad
puts sprintf('%10s', 'hoge')
puts '%10s' % 'hoge'

# good
puts format('%10s', 'hoge')

Example: EnforcedStyle: sprintf

# bad
puts format('%10s', 'hoge')
puts '%10s' % 'hoge'

# good
puts sprintf('%10s', 'hoge')

Example: EnforcedStyle: percent

# bad
puts format('%10s', 'hoge')
puts sprintf('%10s', 'hoge')

# good
puts '%10s' % 'hoge'

There are no issues that match your filters.

Category
Status