rubocop 1.53.0 → 1.53.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7b38b9b2471ab2c5972c061427da41ddf9820f91b21e7fa5d89330b2647eaa5
|
4
|
+
data.tar.gz: 1a48aaee106f9e6c0459c8c5ef0a98dc39455bf06a68174d6b52ac2ea74abb0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 181bd1ac83ae045a457b3b5b73bf8e18e964f7413cabfa843d594a10cc7435403827e0b001ef4d5574c0065944e942adb908b0e4bfac8766486f2c58dd10e8e1
|
7
|
+
data.tar.gz: b14fad843c6eb6ba3aa2e521133fe63da2abfed97fb79b1e45893c055c273180d1f0d0ed25cf53c53885d41859637c4469a2527617bb1c84125331a4eaf24fa3
|
@@ -124,7 +124,7 @@ module RuboCop
|
|
124
124
|
source == value ||
|
125
125
|
# `Symbol#inspect` uses double quotes, but allow single-quoted
|
126
126
|
# symbols to work as well.
|
127
|
-
source.tr("'", '"') == value
|
127
|
+
source.gsub('"', '\"').tr("'", '"') == value
|
128
128
|
end
|
129
129
|
|
130
130
|
def requires_quotes?(sym_node)
|
@@ -22,7 +22,7 @@ module RuboCop
|
|
22
22
|
|
23
23
|
def on_send(node)
|
24
24
|
return unless node.method?(:require_relative)
|
25
|
-
return unless node.first_argument.str_content
|
25
|
+
return unless node.first_argument.str_content&.start_with?(CURRENT_DIRECTORY_PATH)
|
26
26
|
return unless (index = node.first_argument.source.index(CURRENT_DIRECTORY_PATH))
|
27
27
|
|
28
28
|
begin_pos = node.first_argument.source_range.begin.begin_pos + index
|
@@ -48,9 +48,7 @@ module RuboCop
|
|
48
48
|
return if !regexp_node.regopt.children.empty? || regexp_node.content == ' '
|
49
49
|
return unless determinist_regexp?(regexp_node)
|
50
50
|
|
51
|
-
|
52
|
-
quote = new_argument.include?('"') ? "'" : '"'
|
53
|
-
prefer = "#{quote}#{new_argument}#{quote}"
|
51
|
+
prefer = preferred_argument(regexp_node)
|
54
52
|
message = format(MSG, prefer: prefer, current: regexp_node.source)
|
55
53
|
|
56
54
|
add_offense(regexp_node, message: message) do |corrector|
|
@@ -64,6 +62,19 @@ module RuboCop
|
|
64
62
|
DETERMINISTIC_REGEX.match?(regexp_node.source)
|
65
63
|
end
|
66
64
|
|
65
|
+
def preferred_argument(regexp_node)
|
66
|
+
new_argument = replacement(regexp_node)
|
67
|
+
|
68
|
+
if new_argument.include?('"')
|
69
|
+
new_argument.gsub!("'", "\\\\'")
|
70
|
+
quote = "'"
|
71
|
+
else
|
72
|
+
quote = '"'
|
73
|
+
end
|
74
|
+
|
75
|
+
"#{quote}#{new_argument}#{quote}"
|
76
|
+
end
|
77
|
+
|
67
78
|
def replacement(regexp_node)
|
68
79
|
regexp_content = regexp_node.content
|
69
80
|
stack = []
|
data/lib/rubocop/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.53.
|
4
|
+
version: 1.53.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
8
8
|
- Jonas Arvidsson
|
9
9
|
- Yuji Nakayama
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-06-
|
13
|
+
date: 2023-06-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -1026,7 +1026,7 @@ metadata:
|
|
1026
1026
|
documentation_uri: https://docs.rubocop.org/rubocop/1.53/
|
1027
1027
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|
1028
1028
|
rubygems_mfa_required: 'true'
|
1029
|
-
post_install_message:
|
1029
|
+
post_install_message:
|
1030
1030
|
rdoc_options: []
|
1031
1031
|
require_paths:
|
1032
1032
|
- lib
|
@@ -1041,8 +1041,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1041
1041
|
- !ruby/object:Gem::Version
|
1042
1042
|
version: '0'
|
1043
1043
|
requirements: []
|
1044
|
-
rubygems_version: 3.
|
1045
|
-
signing_key:
|
1044
|
+
rubygems_version: 3.3.7
|
1045
|
+
signing_key:
|
1046
1046
|
specification_version: 4
|
1047
1047
|
summary: Automatic Ruby code style checking tool.
|
1048
1048
|
test_files: []
|