Class has too many lines. [313/100] Open
class DaemonTest < Test::Unit::TestCase
include TestHelper
include DaemonHelper
def setup
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [31/10] Open
def test_start
p = project
d = daemon
d.runopts(:latency, 0, true)
assert_equal(0, d.latency)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_check_datasets is too high. [36.22/15] Open
def test_check_datasets
p = project
d = daemon
d.runopts(:maxjobs, 0, true)
assert_empty(d.jobs_to_run)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_start is too high. [35.41/15] Open
def test_start
p = project
d = daemon
d.runopts(:latency, 0, true)
assert_equal(0, d.latency)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_load_status is too high. [33.24/15] Open
def test_load_status
d1 = daemon
p1 = project
assert_equal(0, d1.jobs_running.size)
assert_nil(d1.load_status)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
File daemon_test.rb
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'test_helper'
require 'daemon_helper'
require 'miga/daemon'
class DaemonTest < Test::Unit::TestCase
- Create a ticketCreate a ticket
Method has too many lines. [26/10] Open
def test_check_datasets
p = project
d = daemon
d.runopts(:maxjobs, 0, true)
assert_empty(d.jobs_to_run)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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. [25.32/15] Open
def test_in_loop
p = project
d = daemon
d.runopts(:latency, 0, true)
assert_nil(d.loop_i)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_flush is too high. [25.5/15] Open
def test_flush
d1 = daemon
p1 = project
helper_datasets_with_results
p1.add_dataset(MiGA::Dataset.new(p1, 'd1').name)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_next_host is too high. [24.33/15] Open
def test_next_host
d1 = daemon
f = tmpfile('nodes.txt')
File.open(f, 'w') { |h| h.puts 'localhost' }
assert_equal(true, d1.next_host)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_verbosity is too high. [24.52/15] Open
def test_verbosity
d1 = daemon
d1.runopts(:verbosity, 0)
out = capture_stderr { d1.in_loop }.string
assert_empty(out)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_options is too high. [23.02/15] Open
def test_options
d1 = daemon
assert_respond_to(d1, :default_options)
assert_equal(:normal, d1.default_options[:dir_mode])
assert_equal(2, d1.runopts(:latency))
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_terminate is too high. [23.02/15] Open
def test_terminate
d = daemon
assert_not_predicate(d, :active?)
assert_path_not_exist(d.alive_file)
assert_path_not_exist(d.terminated_file)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Class DaemonTest
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class DaemonTest < Test::Unit::TestCase
include TestHelper
include DaemonHelper
def setup
- Create a ticketCreate a ticket
Method has too many lines. [17/10] Open
def test_flush
d1 = daemon
p1 = project
helper_datasets_with_results
p1.add_dataset(MiGA::Dataset.new(p1, 'd1').name)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_launch_job_failure is too high. [21.1/15] Open
def test_launch_job_failure
d1 = daemon(1)
d1.runopts(:type, 'qsub')
d1.runopts(:cmd, 'echo ""')
helper_datasets_with_results(1, 1).first.inactivate!
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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. [15/10] Open
def test_load_status
d1 = daemon
p1 = project
assert_equal(0, d1.jobs_running.size)
assert_nil(d1.load_status)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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. [15/10] Open
def test_next_host
d1 = daemon
f = tmpfile('nodes.txt')
File.open(f, 'w') { |h| h.puts 'localhost' }
assert_equal(true, d1.next_host)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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. [15/10] Open
def test_terminate
d = daemon
assert_not_predicate(d, :active?)
assert_path_not_exist(d.alive_file)
assert_path_not_exist(d.terminated_file)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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. [14/10] Open
def test_verbosity
d1 = daemon
d1.runopts(:verbosity, 0)
out = capture_stderr { d1.in_loop }.string
assert_empty(out)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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. [13/10] Open
def test_in_loop
p = project
d = daemon
d.runopts(:latency, 0, true)
assert_nil(d.loop_i)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_check_project is too high. [18.11/15] Open
def test_check_project
d1 = daemon(1)
helper_datasets_with_results(1, 1).first.inactivate!
out = capture_stderr { d1.check_project }.string
assert_match(/Queueing miga-project:p/, out)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_show_log is too high. [18.03/15] Open
def test_show_log
d = daemon
assert(d.show_log?)
d.runopts(:show_log, false)
assert(!d.show_log?)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_bypass_maintenance is too high. [18.11/15] Open
def test_bypass_maintenance
# Default (run maintenance)
d = daemon(0)
d.runopts(:latency, 0, true)
capture_stderr { d.in_loop }
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_options
d1 = daemon
assert_respond_to(d1, :default_options)
assert_equal(:normal, d1.default_options[:dir_mode])
assert_equal(2, d1.runopts(:latency))
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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. [13/10] Open
def test_launch_job_ssh
d1 = daemon(1)
t = tmpfile('launch_job_ssh')
d1.runopts(:type, 'ssh')
d1.runopts(:cmd, "echo {{task_name}} > '#{t}'")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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. [13/10] Open
def test_update_format_0
f = tmpfile('daemon.json')
File.open(f, 'w') do |fh|
fh.puts(
<<~DAEMON
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_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)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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_json is too high. [16.03/15] Open
def test_maxjobs_json
d1 = daemon
helper_datasets_with_results(3)
assert_equal(0, d1.jobs_running.size)
assert_equal(0, d1.jobs_to_run.size)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 test_start
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_start
p = project
d = daemon
d.runopts(:latency, 0, true)
assert_equal(0, d.latency)
- Create a ticketCreate a ticket
Method test_check_datasets
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_check_datasets
p = project
d = daemon
d.runopts(:maxjobs, 0, true)
assert_empty(d.jobs_to_run)
- Create a ticketCreate a ticket
Use each_key
instead of keys.each
. Open
MiGA::Project.RESULT_DIRS.keys.each { |i| p1.metadata["run_#{i}"] = false }
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for uses of each_key
and each_value
Hash methods.
Note: If you have an array of two-element arrays, you can put parentheses around the block arguments to indicate that you're not working with a hash, and suppress RuboCop offenses.
Example:
# bad
hash.keys.each { |k| p k }
hash.values.each { |v| p v }
hash.each { |k, _v| p k }
hash.each { |_k, v| p v }
# good
hash.each_key { |k| p k }
hash.each_value { |v| p v }
Missing magic comment # frozen_string_literal: true
. Open
require 'test_helper'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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