Showing 661 of 695 total issues
Missing top-level module documentation comment. Open
module Wrapper
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Use a guard clause instead of wrapping the code inside a conditional expression. Open
if wrapper.is_a? String
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression
Example:
# bad
def test
if something
work
end
end
# good
def test
return unless something
work
end
# also good
def test
work if something
end
# bad
if something
raise 'exception'
else
ok
end
# good
raise 'exception' if something
ok
When using method_missing
, fall back on super
. Open
def method_missing method, *opts, &proc
if (match = api_render? method)
api_render match, opts
else
delegate_to_action_view(method, opts, proc) { yield }
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for the presence of method_missing
without also
defining respond_to_missing?
and falling back on super
.
Example:
#bad
def method_missing(name, *args)
# ...
end
#good
def respond_to_missing?(name, include_private)
# ...
end
def method_missing(name, *args)
# ...
super
end
Do not suppress exceptions. Open
rescue NameError
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for rescue blocks with no body.
Example:
# bad
def some_method
do_something
rescue
# do nothing
end
Example:
# bad
begin
do_something
rescue
# do nothing
end
Example:
# good
def some_method
do_something
rescue
handle_exception
end
Example:
# good
begin
do_something
rescue
handle_exception
end
Do not use expect()
without .to
or .not_to
. Chain the methods or remove it. Open
expect(v)
- Create a ticketCreate a ticket
- Exclude checks
Missing top-level class documentation comment. Open
class Card
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Prefer Date or Time over DateTime. Open
I18n.localize(DateTime.new(date.year, date.mon, date.day),
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for uses of DateTime
that should be replaced by
Date
or Time
.
Example:
# bad - uses `DateTime` for current time
DateTime.now
# good - uses `Time` for current time
Time.now
# bad - uses `DateTime` for modern date
DateTime.iso8601('2016-06-29')
# good - uses `Date` for modern date
Date.iso8601('2016-06-29')
# good - uses `DateTime` with start argument for historical date
DateTime.iso8601('1751-04-23', Date::ENGLAND)
Missing top-level module documentation comment. Open
module MethodDelegation
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Missing top-level class documentation comment. Open
class Logger
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Prefer have_received
for setting message expectations. Setup Cardio::Mod::LoadStrategy::Eval
as a spy using allow
or instance_spy
. Open
.to receive(:new).with(instance_of(described_class))
- Create a ticketCreate a ticket
- Exclude checks
Start context description with 'when', 'with', or 'without'. Open
context "class" do
- Create a ticketCreate a ticket
- Exclude checks
The second argument to describe should be the method being tested. '#instance' or '.class'. Open
RSpec.describe Card::Codename, "Codename" do
- Create a ticketCreate a ticket
- Exclude checks
Prefer have_received
for setting message expectations. Setup store
as a spy using allow
or instance_spy
. Open
expect(store).to receive(:write).with("#{prefix}/foo", "val")
- Create a ticketCreate a ticket
- Exclude checks
Missing top-level module documentation comment. Open
module Callbacks
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Missing top-level class documentation comment. Open
class IntegrateWithDelayJob < Cardio::Job
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
When using method_missing
, define respond_to_missing?
. Open
def method_missing m, *args, &block
return super unless Card.rspec_binding
suppress_name_error do
method = eval("method(%s)" % m.inspect, Card.rspec_binding)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for the presence of method_missing
without also
defining respond_to_missing?
and falling back on super
.
Example:
#bad
def method_missing(name, *args)
# ...
end
#good
def respond_to_missing?(name, include_private)
# ...
end
def method_missing(name, *args)
# ...
super
end
Missing top-level module documentation comment. Open
module Card::Set::Type::SetTestLoad
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Don't repeat examples within an example group. Open
it "check unstable key bug" do
create "Matthias", subcards: { "+name" => "test" }
expect(Card).to exist("Matthias+name")
end
- Create a ticketCreate a ticket
- Exclude checks
Name your test subject if you need to reference it explicitly. Open
in_stage :prepare_to_validate, on: :create, trigger: -> { subject } do
- Create a ticketCreate a ticket
- Exclude checks
Use let
instead of an instance variable. Open
let(:example) { EXAMPLES[@example] }
- Create a ticketCreate a ticket
- Exclude checks