bio-miga/miga

View on GitHub
test/lair_test.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Assignment Branch Condition size for test_daemon_launch is too high. [30.59/15]
Open

  def test_daemon_launch
    lair = MiGA::Lair.new(tmpfile('sub'), latency: 1)
    p = MiGA::Project.load(File.join(lair.path, 'project3'))
    d = MiGA::Daemon.new(p)
    assert_not_predicate(d, :active?)
Severity: Minor
Found in test/lair_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. [18/10]
Open

  def test_daemon_launch
    lair = MiGA::Lair.new(tmpfile('sub'), latency: 1)
    p = MiGA::Project.load(File.join(lair.path, 'project3'))
    d = MiGA::Daemon.new(p)
    assert_not_predicate(d, :active?)
Severity: Minor
Found in test/lair_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_in_loop is too high. [21.21/15]
Open

  def test_in_loop
    declare_forks
    lair = MiGA::Lair.new(tmpdir, name: 'Oh')
    child = lair.start(['--shush'])
    assert_not_nil(child)
Severity: Minor
Found in test/lair_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. [13/10]
Open

  def test_in_loop
    declare_forks
    lair = MiGA::Lair.new(tmpdir, name: 'Oh')
    child = lair.start(['--shush'])
    assert_not_nil(child)
Severity: Minor
Found in test/lair_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. [11/10]
Open

  def setup
    initialize_miga_home(
      <<~DAEMON
        { "maxjobs": 1, "ppn": 1, "latency": 1, "varsep": " ",
          "var": "{{key}}={{value}}", "cmd": "echo {{task_name}} >/dev/null",
Severity: Minor
Found in test/lair_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_each_project is too high. [16.28/15]
Open

  def test_each_project
    lair = MiGA::Lair.new(tmpdir)
    y = []
    lair.each_project { |p| y << p }
    assert_equal(3, y.size)
Severity: Minor
Found in test/lair_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

Do not use semicolons to terminate expressions.
Open

    out = capture_stderr { lair.terminate_daemons ; sleep(2) }.string
Severity: Minor
Found in test/lair_test.rb by rubocop

This cop checks for multiple expressions placed on the same line. It also checks for lines terminated with a semicolon.

Example:

# bad
foo = 1; bar = 2;
baz = 3;

# good
foo = 1
bar = 2
baz = 3

Missing magic comment # frozen_string_literal: true.
Open

require 'test_helper'
Severity: Minor
Found in test/lair_test.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

Space found before semicolon.
Open

    out = capture_stderr { lair.terminate_daemons ; sleep(2) }.string
Severity: Minor
Found in test/lair_test.rb by rubocop

Checks for semicolon (;) preceded by space.

Example:

# bad
x = 1 ; y = 2

# good
x = 1; y = 2

Use %r around regular expression.
Open

    assert_match(/Launching daemon: \S*sub\/project3/, out)
Severity: Minor
Found in test/lair_test.rb by rubocop

This cop enforces using // or %r around regular expressions.

Example: EnforcedStyle: slashes (default)

# bad
snake_case = %r{^[\dA-Z_]+$}

# bad
regex = %r{
  foo
  (bar)
  (baz)
}x

# good
snake_case = /^[\dA-Z_]+$/

# good
regex = /
  foo
  (bar)
  (baz)
/x

Example: EnforcedStyle: percent_r

# bad
snake_case = /^[\dA-Z_]+$/

# bad
regex = /
  foo
  (bar)
  (baz)
/x

# good
snake_case = %r{^[\dA-Z_]+$}

# good
regex = %r{
  foo
  (bar)
  (baz)
}x

Example: EnforcedStyle: mixed

# bad
snake_case = %r{^[\dA-Z_]+$}

# bad
regex = /
  foo
  (bar)
  (baz)
/x

# good
snake_case = /^[\dA-Z_]+$/

# good
regex = %r{
  foo
  (bar)
  (baz)
}x

Example: AllowInnerSlashes: false (default)

# If `false`, the cop will always recommend using `%r` if one or more
# slashes are found in the regexp string.

# bad
x =~ /home\//

# good
x =~ %r{home/}

Example: AllowInnerSlashes: true

# good
x =~ /home\//

There are no issues that match your filters.

Category
Status