lib/rubocop/cop/rspec/hook_argument.rb in rubocop-rspec-1.20.1 vs lib/rubocop/cop/rspec/hook_argument.rb in rubocop-rspec-1.21.0
- old
+ new
@@ -58,12 +58,13 @@
# ...
# end
class HookArgument < Cop
include ConfigurableEnforcedStyle
- IMPLICIT_MSG = 'Omit the default `%p` argument for RSpec hooks.'.freeze
- EXPLICIT_MSG = 'Use `%p` for RSpec hooks.'.freeze
+ IMPLICIT_MSG = 'Omit the default `%<scope>p` ' \
+ 'argument for RSpec hooks.'.freeze
+ EXPLICIT_MSG = 'Use `%<scope>p` for RSpec hooks.'.freeze
HOOKS = Hooks::ALL.node_pattern_union.freeze
def_node_matcher :scoped_hook, <<-PATTERN
(block $(send _ #{HOOKS} (sym ${:each :example})) ...)
@@ -100,18 +101,18 @@
return if implicit_style?
add_offense(
method_send,
location: :selector,
- message: format(EXPLICIT_MSG, style)
+ message: format(EXPLICIT_MSG, scope: style)
)
end
def explicit_message(scope)
if implicit_style?
- format(IMPLICIT_MSG, scope)
+ format(IMPLICIT_MSG, scope: scope)
else
- format(EXPLICIT_MSG, style)
+ format(EXPLICIT_MSG, scope: style)
end
end
def implicit_style?
style.equal?(:implicit)