Block has too many lines. [111/25] Open
describe "due_date_functions" do
before(:each) do
@deadline_type = build(:deadline_type)
@deadline_right = build(:deadline_right)
@assignment_due_date = build(:assignment_due_date, deadline_type: @deadline_type,
- Read upRead up
- Exclude checks
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.
Block has too many lines. [40/25] Open
describe "#get_next_due_date" do
it "no subsequent due date" do
expect(DueDate.get_next_due_date(@assignment_due_date.parent_id)).to be nil
end
- Read upRead up
- Exclude checks
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.
Useless assignment to variable - due_date
. Open
due_date = create(:topic_due_date, deadline_type: @deadline_type,
- Read upRead up
- Exclude checks
This cop checks for every useless assignment to local variable in every
scope.
The basic idea for this cop was from the warning of ruby -cw
:
assigned but unused variable - foo
Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.
Example:
# bad
def some_method
some_var = 1
do_something
end
Example:
# good
def some_method
some_var = 1
do_something(some_var)
end
Avoid comparing a variable with multiple items in a conditional, use Array#include?
instead. Open
date = if n == 1 || n == 9
nil
else
Time.zone.now - 60 * n
end
- Read upRead up
- Exclude checks
This cop checks against comparing a variable with multiple items, where
Array#include?
could be used instead to avoid code repetition.
Example:
# bad
a = 'a'
foo if a == 'a' || a == 'b' || a == 'c'
# good
a = 'a'
foo if ['a', 'b', 'c'].include?(a)
Useless assignment to variable - due_date
. Open
due_date = create(:assignment_due_date, deadline_type: @deadline_type,
- Read upRead up
- Exclude checks
This cop checks for every useless assignment to local variable in every
scope.
The basic idea for this cop was from the warning of ruby -cw
:
assigned but unused variable - foo
Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.
Example:
# bad
def some_method
some_var = 1
do_something
end
Example:
# good
def some_method
some_var = 1
do_something(some_var)
end