get_env 0.2.1 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a69954781ff0a92ff24cbc9200e0605104f7df6228b0f389ea1400af81bbf926
4
- data.tar.gz: 1b316b87f08984ced9e07c55bf3bf94f13b9a6b68cc7441a4cf05af77f6cee4f
3
+ metadata.gz: 3d4208f781991a3c987ffe52f1da2ae867b52f8377739b00daae51fb50e9cd45
4
+ data.tar.gz: 354a7180ba24332412a9a547b2b2607bc34a7fa32fd138be1865021dc9358ce1
5
5
  SHA512:
6
- metadata.gz: 398a9044aa2d6982f27eaf7a3bd56d7bdb4c690fd5a0d79a166b54ecb4775fc6520a1f5133bc106e440f17162bb148157672c11c55eb5ba0a0a7b02e6b8d2d02
7
- data.tar.gz: '036692057e61f8c0e600bcf296e8b161a0122650d4ed02fb0cb049ee805f0e053f6b0a0f98ca50a99994e86a49abf2d0f54b6a66a264650585b561d0824082c9'
6
+ metadata.gz: 564fd865813afc8a6a03c2408cf1624faa342223a67400af4f8e2888ff90b267465711d12d10cdc30197657b69d5e8e1e6f9bfbcddb9ec34184830ffe1dfaf03
7
+ data.tar.gz: e9c4b7f0793e161a305572c6f486c54a0057f24d50efb035a10bf760f89a216686388cc979c39c14159f04243c6019a286d0669e2698a5416bcb4eede24fe3de
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GetEnv
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.3'
5
5
  end
@@ -15,7 +15,9 @@ module RuboCop
15
15
  #
16
16
  # # good
17
17
  # GetEnv.fetch(...)
18
- class NoENV < Cop
18
+ class NoENV < Base
19
+ extend AutoCorrector
20
+
19
21
  MSG = 'Use `GetEnv` instead of `ENV`.'
20
22
 
21
23
  def_node_matcher :is_ENV_index?, '(send (const nil? :ENV) :[] _key)'
@@ -25,11 +27,7 @@ module RuboCop
25
27
  parent = node.parent
26
28
  return unless is_ENV_index?(parent) || is_ENV_fetch?(parent)
27
29
 
28
- add_offense(node)
29
- end
30
-
31
- def autocorrect(node)
32
- lambda do |corrector|
30
+ add_offense(node) do |corrector|
33
31
  if Gem::Version.new(RuboCop::Version.version) >= Gem::Version.new('0.82.0')
34
32
  corrector.replace(node, 'GetEnv')
35
33
  else
@@ -15,7 +15,7 @@ RSpec.describe RuboCop::Cop::Lint::NoENV do
15
15
  it 'registers an offense when using `ENV`' do
16
16
  expect_offense(<<~RUBY)
17
17
  FOO = ENV['FOO']
18
- ^^^ Use `GetEnv` instead of `ENV`.
18
+ ^^^ Lint/NoENV: Use `GetEnv` instead of `ENV`.
19
19
  RUBY
20
20
 
21
21
  expect_correction(<<~RUBY)
@@ -34,7 +34,7 @@ RSpec.describe RuboCop::Cop::Lint::NoENV do
34
34
  it 'registers an offense when using `ENV`' do
35
35
  expect_offense(<<~RUBY)
36
36
  do_the_thing(ENV.fetch('FOO'))
37
- ^^^ Use `GetEnv` instead of `ENV`.
37
+ ^^^ Lint/NoENV: Use `GetEnv` instead of `ENV`.
38
38
  RUBY
39
39
 
40
40
  expect_correction(<<~RUBY)
@@ -45,7 +45,7 @@ RSpec.describe RuboCop::Cop::Lint::NoENV do
45
45
  it 'registers an offense when using `ENV` with a default value' do
46
46
  expect_offense(<<~RUBY)
47
47
  a = x + ENV.fetch('FOO', 42)
48
- ^^^ Use `GetEnv` instead of `ENV`.
48
+ ^^^ Lint/NoENV: Use `GetEnv` instead of `ENV`.
49
49
  RUBY
50
50
 
51
51
  expect_correction(<<~RUBY)
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: get_env
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Mathieu
8
8
  - Bartek Kruszczynski
9
9
  - Jonathan Barber
10
10
  - Paul Padier
11
- autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2023-10-19 00:00:00.000000000 Z
13
+ date: 2025-01-22 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: bundler
@@ -103,7 +102,6 @@ homepage: https://github.com/rainforestapp/get_env
103
102
  licenses:
104
103
  - MIT
105
104
  metadata: {}
106
- post_install_message:
107
105
  rdoc_options: []
108
106
  require_paths:
109
107
  - lib
@@ -118,8 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
116
  - !ruby/object:Gem::Version
119
117
  version: '0'
120
118
  requirements: []
121
- rubygems_version: 3.4.19
122
- signing_key:
119
+ rubygems_version: 3.6.2
123
120
  specification_version: 4
124
121
  summary: Read values from ENV in a reasonable way
125
122
  test_files: