Just use a single message
This commit is contained in:
Родитель
a09eaddcaa
Коммит
9cfbd5915f
|
@ -9,9 +9,7 @@ module RuboCop
|
|||
class RailsControllerRenderLiteral < Base
|
||||
include RenderLiteralHelpers
|
||||
|
||||
MSG = "render must be used with a string literal or an instance of a Class"
|
||||
|
||||
LOCALS_MSG = "render must be used with a hash literal for the locals keyword argument"
|
||||
MSG = "render must be used with a string literal or an instance of a Class, and use literals for locals keys"
|
||||
|
||||
def_node_matcher :ignore_key?, <<-PATTERN
|
||||
(pair (sym {
|
||||
|
@ -101,7 +99,7 @@ module RuboCop
|
|||
if option_pairs
|
||||
locals = option_pairs.map { |pair| locals_key?(pair) }.compact.first
|
||||
if locals && (!locals.hash_type? || !hash_with_literal_keys?(locals))
|
||||
add_offense(node, message: LOCALS_MSG)
|
||||
add_offense(node)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче