rubocop 1.63.2 → 1.63.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rubocop/cached_data.rb +11 -3
- data/lib/rubocop/cop/internal_affairs/example_description.rb +1 -1
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +1 -1
- data/lib/rubocop/cop/lint/unreachable_code.rb +4 -2
- data/lib/rubocop/cop/style/send.rb +4 -4
- data/lib/rubocop/cop/style/top_level_method_definition.rb +1 -1
- data/lib/rubocop/lockfile.rb +1 -1
- data/lib/rubocop/lsp/server.rb +2 -0
- data/lib/rubocop/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 280ae6904ade12bb288a774c260e7a51c2e3152446d82415f3839f41b15d83a1
|
|
4
|
+
data.tar.gz: 48b8fce72325a97238428955dde6d3dbcafacbb2b5ea5952808d088003b2a6b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9cc268aefd0aefd13db5ca31865aaf1298639da77fa3c36fba425d980c36b209550cdd1dddfd68d644c50665a33cb6908512434a25639319c41ea266015409c
|
|
7
|
+
data.tar.gz: f3b64a7ed84536a42546ef6bd8a4f6ebcb8b9402fbe01a24421ac5f3aee9efa2f4e66ce1563caf0ca2504f265fecf9c4b27e5444c20e5a2bd6803980996d39b8
|
data/lib/rubocop/cached_data.rb
CHANGED
|
@@ -48,11 +48,19 @@ module RuboCop
|
|
|
48
48
|
source_buffer = Parser::Source::Buffer.new(@filename)
|
|
49
49
|
source_buffer.source = File.read(@filename, encoding: Encoding::UTF_8)
|
|
50
50
|
offenses.map! do |o|
|
|
51
|
-
location =
|
|
52
|
-
o['location']['begin_pos'],
|
|
53
|
-
o['location']['end_pos'])
|
|
51
|
+
location = location_from_source_buffer(o, source_buffer)
|
|
54
52
|
Cop::Offense.new(o['severity'], location, o['message'], o['cop_name'], o['status'].to_sym)
|
|
55
53
|
end
|
|
56
54
|
end
|
|
55
|
+
|
|
56
|
+
def location_from_source_buffer(offense, source_buffer)
|
|
57
|
+
begin_pos = offense['location']['begin_pos']
|
|
58
|
+
end_pos = offense['location']['end_pos']
|
|
59
|
+
if begin_pos.zero? && end_pos.zero?
|
|
60
|
+
Cop::Offense::NO_LOCATION
|
|
61
|
+
else
|
|
62
|
+
Parser::Source::Range.new(source_buffer, begin_pos, end_pos)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
57
65
|
end
|
|
58
66
|
end
|
|
@@ -46,7 +46,7 @@ module RuboCop
|
|
|
46
46
|
/\A(does not|doesn't) (register|find|flag|report)/ => 'registers',
|
|
47
47
|
/\A(does not|doesn't) add (a|an|any )?offense/ => 'registers an offense',
|
|
48
48
|
/\Aregisters no offense/ => 'registers an offense',
|
|
49
|
-
/\
|
|
49
|
+
/\A(accepts|register)\b/ => 'registers'
|
|
50
50
|
}.freeze
|
|
51
51
|
|
|
52
52
|
EXPECT_NO_CORRECTIONS_DESCRIPTION_MAPPING = {
|
|
@@ -52,7 +52,7 @@ module RuboCop
|
|
|
52
52
|
# @!method deprecated_class_method?(node)
|
|
53
53
|
def_node_matcher :deprecated_class_method?, <<~PATTERN
|
|
54
54
|
{
|
|
55
|
-
(send (const {cbase nil?}
|
|
55
|
+
(send (const {cbase nil?} :ENV) {:clone :dup :freeze})
|
|
56
56
|
(send (const {cbase nil?} {:File :Dir}) :exists? _)
|
|
57
57
|
(send (const {cbase nil?} :Socket) {:gethostbyaddr :gethostbyname} ...)
|
|
58
58
|
(send nil? :attr _ boolean)
|
|
@@ -71,7 +71,7 @@ module RuboCop
|
|
|
71
71
|
expressions.any? { |expr| flow_expression?(expr) }
|
|
72
72
|
when :if
|
|
73
73
|
check_if(node)
|
|
74
|
-
when :case
|
|
74
|
+
when :case, :case_match
|
|
75
75
|
check_case(node)
|
|
76
76
|
else
|
|
77
77
|
false
|
|
@@ -89,7 +89,9 @@ module RuboCop
|
|
|
89
89
|
return false unless else_branch
|
|
90
90
|
return false unless flow_expression?(else_branch)
|
|
91
91
|
|
|
92
|
-
node.
|
|
92
|
+
branches = node.case_type? ? node.when_branches : node.in_pattern_branches
|
|
93
|
+
|
|
94
|
+
branches.all? { |branch| branch.body && flow_expression?(branch.body) }
|
|
93
95
|
end
|
|
94
96
|
end
|
|
95
97
|
end
|
|
@@ -7,12 +7,12 @@ module RuboCop
|
|
|
7
7
|
#
|
|
8
8
|
# @example
|
|
9
9
|
# # bad
|
|
10
|
-
# Foo.send(
|
|
11
|
-
# quuz.send(
|
|
10
|
+
# Foo.send(bar)
|
|
11
|
+
# quuz.send(fred)
|
|
12
12
|
#
|
|
13
13
|
# # good
|
|
14
|
-
# Foo.__send__(
|
|
15
|
-
# quuz.public_send(
|
|
14
|
+
# Foo.__send__(bar)
|
|
15
|
+
# quuz.public_send(fred)
|
|
16
16
|
class Send < Base
|
|
17
17
|
MSG = 'Prefer `Object#__send__` or `Object#public_send` to `send`.'
|
|
18
18
|
RESTRICT_ON_SEND = %i[send].freeze
|
data/lib/rubocop/lockfile.rb
CHANGED
|
@@ -60,7 +60,7 @@ module RuboCop
|
|
|
60
60
|
def parser
|
|
61
61
|
return @parser if defined?(@parser)
|
|
62
62
|
|
|
63
|
-
@parser = if @lockfile_path
|
|
63
|
+
@parser = if @lockfile_path && bundler_lock_parser_defined?
|
|
64
64
|
begin
|
|
65
65
|
lockfile = ::Bundler.read_file(@lockfile_path)
|
|
66
66
|
::Bundler::LockfileParser.new(lockfile) if lockfile
|
data/lib/rubocop/lsp/server.rb
CHANGED
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.63.
|
|
4
|
+
version: 1.63.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: 2024-04-
|
|
13
|
+
date: 2024-04-22 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: json
|
|
@@ -1032,7 +1032,7 @@ licenses:
|
|
|
1032
1032
|
- MIT
|
|
1033
1033
|
metadata:
|
|
1034
1034
|
homepage_uri: https://rubocop.org/
|
|
1035
|
-
changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.63.
|
|
1035
|
+
changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.63.3
|
|
1036
1036
|
source_code_uri: https://github.com/rubocop/rubocop/
|
|
1037
1037
|
documentation_uri: https://docs.rubocop.org/rubocop/1.63/
|
|
1038
1038
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|