Class: RuboCop::Cop::Sidekiq::NoNilReturn
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Sidekiq::NoNilReturn
- Defined in:
- lib/rubocop/cop/sidekiq/no_nil_return.rb
Overview
Ensure workers avoid returning early
bad
def perform return if condition ... end
good
def perform
TDB, idea would be raise SilentError if condition
end
Constant Summary collapse
- MSG =
'Avoid using early nil return in workers.'
Instance Method Summary collapse
Instance Method Details
#on_return(node) ⇒ Object
22 23 24 |
# File 'lib/rubocop/cop/sidekiq/no_nil_return.rb', line 22 def on_return(node) add_offense(node) if node.arguments.first&.nil_type? || node.arguments.empty? end |