rubocop 1.22.2 → 1.22.3
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 -0
- data/lib/rubocop/cop/layout/block_alignment.rb +3 -3
- data/lib/rubocop/cop/layout/dot_position.rb +5 -1
- data/lib/rubocop/cop/lint/deprecated_constants.rb +3 -2
- data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
- data/lib/rubocop/cop/style/select_by_regexp.rb +4 -3
- 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: f74b024d0339618cd4782bd451e3bbe8be65eab0a5f3dbfc1d2137c74848c6fa
|
4
|
+
data.tar.gz: ef762c615b2d68f52d5aac425abea13a40d097f1b7885cd1558a991dd23c136d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfdba4bbc01e69d2a0873272815dc9c03d5e95f2dce5f02186b38f2f9e1e28ae34df246e6b548cdccf0831bace4f02bfad334f59548b2bf67430431b5760731b
|
7
|
+
data.tar.gz: 662e06452c13b66a949e7a8035bc6b4b31e7af7a3cf161b9802634365a53a0b2452aeb7741ab13387186483cdf9027dc5cca736734d5d3022f78362bfabf9a5c
|
data/config/default.yml
CHANGED
@@ -1568,6 +1568,7 @@ Lint/DeprecatedConstants:
|
|
1568
1568
|
Description: 'Checks for deprecated constants.'
|
1569
1569
|
Enabled: pending
|
1570
1570
|
VersionAdded: '1.8'
|
1571
|
+
VersionChanged: '1.22'
|
1571
1572
|
# You can configure deprecated constants.
|
1572
1573
|
# If there is an alternative method, you can set alternative value as `Alternative`.
|
1573
1574
|
# And you can set the deprecated version as `DeprecatedVersion`.
|
@@ -1588,6 +1589,9 @@ Lint/DeprecatedConstants:
|
|
1588
1589
|
'FALSE':
|
1589
1590
|
Alternative: 'false'
|
1590
1591
|
DeprecatedVersion: '2.4'
|
1592
|
+
'Net::HTTPServerException':
|
1593
|
+
Alternative: 'Net::HTTPClientException'
|
1594
|
+
DeprecatedVersion: '2.6'
|
1591
1595
|
'Random::DEFAULT':
|
1592
1596
|
Alternative: 'Random.new'
|
1593
1597
|
DeprecatedVersion: '3.0'
|
@@ -101,11 +101,11 @@ module RuboCop
|
|
101
101
|
def block_end_align_target(node)
|
102
102
|
lineage = [node, *node.ancestors]
|
103
103
|
|
104
|
-
|
105
|
-
|
104
|
+
lineage.each_cons(2) do |current, parent|
|
105
|
+
return current if end_align_target?(current, parent)
|
106
106
|
end
|
107
107
|
|
108
|
-
|
108
|
+
lineage.last
|
109
109
|
end
|
110
110
|
|
111
111
|
def end_align_target?(node, parent)
|
@@ -70,7 +70,7 @@ module RuboCop
|
|
70
70
|
def proper_dot_position?(node)
|
71
71
|
selector_range = selector_range(node)
|
72
72
|
|
73
|
-
return true if same_line?(selector_range,
|
73
|
+
return true if same_line?(selector_range, end_range(node.receiver))
|
74
74
|
|
75
75
|
selector_line = selector_range.line
|
76
76
|
receiver_line = receiver_end_line(node.receiver)
|
@@ -119,6 +119,10 @@ module RuboCop
|
|
119
119
|
(node.str_type? || node.dstr_type?) && node.heredoc?
|
120
120
|
end
|
121
121
|
|
122
|
+
def end_range(node)
|
123
|
+
node.source_range.end
|
124
|
+
end
|
125
|
+
|
122
126
|
def selector_range(node)
|
123
127
|
return node unless node.call_type?
|
124
128
|
|
@@ -42,11 +42,12 @@ module RuboCop
|
|
42
42
|
# Maybe further investigation of RuboCop AST will lead to an essential solution.
|
43
43
|
return unless node.loc
|
44
44
|
|
45
|
-
constant = node.absolute? ? constant_name(node, node.short_name
|
45
|
+
constant = node.absolute? ? constant_name(node, node.short_name) : node.source
|
46
46
|
return unless (deprecated_constant = deprecated_constants[constant])
|
47
47
|
|
48
48
|
alternative = deprecated_constant['Alternative']
|
49
49
|
version = deprecated_constant['DeprecatedVersion']
|
50
|
+
return if target_ruby_version < version.to_f
|
50
51
|
|
51
52
|
add_offense(node, message: message(alternative, node.source, version)) do |corrector|
|
52
53
|
corrector.replace(node, alternative)
|
@@ -56,7 +57,7 @@ module RuboCop
|
|
56
57
|
private
|
57
58
|
|
58
59
|
def constant_name(node, nested_constant_name)
|
59
|
-
return nested_constant_name unless node.namespace.const_type?
|
60
|
+
return nested_constant_name.to_s unless node.namespace.const_type?
|
60
61
|
|
61
62
|
constant_name(node.namespace, "#{node.namespace.short_name}::#{nested_constant_name}")
|
62
63
|
end
|
@@ -17,7 +17,7 @@ module RuboCop
|
|
17
17
|
# 1. It contains a double quote
|
18
18
|
# 2. It contains text that would become an escape sequence with double quotes
|
19
19
|
# 3. It contains text that would become an interpolation with double quotes
|
20
|
-
!/" | (?<!\\)\\[
|
20
|
+
!/" | (?<!\\)\\[aAbcdefkMnprsStuUxzZ0-7] | \#[@{$]/x.match?(src)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -85,7 +85,7 @@ module RuboCop
|
|
85
85
|
return unless (regexp_method_send_node = extract_send_node(block_node))
|
86
86
|
return if match_predicate_without_receiver?(regexp_method_send_node)
|
87
87
|
|
88
|
-
regexp = find_regexp(regexp_method_send_node)
|
88
|
+
regexp = find_regexp(regexp_method_send_node, block_node)
|
89
89
|
register_offense(node, block_node, regexp)
|
90
90
|
end
|
91
91
|
|
@@ -119,10 +119,11 @@ module RuboCop
|
|
119
119
|
regexp_method_send_node
|
120
120
|
end
|
121
121
|
|
122
|
-
def find_regexp(node)
|
122
|
+
def find_regexp(node, block)
|
123
123
|
return node.child_nodes.first if node.match_with_lvasgn_type?
|
124
124
|
|
125
|
-
if node.receiver.lvar_type?
|
125
|
+
if node.receiver.lvar_type? &&
|
126
|
+
(block.numblock_type? || node.receiver.source == block.arguments.first.source)
|
126
127
|
node.first_argument
|
127
128
|
elsif node.first_argument.lvar_type?
|
128
129
|
node.receiver
|
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.22.
|
4
|
+
version: 1.22.3
|
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-10-
|
13
|
+
date: 2021-10-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parallel
|