Skip to content

Commit

Permalink
Update cop offense message for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
javierjulio committed Nov 22, 2024
1 parent d33f2be commit 71a54eb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/rubocop/cop/jackpocket/sneakers_job_control_signal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SneakersJobControlSignal < Base
(... (send nil? {:ack! :reject! :requeue!}))
PATTERN

MSG = 'The last line in `work` method must be `ack!`, `reject!`, or `requeue!`'.freeze
MSG = 'The `work` method must return `ack!`, `reject!`, or `requeue!`'.freeze

def on_def(node)
return unless node.method?(:work) && in_sneakers_worker?(node)
Expand Down
16 changes: 8 additions & 8 deletions spec/rubocop/cop/jackpocket/sneakers_job_control_signal_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class TestWorker
include Sneakers::Worker
def work(message)
^^^^^^^^^^^^^^^^^ Jackpocket/SneakersJobControlSignal: The last line in `work` method must be `ack!`, `reject!`, or `requeue!`
^^^^^^^^^^^^^^^^^ Jackpocket/SneakersJobControlSignal: The `work` method must return `ack!`, `reject!`, or `requeue!`
end
end
RUBY
Expand All @@ -92,7 +92,7 @@ def work(message)
do_something
#{signal_name}
rescue SomeError
^^^^^^^^^^^^^^^^ Jackpocket/SneakersJobControlSignal: The last line in `work` method must be `ack!`, `reject!`, or `requeue!`
^^^^^^^^^^^^^^^^ Jackpocket/SneakersJobControlSignal: The `work` method must return `ack!`, `reject!`, or `requeue!`
end
end
RUBY
Expand All @@ -107,10 +107,10 @@ class TestWorker
def work(message)
do_something
^^^^^^^^^^^^ Jackpocket/SneakersJobControlSignal: The last line in `work` method must be `ack!`, `reject!`, or `requeue!`
^^^^^^^^^^^^ Jackpocket/SneakersJobControlSignal: The `work` method must return `ack!`, `reject!`, or `requeue!`
rescue SomeError
handle_error
^^^^^^^^^^^^ Jackpocket/SneakersJobControlSignal: The last line in `work` method must be `ack!`, `reject!`, or `requeue!`
^^^^^^^^^^^^ Jackpocket/SneakersJobControlSignal: The `work` method must return `ack!`, `reject!`, or `requeue!`
end
end
RUBY
Expand All @@ -131,7 +131,7 @@ def work(message)
#{signal_name}
else
do_else
^^^^^^^ Jackpocket/SneakersJobControlSignal: The last line in `work` method must be `ack!`, `reject!`, or `requeue!`
^^^^^^^ Jackpocket/SneakersJobControlSignal: The `work` method must return `ack!`, `reject!`, or `requeue!`
end
end
RUBY
Expand All @@ -147,7 +147,7 @@ def work(message)
#{signal_name}
rescue SomeError
handle_error
^^^^^^^^^^^^ Jackpocket/SneakersJobControlSignal: The last line in `work` method must be `ack!`, `reject!`, or `requeue!`
^^^^^^^^^^^^ Jackpocket/SneakersJobControlSignal: The `work` method must return `ack!`, `reject!`, or `requeue!`
else
do_else
#{signal_name}
Expand All @@ -166,10 +166,10 @@ def work(message)
#{signal_name}
rescue SomeError
handle_error
^^^^^^^^^^^^ Jackpocket/SneakersJobControlSignal: The last line in `work` method must be `ack!`, `reject!`, or `requeue!`
^^^^^^^^^^^^ Jackpocket/SneakersJobControlSignal: The `work` method must return `ack!`, `reject!`, or `requeue!`
else
do_else
^^^^^^^ Jackpocket/SneakersJobControlSignal: The last line in `work` method must be `ack!`, `reject!`, or `requeue!`
^^^^^^^ Jackpocket/SneakersJobControlSignal: The `work` method must return `ack!`, `reject!`, or `requeue!`
end
end
RUBY
Expand Down

0 comments on commit 71a54eb

Please sign in to comment.