rubocop-performance 1.3.0 → 1.4.0

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: fef013a3148e1dc068ab3f3e2430a2e43f02641ce888b98178f31f2796d291fa
4
- data.tar.gz: 9454d77c9fdddef6fd20f1d9155867c98bf698c71f5e79933d05ed74e5e1458d
3
+ metadata.gz: 1b4e37268b335dd810db8ddf3b71bde2de0961faff6f01762c4462e545b31b5c
4
+ data.tar.gz: e12f8f66c38d0aedec5602fb812818385a1d540a272a7df3f0e5ac79117a0fe9
5
5
  SHA512:
6
- metadata.gz: 5ca78e431963e440efe8a21b4298c69b473717ec3601a80dce40fb5c072360508338aa9de4e8a33f93c9329c033fd410db47d7e7df3ba7afdddf520d1b0487e9
7
- data.tar.gz: 1065ae95c427f38581d054e573a5799caaacf46445f601aeb8f200c0f0772c190c4e2499c24b5fbc9bacb64ab30bec71127417d61c4206808d362e8974c6ada9
6
+ metadata.gz: 45c31b5a12937ebcae1cf78f4b9ddf21891a07f3fdeb7ff5077ae4b25338df7ef82807ece0c4663edc2b802b5441c7e35ebe5e9ae6f2472b292ea5c60ab11dc8
7
+ data.tar.gz: 2640dc57af12939b4563c7bc4235a0d0668cc7a129a9ac77a3a40cc01e53c22f72d1027b0f998a93551aa4c0af7b0e0a9eaf7e8921153b88bb647e289d2b651a
data/README.md CHANGED
@@ -32,6 +32,14 @@ Put this into your `.rubocop.yml`.
32
32
  require: rubocop-performance
33
33
  ```
34
34
 
35
+ Alternatively, use the following array notation when specifying multiple extensions.
36
+
37
+ ```yaml
38
+ require:
39
+ - rubocop-other-extension
40
+ - rubocop-performance
41
+ ```
42
+
35
43
  Now you can run `rubocop` and it will automatically load the RuboCop Performance
36
44
  cops together with the standard cops.
37
45
 
@@ -38,7 +38,7 @@ module RuboCop
38
38
  # # good
39
39
  # [1, 2, *thud].count
40
40
  # garply = [1, 2, 3]
41
- # garly.size
41
+ # garply.size
42
42
  #
43
43
  # # good
44
44
  # { a: corge, **grault }.length
@@ -53,7 +53,7 @@ module RuboCop
53
53
  MATCHER
54
54
 
55
55
  def on_send(node)
56
- return if allowed_parent?(node.parent)
56
+ return if node.ancestors.any? { |ancestor| allowed_parent?(ancestor) }
57
57
 
58
58
  counter(node) do |var, arg|
59
59
  return if allowed_variable?(var) || allowed_argument?(arg)
@@ -85,12 +85,15 @@ module RuboCop
85
85
 
86
86
  def_node_matcher :match_method?, <<-PATTERN
87
87
  {
88
- (send _recv :match _ <int ...>)
89
88
  (send _recv :match {regexp str sym})
90
89
  (send {regexp str sym} :match _)
91
90
  }
92
91
  PATTERN
93
92
 
93
+ def_node_matcher :match_with_int_arg_method?, <<-PATTERN
94
+ (send _recv :match _ (int ...))
95
+ PATTERN
96
+
94
97
  def_node_matcher :match_operator?, <<-PATTERN
95
98
  (send !nil? {:=~ :!~} !nil?)
96
99
  PATTERN
@@ -109,6 +112,7 @@ module RuboCop
109
112
  MATCH_NODE_PATTERN = <<-PATTERN
110
113
  {
111
114
  #match_method?
115
+ #match_with_int_arg_method?
112
116
  #match_operator?
113
117
  #match_threequals?
114
118
  #match_with_lvasgn?
@@ -143,7 +147,7 @@ module RuboCop
143
147
 
144
148
  def autocorrect(node)
145
149
  lambda do |corrector|
146
- if match_method?(node)
150
+ if match_method?(node) || match_with_int_arg_method?(node)
147
151
  corrector.replace(node.loc.selector, 'match?')
148
152
  elsif match_operator?(node) || match_threequals?(node)
149
153
  recv, oper, arg = *node
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Performance
5
5
  module Version
6
- STRING = '1.3.0'
6
+ STRING = '1.4.0'
7
7
  end
8
8
  end
9
9
  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.3.0
4
+ version: 1.4.0
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: 2019-05-13 00:00:00.000000000 Z
13
+ date: 2019-06-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: 0.68.0
21
+ version: 0.71.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: 0.68.0
28
+ version: 0.71.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: simplecov
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -87,10 +87,10 @@ homepage: https://github.com/rubocop-hq/rubocop-performance
87
87
  licenses:
88
88
  - MIT
89
89
  metadata:
90
- homepage_uri: https://rubocop-performance.readthedocs.io/
90
+ homepage_uri: https://docs.rubocop.org/projects/performance
91
91
  changelog_uri: https://github.com/rubocop-hq/rubocop-performance/blob/master/CHANGELOG.md
92
92
  source_code_uri: https://github.com/rubocop-hq/rubocop-performance/
93
- documentation_uri: https://rubocop-performance.readthedocs.io/
93
+ documentation_uri: https://docs.rubocop.org/projects/performance
94
94
  bug_tracker_uri: https://github.com/rubocop-hq/rubocop-performance/issues
95
95
  post_install_message:
96
96
  rdoc_options: []
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  requirements: []
110
- rubygems_version: 3.0.3
110
+ rubygems_version: 3.0.4
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Automatic performance checking tool for Ruby code.