rubocop-rails 2.33.0 → 2.33.1
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: af326236e2f2697cca258f339f0f72d693b4b1f915acd4ba5c383c5d93c2b02c
|
4
|
+
data.tar.gz: 9f125d09868d129709ed2bc8bbeeda73fd25c296f033e378558224ea7592f82b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f510dd2a447f4762d4b2364bb76e25dac66b1f166a4eae93fc0602ba379154b2d686cb04f1569d97220857a65c6cd6ff6b55cc97f3eb6d0c207b562d4d08e71
|
7
|
+
data.tar.gz: 21334214037ac98c9256a0b198f5d556548e6a60900d02da1553ce46127f21760d7183e8e52ba2bb3b151755848f045c927f2157a0fb7d900e93fcbb82c88937
|
@@ -52,6 +52,7 @@ module RuboCop
|
|
52
52
|
order_arguments.map! { |arg| extract_column_and_direction(arg.strip) }
|
53
53
|
|
54
54
|
return if order_arguments.any?(&:nil?)
|
55
|
+
return if order_arguments.any? { |column_name, _| positional_column?(column_name) }
|
55
56
|
|
56
57
|
convert_to_preferred_arguments(order_arguments).join(', ')
|
57
58
|
end
|
@@ -68,6 +69,10 @@ module RuboCop
|
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
72
|
+
def positional_column?(column_name)
|
73
|
+
column_name.match?(/\A\d+\z/)
|
74
|
+
end
|
75
|
+
|
71
76
|
def extract_column_and_direction(order_expression)
|
72
77
|
return unless (column, direction = ORDER_EXPRESSION_REGEX.match(order_expression)&.captures)
|
73
78
|
|
@@ -97,7 +97,8 @@ module RuboCop
|
|
97
97
|
|
98
98
|
def in_transaction_block?(node)
|
99
99
|
return false unless transaction_method_name?(node.method_name)
|
100
|
-
return false unless node.parent
|
100
|
+
return false unless (parent = node.parent)
|
101
|
+
return false unless parent.any_block_type? && parent.body
|
101
102
|
|
102
103
|
node.right_siblings.none? do |sibling|
|
103
104
|
sibling.respond_to?(:loop_keyword?) && sibling.loop_keyword?
|
@@ -58,8 +58,8 @@ module RuboCop
|
|
58
58
|
(call (call _ :where $...) :exists?)
|
59
59
|
PATTERN
|
60
60
|
|
61
|
-
def_node_matcher :
|
62
|
-
(call _ :exists?
|
61
|
+
def_node_matcher :exists_with_arg?, <<~PATTERN
|
62
|
+
(call _ :exists? $!splat_type?)
|
63
63
|
PATTERN
|
64
64
|
|
65
65
|
def on_send(node)
|
@@ -91,7 +91,7 @@ module RuboCop
|
|
91
91
|
if exists_style?
|
92
92
|
where_exists_call?(node, &block)
|
93
93
|
elsif where_style?
|
94
|
-
|
94
|
+
exists_with_arg?(node) { |arg| yield([arg]) }
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|