rubocop-performance 1.9.1 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubocop/cop/performance/reverse_each.rb +6 -10
- data/lib/rubocop/performance/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30b8495304f86e7ef0e9a7f11e12a30ab7986fb4b12cb1921870f31a1b37a42f
|
4
|
+
data.tar.gz: 1863b8766efff5dd99b2e4f2dbb4e16191f223d12dbfd51826a837f1f75eef08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6071b0e37b9a9683f1992b88b36e0911004e0ec8fc4b41f78ba569ce396d96840acb0eff937d519d132917dec1b0a5af9fe4d1563d743e293ee78239a59b13f
|
7
|
+
data.tar.gz: 74c457f9d7f7ef240a2fa483100ff1120fc4edba7bb64e999f78a85e106621cba4ddef1a2dae7f375f9541d021a0fa08f054edf83ebd1646423d214b4677e212
|
@@ -18,29 +18,25 @@ module RuboCop
|
|
18
18
|
|
19
19
|
MSG = 'Use `reverse_each` instead of `reverse.each`.'
|
20
20
|
RESTRICT_ON_SEND = %i[each].freeze
|
21
|
-
UNDERSCORE = '_'
|
22
21
|
|
23
22
|
def_node_matcher :reverse_each?, <<~MATCHER
|
24
|
-
(send
|
23
|
+
(send (send _ :reverse) :each)
|
25
24
|
MATCHER
|
26
25
|
|
27
26
|
def on_send(node)
|
28
|
-
reverse_each?(node) do
|
29
|
-
|
30
|
-
end_location = node.loc.selector.end_pos
|
31
|
-
|
32
|
-
range = range_between(location_of_reverse, end_location)
|
27
|
+
reverse_each?(node) do
|
28
|
+
range = offense_range(node)
|
33
29
|
|
34
30
|
add_offense(range) do |corrector|
|
35
|
-
corrector.replace(
|
31
|
+
corrector.replace(range, 'reverse_each')
|
36
32
|
end
|
37
33
|
end
|
38
34
|
end
|
39
35
|
|
40
36
|
private
|
41
37
|
|
42
|
-
def
|
43
|
-
range_between(node.loc.
|
38
|
+
def offense_range(node)
|
39
|
+
range_between(node.children.first.loc.selector.begin_pos, node.loc.selector.end_pos)
|
44
40
|
end
|
45
41
|
end
|
46
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-performance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-01-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
|
-
rubygems_version: 3.2.
|
136
|
+
rubygems_version: 3.2.3
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: Automatic performance checking tool for Ruby code.
|