rubocop-rails 2.34.1 → 2.34.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 +4 -4
- data/lib/rubocop/cop/rails/presence.rb +6 -1
- data/lib/rubocop/rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0ba3287dd87a87e513f027365ed1e2f726a812b513f92c70e63e1e1792d2ce45
|
|
4
|
+
data.tar.gz: 375105175c67eebfbf7f82469ca3a8b8540779199e2d9542990fc219c6c57412
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd06a6c9f0cc892c20473c640ae9bc27d2fd02b2e7ccb1c763c6d4ab0008cc9b3699f9ef8d32aadecc4f5d0eb89066a14495852e3b7fabedc4e0702dd3c2b132
|
|
7
|
+
data.tar.gz: 2353dca7cb758e658688f8fed9343a20f16355d5f3a3170d4e3e1472adb03b4466404067966124c55101e586b5e1009efc96ef4b95d0982ab3c9ed0f7fac2d3e
|
|
@@ -68,6 +68,7 @@ module RuboCop
|
|
|
68
68
|
extend AutoCorrector
|
|
69
69
|
|
|
70
70
|
MSG = 'Use `%<prefer>s` instead of `%<current>s`.'
|
|
71
|
+
INDEX_ACCESS_METHODS = %i[[] []=].freeze
|
|
71
72
|
|
|
72
73
|
def_node_matcher :redundant_receiver_and_other, <<~PATTERN
|
|
73
74
|
{
|
|
@@ -140,7 +141,7 @@ module RuboCop
|
|
|
140
141
|
end
|
|
141
142
|
|
|
142
143
|
def ignore_chain_node?(node)
|
|
143
|
-
|
|
144
|
+
index_access_method?(node) || node.assignment? || node.arithmetic_operation? || node.comparison_method?
|
|
144
145
|
end
|
|
145
146
|
|
|
146
147
|
def message(node, replacement)
|
|
@@ -190,6 +191,10 @@ module RuboCop
|
|
|
190
191
|
replaced += "(#{chain.arguments.map(&:source).join(', ')})" if chain.arguments?
|
|
191
192
|
left_sibling ? "(#{replaced})" : replaced
|
|
192
193
|
end
|
|
194
|
+
|
|
195
|
+
def index_access_method?(node)
|
|
196
|
+
INDEX_ACCESS_METHODS.include?(node.method_name)
|
|
197
|
+
end
|
|
193
198
|
end
|
|
194
199
|
end
|
|
195
200
|
end
|