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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c90f0ddd451c37a5c2187423524462aaa583fc0a7d4fb0342077eb792f03bfcc
4
- data.tar.gz: 7606efa668ec94c24a35b93df1062a5a6f39e8c787e013d2707f69448841b7e9
3
+ metadata.gz: 30b8495304f86e7ef0e9a7f11e12a30ab7986fb4b12cb1921870f31a1b37a42f
4
+ data.tar.gz: 1863b8766efff5dd99b2e4f2dbb4e16191f223d12dbfd51826a837f1f75eef08
5
5
  SHA512:
6
- metadata.gz: a2a0094a2edfa59ee9a517cbf5d71ae1fa0fc67042bf0c35b129872a1b6cb6f892c182a0777da2a4e34f1a4c4b4292c30d19a34083b65844802e75b021f75322
7
- data.tar.gz: e24dab2beb33688d61cf110a748d5295921c185324df366c0e02478ff44c34acb0857d8b603ca308021c7eaaf6e13d9ecbaeda1f80572b180d499c1b4e5fec5d
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 $(send _ :reverse) :each)
23
+ (send (send _ :reverse) :each)
25
24
  MATCHER
26
25
 
27
26
  def on_send(node)
28
- reverse_each?(node) do |receiver|
29
- location_of_reverse = receiver.loc.selector.begin_pos
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(replacement_range(node), UNDERSCORE)
31
+ corrector.replace(range, 'reverse_each')
36
32
  end
37
33
  end
38
34
  end
39
35
 
40
36
  private
41
37
 
42
- def replacement_range(node)
43
- range_between(node.loc.dot.begin_pos, node.loc.selector.begin_pos)
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
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module Performance
5
5
  # This module holds the RuboCop Performance version information.
6
6
  module Version
7
- STRING = '1.9.1'
7
+ STRING = '1.9.2'
8
8
 
9
9
  def self.document_version
10
10
  STRING.match('\d+\.\d+').to_s
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.1
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: 2020-11-28 00:00:00.000000000 Z
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.0.rc.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.