get_env 0.2.1 → 0.2.2

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: 573449592055de9a5cf540a80ac3bcf9cf37c30c8a8270d0a354d382dadec9a6
4
+ data.tar.gz: fe49d463cecf35f961809aa7c6e2ea71cabcf846b36e7d5bde33fd12577e3e20
5
5
  SHA512:
6
- metadata.gz: 398a9044aa2d6982f27eaf7a3bd56d7bdb4c690fd5a0d79a166b54ecb4775fc6520a1f5133bc106e440f17162bb148157672c11c55eb5ba0a0a7b02e6b8d2d02
7
- data.tar.gz: '036692057e61f8c0e600bcf296e8b161a0122650d4ed02fb0cb049ee805f0e053f6b0a0f98ca50a99994e86a49abf2d0f54b6a66a264650585b561d0824082c9'
6
+ metadata.gz: 0c1c7974ef31f6b82e9bb6d3acfcb7cf77eed8303662d808740195b800a695f8149a99321c90c6d04836880889b93cb690094b8904d820786597b436747818b3
7
+ data.tar.gz: 7e4fe1661df9f16f37d2c4184348223852bb7f91fdced7ad729d0eb6fb698f1555d91546b84be4f9b6b44e9597150264ebdf728e03d5fc9db4f76998e7e62fb8
@@ -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.2'
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,7 +1,7 @@
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.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Mathieu
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2023-10-19 00:00:00.000000000 Z
14
+ date: 2025-01-22 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler