rubocop-neeto 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/default.yml +5 -6
- data/lib/rubocop/cop/neeto/direct_env_access.rb +10 -11
- data/lib/rubocop/neeto/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fef927f6b5a152b14ff20ef805c7827e613f8daa8328545d523c9d9835d7aa54
|
|
4
|
+
data.tar.gz: 7042247a4a2f2c6a67ade4f63ef09269fae0ada7eea76ed0994fac82fb4d8e51
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78bb3316b19e1711485815504076819bb08f336af7ae7b780dc4beb40f816ae71a54d5c11de2bf7144f3eeb970fd4e0297e530a61ac865e406329a9c57e50d1d
|
|
7
|
+
data.tar.gz: 6994e654164b41c70e859fe75517c6650be12ec56ff4d84508cd4de13bc888e8fe6b1278c58c163a8b17d67eab22a623bd413d5f55b2733b97a549686021c13b
|
data/config/default.yml
CHANGED
|
@@ -26,12 +26,11 @@ Neeto/UnsafeColumnDeletion:
|
|
|
26
26
|
|
|
27
27
|
Neeto/DirectEnvAccess:
|
|
28
28
|
Description: >-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
their defaults. Use `Secvault.secrets` instead.
|
|
29
|
+
`config/secrets.yml` provides a single source of truth for all environment
|
|
30
|
+
variables and their fallback values, loaded via Rails' built-in
|
|
31
|
+
`config_for`. Direct usage of `ENV` bypasses this system, making it harder
|
|
32
|
+
to track what environment variables are being used and their defaults.
|
|
33
|
+
Use `Rails.application.secrets` instead.
|
|
35
34
|
Enabled: true
|
|
36
35
|
Severity: refactor
|
|
37
36
|
VersionAdded: '0.1'
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
module RuboCop
|
|
4
4
|
module Cop
|
|
5
5
|
module Neeto
|
|
6
|
-
#
|
|
7
|
-
# environment variables and their fallback values
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
# that all environment variable access goes through `Secvault.secrets`.
|
|
6
|
+
# `config/secrets.yml` provides a single source of truth for all
|
|
7
|
+
# environment variables and their fallback values, loaded via Rails'
|
|
8
|
+
# built-in `config_for`. Direct usage of `ENV` bypasses this system,
|
|
9
|
+
# making it harder to track what environment variables are being used
|
|
10
|
+
# and their defaults. This cop enforces that all environment variable
|
|
11
|
+
# access goes through `Rails.application.secrets`.
|
|
13
12
|
#
|
|
14
13
|
# @example DirectEnvAccess: true (default)
|
|
15
|
-
# # Enforces the usage of `
|
|
14
|
+
# # Enforces the usage of `Rails.application.secrets` over direct `ENV` access.
|
|
16
15
|
#
|
|
17
16
|
# # bad
|
|
18
17
|
# api_key = ENV['STRIPE_API_KEY']
|
|
@@ -21,17 +20,17 @@ module RuboCop
|
|
|
21
20
|
# default_timezone = ENV['DEFAULT_TIMEZONE'] || 'UTC'
|
|
22
21
|
#
|
|
23
22
|
# # good
|
|
24
|
-
# api_key =
|
|
23
|
+
# api_key = Rails.application.secrets.stripe_api_key
|
|
25
24
|
#
|
|
26
25
|
# # good
|
|
27
|
-
# default_timezone =
|
|
26
|
+
# default_timezone = Rails.application.secrets.default_timezone
|
|
28
27
|
#
|
|
29
28
|
# # good (ENV access is permitted in directories other than the app directory)
|
|
30
29
|
# config.log_level = ENV.fetch('LOG_LEVEL', 'info')
|
|
31
30
|
#
|
|
32
31
|
class DirectEnvAccess < Base
|
|
33
32
|
MSG = "Do not use ENV directly. " \
|
|
34
|
-
"Use
|
|
33
|
+
"Use Rails.application.secrets to maintain a single source of truth for configuration."
|
|
35
34
|
|
|
36
35
|
def_node_matcher :env_access?, <<~PATTERN
|
|
37
36
|
(const {nil? cbase} :ENV)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubocop-neeto
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.16
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Abhay V Ashokan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-04-
|
|
11
|
+
date: 2026-04-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rubocop
|