class CustomCops::DontPrintAllEnv

Constants

MSG
This cop checks if someone accidentally print all environment variables
because some of them may contain secrets.

@example

# bad
puts ENV.to_h
puts `env`
puts ENVIRON.to_h

# good
puts ENV['SOME_KEY']
puts ENVIRON['SOME_KEY']

Public Instance Methods

on_send(node) click to toggle source
# File lib/simplycop/custom_cops/dont_print_all_env.rb, line 30
def on_send(node)
  return unless convert_env_to_hash_or_array?(node) || print_all_env_shell?(node)

  add_offense(node, location: :selector)
end