From fda41ac9de543589005f0586094d22d199f43d0f Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Sun, 8 Dec 2024 19:09:41 -0800 Subject: [PATCH] update env linter for rubocop deprecation --- lib/cops/lint/env.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cops/lint/env.rb b/lib/cops/lint/env.rb index 7d1aa4fe..a4961d38 100644 --- a/lib/cops/lint/env.rb +++ b/lib/cops/lint/env.rb @@ -3,7 +3,7 @@ module Cop module Lint # This cops checks for direct usage of ENV variables and # Rails.env - class Env < RuboCop::Cop::Cop + class Env < RuboCop::Cop::Base MSG_ENV = "Avoid direct usage of ENV in application code" MSG_RAILS_ENV = "Avoid direct usage of Rails.env in application code" USAGE_MSG = ", use configuration parameters instead" @@ -19,12 +19,12 @@ class Env < RuboCop::Cop::Cop def on_const(node) return unless env?(node) return if allowed_env?(node.parent.children.last.children.last) - add_offense(node.parent, location: :selector, message: MSG_ENV + USAGE_MSG) + add_offense(node.parent, message: MSG_ENV + USAGE_MSG) end def on_send(node) return unless rails_env?(node) - add_offense((node.parent.type == :send) ? node.parent : node, location: :selector, message: MSG_RAILS_ENV + USAGE_MSG) + add_offense((node.parent.type == :send) ? node.parent : node, message: MSG_RAILS_ENV + USAGE_MSG) end private