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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7ae023c81bdf2e4816ffa5bed9a98fc10bcaec5e6e37c89f51eb9fb11fa452f
4
- data.tar.gz: 01bc8929e0c9ab2d80933c13c35dbcc713a04574ff51002ff2f7182e05045917
3
+ metadata.gz: 2aa98e8177fd7ce04a6689bc8e25d5aa282feac4515b77eaa0971552d3436591
4
+ data.tar.gz: a3f2e4ae23b70b9a30418b9e207f05c626c9f998254d22f70cec3ab5018acfe9
5
5
  SHA512:
6
- metadata.gz: 05da6b08dea1f6b8f16aa077bbfaa021b9586efb6895452f6af465fa03f695740370d8eb126d467c79565c204a2d76125fd0ce6137b9e18bb3dbe47d6c9ed44d
7
- data.tar.gz: b0c11d70c9677b6e7e8796523b602a7dfe8ed308dfe124b26a4935193eee4293f5147cdd198b2a277841ccea131dde686c0be965811659cb030b16e3a0841b68
6
+ metadata.gz: 19e52e2ff3845ed2b85574d5ec4b675492e7d92ef3713c879f3524800ab29446f278e1dd0f0a4fe82a92c3d746fce9cd352122bba478671c8bccc0a4fe10c993
7
+ data.tar.gz: 9b4657c5085913cc35d502431ae040f164b1844e0e995814bb3b23694ec157c765a385b5b69b0ee70fd0a14dfa7c2152ad715fbde9c21d4f7d6c40dce9f4ab06
@@ -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
- # If you understand the known risk, you can disable `SafeMode`.
48
- SafeMode: true
47
+ SafeAutoCorrect: false
49
48
  Enabled: true
50
49
  VersionAdded: '0.31'
51
- VersionChanged: '0.39'
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
- SafeMode: true
61
+ SafeAutoCorrect: false
63
62
  Enabled: true
64
63
  VersionAdded: '0.30'
65
- VersionChanged: '0.39'
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 (block $(send _ ${:collect :map}) ...) ${:flatten :flatten!} $...)
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)
@@ -132,7 +132,7 @@ module RuboCop
132
132
  end
133
133
 
134
134
  def max_key_value_pairs
135
- Integer(cop_config['MaxKeyValuePairs']) || 2
135
+ Integer(cop_config['MaxKeyValuePairs'] || 2)
136
136
  end
137
137
 
138
138
  # A utility class for checking the use of values within an
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Performance
5
5
  module Version
6
- STRING = '1.4.1'
6
+ STRING = '1.5.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.4.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-07-29 00:00:00.000000000 Z
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.4
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.