This commit is contained in:
James Dennes 2024-07-17 16:54:09 +02:00
Родитель a09eaddcaa
Коммит 9cfbd5915f
1 изменённых файлов: 2 добавлений и 4 удалений

Просмотреть файл

@ -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