Class: RuboCop::Cop::Captive::NoAppEnv

Inherits:
RuboCop::Cop::Cop
  • Object
show all
Defined in:
lib/rubocop/cop/captive/no_app_env.rb

Overview

This cop checks for usages of the ‘APP_ENV` environment variable. Usage of `APP_ENV` is prohibited as it conflicts with standard Rails/Rack environment variable `RAILS_ENV` and may lead to unexpected results.

Constant Summary collapse

MSG =
"Do not use `APP_ENV` environment variable as it conflicts with "\
"standard Rails/Rack environment variable `RAILS_ENV`."

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



21
22
23
24
# File 'lib/rubocop/cop/captive/no_app_env.rb', line 21

def on_send(node)
  return unless env_variable?(node)
  add_offense(node, message: MSG)
end