rubocop 1.8.0 → 1.8.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 -0
- data/config/default.yml +1 -2
- data/lib/rubocop/config_loader.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +5 -3
- data/lib/rubocop/cop/mixin/uncommunicative_name.rb +5 -1
- data/lib/rubocop/cop/style/explicit_block_argument.rb +10 -0
- data/lib/rubocop/cop/style/single_line_methods.rb +2 -1
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +2 -2
- data/lib/rubocop/cop/style/string_concatenation.rb +1 -1
- data/lib/rubocop/cop/style/while_until_modifier.rb +2 -4
- data/lib/rubocop/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe7ec80b8cde2a075fee5a5658abf6dc74889091dae29e88482107983d2de270
|
4
|
+
data.tar.gz: 7852fe6a6d0ba9cae98439cba0dfbfda659a5a434f62eca318bcd5bc45dfd3c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4239a27259a39584a544ed4bfc7c6025ece2198d463f8a2918a98e5560cec9a5a2ea5b978f0d253e61ea700446bb49f705627d8b8e41d4ead0fef35b23b14d98
|
7
|
+
data.tar.gz: 59746b47f6bbe92dec5f6d79395ad6cd1a175d3a186005412953f0a849192673084b426bd14f6e9ac83e11dfaa0b27fc15718857b29ca6d359e2c9d387bca9c2
|
data/README.md
CHANGED
@@ -109,6 +109,7 @@ Here's a list of RuboCop's core developers:
|
|
109
109
|
* [Maxim Krizhanovski](https://github.com/darhazer)
|
110
110
|
* [Benjamin Quorning](https://github.com/bquorning)
|
111
111
|
* [Marc-André Lafortune](https://github.com/marcandre)
|
112
|
+
* [Daniel Vandersluis](https://github.com/dvandersluis)
|
112
113
|
|
113
114
|
See the [team page](https://docs.rubocop.org/rubocop/about/team.html) for more details.
|
114
115
|
|
data/config/default.yml
CHANGED
@@ -3271,9 +3271,8 @@ Style/ExplicitBlockArgument:
|
|
3271
3271
|
that just passes its arguments to another block.
|
3272
3272
|
StyleGuide: '#block-argument'
|
3273
3273
|
Enabled: true
|
3274
|
-
# May change the yielding arity.
|
3275
|
-
Safe: false
|
3276
3274
|
VersionAdded: '0.89'
|
3275
|
+
VersionChanged: '1.8'
|
3277
3276
|
|
3278
3277
|
Style/ExponentialNotation:
|
3279
3278
|
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
@@ -34,11 +34,13 @@ module RuboCop
|
|
34
34
|
|
35
35
|
def on_send(node)
|
36
36
|
return unless (receiver = node.receiver)
|
37
|
-
return unless receiver.receiver
|
37
|
+
return unless receiver.receiver&.const_type? && receiver.receiver.short_name == :Dir
|
38
38
|
return unless GLOB_METHODS.include?(receiver.method_name)
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
selector = node.loc.selector
|
41
|
+
|
42
|
+
add_offense(selector) do |corrector|
|
43
|
+
corrector.remove(selector)
|
42
44
|
corrector.remove(node.loc.dot)
|
43
45
|
end
|
44
46
|
end
|
@@ -24,7 +24,11 @@ module RuboCop
|
|
24
24
|
name = full_name.gsub(/\A(_+)/, '')
|
25
25
|
next if allowed_names.include?(name)
|
26
26
|
|
27
|
-
|
27
|
+
length = full_name.size
|
28
|
+
length += 1 if arg.restarg_type?
|
29
|
+
length += 2 if arg.kwrestarg_type?
|
30
|
+
|
31
|
+
range = arg_range(arg, length)
|
28
32
|
issue_offenses(node, range, name)
|
29
33
|
end
|
30
34
|
end
|
@@ -6,6 +6,9 @@ module RuboCop
|
|
6
6
|
# This cop enforces the use of explicit block argument to avoid writing
|
7
7
|
# block literal that just passes its arguments to another block.
|
8
8
|
#
|
9
|
+
# NOTE: This cop only registers an offense if the block args match the
|
10
|
+
# yield args exactly.
|
11
|
+
#
|
9
12
|
# @example
|
10
13
|
# # bad
|
11
14
|
# def with_tmp_dir
|
@@ -75,7 +78,14 @@ module RuboCop
|
|
75
78
|
private
|
76
79
|
|
77
80
|
def yielding_arguments?(block_args, yield_args)
|
81
|
+
yield_args = yield_args.dup.fill(
|
82
|
+
nil,
|
83
|
+
yield_args.length, block_args.length - yield_args.length
|
84
|
+
)
|
85
|
+
|
78
86
|
yield_args.zip(block_args).all? do |yield_arg, block_arg|
|
87
|
+
next false unless yield_arg && block_arg
|
88
|
+
|
79
89
|
block_arg && yield_arg.children.first == block_arg.children.first
|
80
90
|
end
|
81
91
|
end
|
@@ -89,7 +89,8 @@ module RuboCop
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def correct_to_endless(corrector, node)
|
92
|
-
|
92
|
+
arguments = node.arguments.any? ? node.arguments.source : '()'
|
93
|
+
replacement = "def #{node.method_name}#{arguments} = #{node.body.source}"
|
93
94
|
corrector.replace(node, replacement)
|
94
95
|
end
|
95
96
|
|
@@ -63,13 +63,13 @@ module RuboCop
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def autocorrect(corrector, node, if_branch)
|
66
|
+
corrector.wrap(node.condition, '(', ')') if node.condition.or_type?
|
67
|
+
|
66
68
|
if node.unless?
|
67
69
|
corrector.replace(node.loc.keyword, 'if')
|
68
70
|
corrector.insert_before(node.condition, '!')
|
69
71
|
end
|
70
72
|
|
71
|
-
corrector.wrap(node.condition, '(', ')') if node.condition.or_type?
|
72
|
-
|
73
73
|
and_operator = if_branch.unless? ? ' && !' : ' && '
|
74
74
|
if if_branch.modifier_form?
|
75
75
|
correct_for_guard_condition_style(corrector, node, if_branch, and_operator)
|
@@ -41,12 +41,10 @@ module RuboCop
|
|
41
41
|
'having a single-line body.'
|
42
42
|
|
43
43
|
def on_while(node)
|
44
|
-
return unless
|
44
|
+
return unless single_line_as_modifier?(node)
|
45
45
|
|
46
46
|
add_offense(node.loc.keyword, message: format(MSG, keyword: node.keyword)) do |corrector|
|
47
|
-
|
48
|
-
|
49
|
-
corrector.replace(node, oneline)
|
47
|
+
corrector.replace(node, to_modifier_form(node))
|
50
48
|
end
|
51
49
|
end
|
52
50
|
alias on_until on_while
|
data/lib/rubocop/version.rb
CHANGED
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: 1.8.
|
4
|
+
version: 1.8.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: 2021-01-
|
13
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parallel
|