rubocop 0.44.0 → 0.44.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubocop might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/rubocop/cop/performance/case_when_splat.rb +5 -6
- data/lib/rubocop/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07bf77b53e451dd48d1a7d64034070d803897edb
|
4
|
+
data.tar.gz: 7313b7607fef2a0d1e45dc08e5d7a6555dee875c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 077d408a822c2e5b18e7e54923edec9c2f2d4fa9d4c42ddfb1042991b910b5aadebf56ef0c9682b33d61f6c7a6ce310c5f5fe41b7c5ee805a98365b25cacc734
|
7
|
+
data.tar.gz: e4a0bdb21fd940310ec263e9b0597c89800e50acb428e358a5fc88ca1498fead34c035a509cfd8c03d3341a3f8312dca6feff910a61e6973b8c299fe65cd64f7
|
data/README.md
CHANGED
@@ -51,7 +51,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
|
|
51
51
|
might want to use a conservative version locking in your `Gemfile`:
|
52
52
|
|
53
53
|
```rb
|
54
|
-
gem 'rubocop', '~> 0.44.
|
54
|
+
gem 'rubocop', '~> 0.44.1', require: false
|
55
55
|
```
|
56
56
|
|
57
57
|
## Quickstart
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'pry'
|
4
3
|
module RuboCop
|
5
4
|
module Cop
|
6
5
|
module Performance
|
@@ -66,9 +65,9 @@ module RuboCop
|
|
66
65
|
_case_branch, *when_branches, _else_branch = *node
|
67
66
|
when_conditions =
|
68
67
|
when_branches.each_with_object([]) do |branch, conditions|
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
*condition, _ = *branch
|
69
|
+
condition.each { |c| conditions << c }
|
70
|
+
end
|
72
71
|
|
73
72
|
splat_offenses(when_conditions).reverse_each do |condition|
|
74
73
|
range = condition.parent.loc.keyword.join(condition.source_range)
|
@@ -136,12 +135,12 @@ module RuboCop
|
|
136
135
|
|
137
136
|
def new_condition_with_then(node, new_condition)
|
138
137
|
"\n#{' ' * node.loc.column}when " \
|
139
|
-
|
138
|
+
"#{new_condition} then #{node.children.last.source}"
|
140
139
|
end
|
141
140
|
|
142
141
|
def new_branch_without_then(node, body, new_condition)
|
143
142
|
"\n#{' ' * node.loc.column}when #{new_condition}\n" \
|
144
|
-
|
143
|
+
"#{' ' * body.loc.column}#{node.children.last.source}"
|
145
144
|
end
|
146
145
|
|
147
146
|
def splat_offenses(when_conditions)
|
data/lib/rubocop/version.rb
CHANGED