Class: RuboCop::Cop::HGOOSTDD::NoEnvOutsideAppConfig

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/hgoostdd/no_env_outside_app_config.rb

Overview

ENV` and `ENV.fetch` should only appear in the AppConfig boundary. Domain code reads config through an injected `config:` collaborator. See HGOOSTDD §6.

Constant Summary collapse

MSG =
"Read configuration through AppConfig, not directly from ENV (§6)."

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



18
19
20
21
22
# File 'lib/rubocop/cop/hgoostdd/no_env_outside_app_config.rb', line 18

def on_send(node)
  return unless env_index?(node) || env_fetch?(node)

  add_offense(node, message: MSG)
end