rubocop-performance 1.4.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/default.yml +4 -5
- data/lib/rubocop/cop/performance/count.rb +0 -3
- data/lib/rubocop/cop/performance/detect.rb +0 -4
- data/lib/rubocop/cop/performance/flat_map.rb +8 -1
- data/lib/rubocop/cop/performance/redundant_merge.rb +1 -1
- 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: 2aa98e8177fd7ce04a6689bc8e25d5aa282feac4515b77eaa0971552d3436591
|
4
|
+
data.tar.gz: a3f2e4ae23b70b9a30418b9e207f05c626c9f998254d22f70cec3ab5018acfe9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19e52e2ff3845ed2b85574d5ec4b675492e7d92ef3713c879f3524800ab29446f278e1dd0f0a4fe82a92c3d746fce9cd352122bba478671c8bccc0a4fe10c993
|
7
|
+
data.tar.gz: 9b4657c5085913cc35d502431ae040f164b1844e0e995814bb3b23694ec157c765a385b5b69b0ee70fd0a14dfa7c2152ad715fbde9c21d4f7d6c40dce9f4ab06
|
data/config/default.yml
CHANGED
@@ -44,11 +44,10 @@ Performance/Count:
|
|
44
44
|
# This cop has known compatibility issues with `ActiveRecord` and other
|
45
45
|
# frameworks. ActiveRecord's `count` ignores the block that is passed to it.
|
46
46
|
# For more information, see the documentation in the cop itself.
|
47
|
-
|
48
|
-
SafeMode: true
|
47
|
+
SafeAutoCorrect: false
|
49
48
|
Enabled: true
|
50
49
|
VersionAdded: '0.31'
|
51
|
-
VersionChanged: '
|
50
|
+
VersionChanged: '1.5'
|
52
51
|
|
53
52
|
Performance/Detect:
|
54
53
|
Description: >-
|
@@ -59,10 +58,10 @@ Performance/Detect:
|
|
59
58
|
# frameworks. `ActiveRecord` does not implement a `detect` method and `find`
|
60
59
|
# has its own meaning. Correcting `ActiveRecord` methods with this cop
|
61
60
|
# should be considered unsafe.
|
62
|
-
|
61
|
+
SafeAutoCorrect: false
|
63
62
|
Enabled: true
|
64
63
|
VersionAdded: '0.30'
|
65
|
-
VersionChanged: '
|
64
|
+
VersionChanged: '1.5'
|
66
65
|
|
67
66
|
Performance/DoubleStartEndWith:
|
68
67
|
Description: >-
|
@@ -38,7 +38,6 @@ module RuboCop
|
|
38
38
|
#
|
39
39
|
# Model.where(id: [1, 2, 3]).to_a.count { |m| m.method == true }
|
40
40
|
class Count < Cop
|
41
|
-
include SafeMode
|
42
41
|
include RangeHelp
|
43
42
|
|
44
43
|
MSG = 'Use `count` instead of `%<selector>s...%<counter>s`.'
|
@@ -51,8 +50,6 @@ module RuboCop
|
|
51
50
|
PATTERN
|
52
51
|
|
53
52
|
def on_send(node)
|
54
|
-
return if rails_safe_mode?
|
55
|
-
|
56
53
|
count_candidate?(node) do |selector_node, selector, counter|
|
57
54
|
return unless eligible_node?(node)
|
58
55
|
|
@@ -23,8 +23,6 @@ module RuboCop
|
|
23
23
|
# own meaning. Correcting ActiveRecord methods with this cop should be
|
24
24
|
# considered unsafe.
|
25
25
|
class Detect < Cop
|
26
|
-
include SafeMode
|
27
|
-
|
28
26
|
MSG = 'Use `%<prefer>s` instead of ' \
|
29
27
|
'`%<first_method>s.%<second_method>s`.'
|
30
28
|
REVERSE_MSG = 'Use `reverse.%<prefer>s` instead of ' \
|
@@ -38,8 +36,6 @@ module RuboCop
|
|
38
36
|
PATTERN
|
39
37
|
|
40
38
|
def on_send(node)
|
41
|
-
return if rails_safe_mode?
|
42
|
-
|
43
39
|
detect_candidate?(node) do |receiver, second_method, args|
|
44
40
|
return unless args.empty?
|
45
41
|
return unless receiver
|
@@ -23,7 +23,14 @@ module RuboCop
|
|
23
23
|
'multiple levels.'
|
24
24
|
|
25
25
|
def_node_matcher :flat_map_candidate?, <<-PATTERN
|
26
|
-
(send
|
26
|
+
(send
|
27
|
+
{
|
28
|
+
(block $(send _ ${:collect :map}) ...)
|
29
|
+
$(send _ ${:collect :map} (block_pass _))
|
30
|
+
}
|
31
|
+
${:flatten :flatten!}
|
32
|
+
$...
|
33
|
+
)
|
27
34
|
PATTERN
|
28
35
|
|
29
36
|
def on_send(node)
|
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.
|
4
|
+
version: 1.5.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-
|
13
|
+
date: 2019-10-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -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.
|
110
|
+
rubygems_version: 3.0.6
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: Automatic performance checking tool for Ruby code.
|