rubocop-config-captive 1.9.7 → 1.10.0

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: ec5056c440c47a77d6ebdfd69d963c4772814f674abf69787c86e341924db80e
4
- data.tar.gz: 5e9e205eb6474d30048e1bb1b22ff9c9e1a958d3dbeece107c68ff3066eaa4e1
3
+ metadata.gz: ec090335cc21d999869f452a9a6b9b4cfe5dc6fa0a54b056c7d9bfd4ac5b50ee
4
+ data.tar.gz: d117c41479893741eb461de0036b9bc617e07a27a2b1f5faaa1244f180bfa52c
5
5
  SHA512:
6
- metadata.gz: 3a5092b21d89eb654468c1008dd185ccbba615e9237f1112f6d2689531f6a046ff9791b4845268e67b9ca306d60eac679ca3521cca73c9955cf58ae7a582f525
7
- data.tar.gz: c88be3fa86c62a12b903b3d238c69cb1280e17115ed693ef602fac6aa2c79bb1c205fbbab959ef560223cb7b05b89a69dbc0a4de8282c086e9204867d23f5e61
6
+ metadata.gz: '058a5f90001f073c9bb595a0dc14ed402f5e03640181ec849e24120cf29ed87d0417e4721f61df67a83087d7e23c65fdf3b9258691da16fc8ab617362a18e263'
7
+ data.tar.gz: 3b67894e5523a7b7a45d7fd748caf54f05b184217c42a52197ab0a482f153b1de5801d807aa1bc4c434a1c12e21ed394c72ef4bc6fafeb4c223c10d9c03282a9
@@ -3,6 +3,6 @@
3
3
  module RuboCop
4
4
  module Captive
5
5
  # Version information for the the Airbnb RuboCop plugin.
6
- VERSION = "1.9.7"
6
+ VERSION = "1.10.0"
7
7
  end
8
8
  end
@@ -16,17 +16,15 @@ module RuboCop
16
16
  extend AutoCorrector
17
17
 
18
18
  MSG = "force_ssl should be enabled in production."
19
+ GOOD_PRACTICE = "ENV[\"SKIP_FORCE_SSL\"].blank?"
19
20
 
20
21
  def on_send(node)
21
22
  if setting_force_ssl_not_true?(node)
22
23
  add_offense(node, message: MSG) do |corrector|
23
- # Replace with 'true' only if the argument is not already 'true'
24
- unless node.arguments.first.true_type?
25
- corrector.replace(
26
- node.arguments.first.source_range,
27
- "true"
28
- )
29
- end
24
+ corrector.replace(
25
+ node.arguments.first.source_range,
26
+ GOOD_PRACTICE
27
+ )
30
28
  end
31
29
  end
32
30
  end
@@ -40,14 +38,25 @@ module RuboCop
40
38
  private
41
39
 
42
40
  def setting_force_ssl_not_true?(node)
43
- node.method_name == :force_ssl= && !node.arguments.first.true_type?
41
+ node.method_name == :force_ssl= && node.arguments != [
42
+ s(
43
+ :send,
44
+ s(
45
+ :send,
46
+ s(:const, nil, :ENV),
47
+ :[],
48
+ s(:str, "SKIP_FORCE_SSL")
49
+ ),
50
+ :blank?
51
+ ),
52
+ ]
44
53
  end
45
54
 
46
55
  def check_comment(comment)
47
56
  return unless force_ssl_commented?(comment.text)
48
57
 
49
58
  add_offense(comment.loc.expression, message: MSG) do |corrector|
50
- corrector.replace(comment.loc.expression, "config.force_ssl = true")
59
+ corrector.replace(comment.loc.expression, "config.force_ssl = #{GOOD_PRACTICE}")
51
60
  end
52
61
  end
53
62
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-config-captive
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.7
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Captive
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-11-16 00:00:00.000000000 Z
13
+ date: 2023-11-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop