Assignment Branch Condition size for test_daemon_operations is too high. [28.28/15] Open
def test_daemon_operations
d = TestWithDaemon.new(tmpdir)
FileUtils.touch(d.output_file)
assert_not_predicate(d, :active?)
- 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. [20/10] Open
def test_daemon_operations
d = TestWithDaemon.new(tmpdir)
FileUtils.touch(d.output_file)
assert_not_predicate(d, :active?)
- 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_daemmon_status is too high. [22.36/15] Open
def test_daemmon_status
d = TestWithDaemon.new(tmpdir)
out = capture_stdout { d.status }.string
assert_match(/Not running/, 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
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)
- 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_declare_alive_loop is too high. [16.28/15] Open
def test_declare_alive_loop
d = TestWithDaemon.new(tmpfile('nope'))
assert_equal(:no_home, d.declare_alive_loop)
d = TestWithDaemon.new(tmpdir)
- 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_termination_file is too high. [15.13/15] Open
def test_termination_file
d = TestWithDaemon2.new(tmpdir)
assert { !d.termination_file?(nil) }
FileUtils.touch(d.terminate_file)
err = capture_stdout do
- 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
Do not use attr
. Use attr_reader
instead. Open
attr :daemon_home
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for uses of Module#attr.
Example:
# bad - creates a single attribute accessor (deprecated in Ruby 1.9)
attr :something, true
attr :one, :two, :three # behaves as attr_reader
# good
attr_accessor :something
attr_reader :one, :two, :three
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