Showing 22 of 22 total issues
Use a guard clause instead of wrapping the code inside a conditional expression. (https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals) Open
Open
unless @multiplex_manager.active?(@machine_name)
- Read upRead up
- 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
, define respond_to_missing?
and fall back on super
. (https://github.com/bbatsov/ruby-style-guide#no-method-missing) Open
Open
def self.method_missing(*)
DummyConfig
end
- Read upRead up
- 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