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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec090335cc21d999869f452a9a6b9b4cfe5dc6fa0a54b056c7d9bfd4ac5b50ee
|
4
|
+
data.tar.gz: d117c41479893741eb461de0036b9bc617e07a27a2b1f5faaa1244f180bfa52c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '058a5f90001f073c9bb595a0dc14ed402f5e03640181ec849e24120cf29ed87d0417e4721f61df67a83087d7e23c65fdf3b9258691da16fc8ab617362a18e263'
|
7
|
+
data.tar.gz: 3b67894e5523a7b7a45d7fd748caf54f05b184217c42a52197ab0a482f153b1de5801d807aa1bc4c434a1c12e21ed394c72ef4bc6fafeb4c223c10d9c03282a9
|
@@ -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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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= &&
|
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 =
|
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.
|
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-
|
13
|
+
date: 2023-11-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|