rubocop 0.58.0 → 0.58.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/config/default.yml +4 -0
- data/config/enabled.yml +1 -2
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +5 -0
- data/lib/rubocop/cop/mixin/ordered_gem_node.rb +9 -1
- data/lib/rubocop/cop/rails/bulk_change_table.rb +11 -6
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +2 -1
- data/lib/rubocop/cop/style/redundant_parentheses.rb +9 -1
- data/lib/rubocop/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06a6484e8b771039540df8585fe73d34a5662d78
|
4
|
+
data.tar.gz: 7a8d03e1b3bcd23bee23abad73c065de9196154c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a08758ab2ba66634215f70f0a723ec845e2ce0bfb7f6bd0ad833aa4feacaac9b1557a0d98133a6184f1b15e43e83b944b1e75b2ed0607c874f8fec73e70706a9
|
7
|
+
data.tar.gz: '090c04fa7ac19c75ade23b97b55473912f707dc164b39e1254a1c6af8bdc50ad16b343a70b1671027b46578d2e60db2d33efedffce73d1b9964089fab4218778'
|
data/README.md
CHANGED
@@ -53,7 +53,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
|
|
53
53
|
might want to use a conservative version locking in your `Gemfile`:
|
54
54
|
|
55
55
|
```rb
|
56
|
-
gem 'rubocop', '~> 0.58.
|
56
|
+
gem 'rubocop', '~> 0.58.1', require: false
|
57
57
|
```
|
58
58
|
|
59
59
|
## Quickstart
|
data/config/default.yml
CHANGED
@@ -1654,6 +1654,10 @@ Lint/UnusedMethodArgument:
|
|
1654
1654
|
AllowUnusedKeywordArguments: false
|
1655
1655
|
IgnoreEmptyMethods: true
|
1656
1656
|
|
1657
|
+
Lint/UselessAccessModifier:
|
1658
|
+
ContextCreatingMethods: []
|
1659
|
+
MethodCreatingMethods: []
|
1660
|
+
|
1657
1661
|
Lint/Void:
|
1658
1662
|
CheckForMethodsWithNoSideEffects: false
|
1659
1663
|
|
data/config/enabled.yml
CHANGED
@@ -761,8 +761,6 @@ Lint/UriRegexp:
|
|
761
761
|
Lint/UselessAccessModifier:
|
762
762
|
Description: 'Checks for useless access modifiers.'
|
763
763
|
Enabled: true
|
764
|
-
ContextCreatingMethods: []
|
765
|
-
MethodCreatingMethods: []
|
766
764
|
|
767
765
|
Lint/UselessAssignment:
|
768
766
|
Description: 'Checks for useless assignment to a local variable.'
|
@@ -1033,6 +1031,7 @@ Performance/RegexpMatch:
|
|
1033
1031
|
Description: >-
|
1034
1032
|
Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
|
1035
1033
|
`Regexp#===`, or `=~` when `MatchData` is not used.
|
1034
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#regexp-vs-stringmatch-vs-string-vs-stringmatch-code-'
|
1036
1035
|
Enabled: true
|
1037
1036
|
|
1038
1037
|
Performance/ReverseEach:
|
@@ -43,10 +43,15 @@ module RuboCop
|
|
43
43
|
'on the same line as the assignment operator `=`.'.freeze
|
44
44
|
|
45
45
|
def check_assignment(node, rhs)
|
46
|
+
return if node.send_type?
|
46
47
|
return unless rhs
|
47
48
|
return unless supported_types.include?(rhs.type)
|
48
49
|
return if rhs.first_line == rhs.last_line
|
49
50
|
|
51
|
+
check_by_enforced_style(node, rhs)
|
52
|
+
end
|
53
|
+
|
54
|
+
def check_by_enforced_style(node, rhs)
|
50
55
|
case style
|
51
56
|
when :new_line
|
52
57
|
check_new_line_offense(node, rhs)
|
@@ -37,7 +37,15 @@ module RuboCop
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def gem_name(declaration_node)
|
40
|
-
declaration_node.first_argument
|
40
|
+
gem_node = declaration_node.first_argument
|
41
|
+
|
42
|
+
find_gem_name(gem_node)
|
43
|
+
end
|
44
|
+
|
45
|
+
def find_gem_name(gem_node)
|
46
|
+
return gem_node.str_content if gem_node.str_type?
|
47
|
+
|
48
|
+
find_gem_name(gem_node.receiver)
|
41
49
|
end
|
42
50
|
|
43
51
|
def treat_comments_as_separators
|
@@ -234,8 +234,9 @@ module RuboCop
|
|
234
234
|
# @param node [RuboCop::AST::SendNode]
|
235
235
|
def add_offense_for_alter_methods(node)
|
236
236
|
# arguments: [{(sym :table)(str "table")} ...]
|
237
|
-
|
238
|
-
|
237
|
+
table_node = node.arguments[0]
|
238
|
+
return unless table_node.is_a? RuboCop::AST::BasicLiteralNode
|
239
|
+
message = format(MSG_FOR_ALTER_METHODS, table: table_node.value)
|
239
240
|
add_offense(node, message: message)
|
240
241
|
end
|
241
242
|
|
@@ -254,11 +255,15 @@ module RuboCop
|
|
254
255
|
# @param new_node [RuboCop::AST::SendNode]
|
255
256
|
def process(new_node)
|
256
257
|
# arguments: [{(sym :table)(str "table")} ...]
|
257
|
-
|
258
|
-
|
259
|
-
|
258
|
+
table_node = new_node.arguments[0]
|
259
|
+
if table_node.is_a? RuboCop::AST::BasicLiteralNode
|
260
|
+
flush unless @nodes.all? do |node|
|
261
|
+
node.arguments[0].value.to_s == table_node.value.to_s
|
262
|
+
end
|
263
|
+
@nodes << new_node
|
264
|
+
else
|
265
|
+
flush
|
260
266
|
end
|
261
|
-
@nodes << new_node
|
262
267
|
end
|
263
268
|
|
264
269
|
def flush
|
@@ -190,10 +190,18 @@ module RuboCop
|
|
190
190
|
args.one? && args.first.begin_type?
|
191
191
|
end
|
192
192
|
|
193
|
-
|
193
|
+
def first_argument?(node)
|
194
|
+
first_send_argument?(node) || first_super_argument?(node)
|
195
|
+
end
|
196
|
+
|
197
|
+
def_node_matcher :first_send_argument?, <<-PATTERN
|
194
198
|
^(send _ _ equal?(%0) ...)
|
195
199
|
PATTERN
|
196
200
|
|
201
|
+
def_node_matcher :first_super_argument?, <<-PATTERN
|
202
|
+
^(super equal?(%0) ...)
|
203
|
+
PATTERN
|
204
|
+
|
197
205
|
def call_chain_starts_with_int?(begin_node, send_node)
|
198
206
|
recv = first_part_of_call_chain(send_node)
|
199
207
|
recv && recv.int_type? && (parent = begin_node.parent) &&
|
data/lib/rubocop/version.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module RuboCop
|
4
4
|
# This module holds the RuboCop version information.
|
5
5
|
module Version
|
6
|
-
STRING = '0.58.
|
6
|
+
STRING = '0.58.1'.freeze
|
7
7
|
|
8
8
|
MSG = '%<version>s (using Parser %<parser_version>s, running on ' \
|
9
9
|
'%<ruby_engine>s %<ruby_version>s %<ruby_platform>s)'.freeze
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.58.
|
4
|
+
version: 0.58.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-07-
|
13
|
+
date: 2018-07-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: jaro_winkler
|
@@ -47,6 +47,9 @@ dependencies:
|
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '2.5'
|
50
|
+
- - "!="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.5.1.1
|
50
53
|
type: :runtime
|
51
54
|
prerelease: false
|
52
55
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -54,6 +57,9 @@ dependencies:
|
|
54
57
|
- - ">="
|
55
58
|
- !ruby/object:Gem::Version
|
56
59
|
version: '2.5'
|
60
|
+
- - "!="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.5.1.1
|
57
63
|
- !ruby/object:Gem::Dependency
|
58
64
|
name: powerpack
|
59
65
|
requirement: !ruby/object:Gem::Requirement
|