rubocop 1.79.0 → 1.79.2
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/README.md +0 -2
- data/lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb +3 -1
- data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +8 -29
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +1 -1
- data/lib/rubocop/cop/lint/literal_as_condition.rb +12 -0
- data/lib/rubocop/cop/naming/method_name.rb +25 -0
- data/lib/rubocop/cop/style/arguments_forwarding.rb +11 -17
- data/lib/rubocop/cop/style/array_intersect.rb +2 -0
- data/lib/rubocop/cop/style/map_to_hash.rb +1 -3
- data/lib/rubocop/cop/style/map_to_set.rb +1 -3
- data/lib/rubocop/cop/style/parallel_assignment.rb +29 -20
- data/lib/rubocop/cop/style/redundant_parentheses.rb +16 -2
- data/lib/rubocop/cop/style/safe_navigation.rb +2 -0
- data/lib/rubocop/cop/variable_force.rb +11 -5
- data/lib/rubocop/lsp/routes.rb +4 -4
- data/lib/rubocop/result_cache.rb +13 -11
- data/lib/rubocop/version.rb +1 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f846b1bf660549b8197375e32c8219bff1e42888b925976bd3514cd9b32c1d3b
|
4
|
+
data.tar.gz: 4e862ade4bbe0c24c7734427695733316c893b5278f9868aa88c44255d03461c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05ff2343d4ddcdd26cf94325a5b9026fb7468f456b5714da5108030c39fb0fcfb7218848596d07b04817052af53bc225e66b1f81c53f18adb780c2b4bd417012
|
7
|
+
data.tar.gz: 9c2ce30fbd9467d85bed0aa581beaa225f3e5b032f0e7a5b09130c8eb2918b25e452f3704a9774e8199c1b9e1ccb1b7d10e558a710c7a73d9f9bd86940475ebf
|
data/README.md
CHANGED
@@ -6,8 +6,6 @@
|
|
6
6
|
[](https://github.com/rubocop/rubocop)
|
7
7
|
[](https://badge.fury.io/rb/rubocop)
|
8
8
|
[](https://github.com/rubocop/rubocop/actions/workflows/rubocop.yml)
|
9
|
-
[](https://codeclimate.com/github/rubocop/rubocop/test_coverage)
|
10
|
-
[](https://codeclimate.com/github/rubocop/rubocop/maintainability)
|
11
9
|
[](https://discord.gg/wJjWvGRDmm)
|
12
10
|
|
13
11
|
> Role models are important. <br/>
|
@@ -39,7 +39,7 @@ module RuboCop
|
|
39
39
|
|
40
40
|
def on_send(node)
|
41
41
|
return if node.receiver
|
42
|
-
return if node.parent&.
|
42
|
+
return if node.parent&.type?(:send, :any_block)
|
43
43
|
|
44
44
|
return if next_line_empty_or_enable_directive_comment?(node.last_line)
|
45
45
|
|
@@ -83,6 +83,8 @@ module RuboCop
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def allowed_method?(node)
|
86
|
+
node = node.body if node.respond_to?(:modifier_form?) && node.modifier_form?
|
87
|
+
|
86
88
|
return false unless node.send_type?
|
87
89
|
|
88
90
|
MODULE_INCLUSION_METHODS.include?(node.method_name)
|
@@ -62,40 +62,19 @@ module RuboCop
|
|
62
62
|
node.receiver && node.receiver.loc.last_line != node.loc.selector&.line
|
63
63
|
end
|
64
64
|
|
65
|
-
def
|
66
|
-
|
67
|
-
|
68
|
-
lines.map { |_, line| line }
|
69
|
-
end
|
70
|
-
|
71
|
-
def extra_lines(node)
|
72
|
-
empty_lines(node).each do |line|
|
73
|
-
range = source_range(processed_source.buffer, line, 0)
|
74
|
-
yield(range)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def processed_lines(node)
|
79
|
-
line_numbers(node).each_with_object([]) do |num, array|
|
80
|
-
array << [processed_source.lines[num - 1], num]
|
65
|
+
def extra_lines(node, &block)
|
66
|
+
node.arguments.each do |arg|
|
67
|
+
empty_range_for_starting_point(arg.source_range.begin, &block)
|
81
68
|
end
|
82
|
-
end
|
83
69
|
|
84
|
-
|
85
|
-
inner_lines = []
|
86
|
-
line_nums = node.arguments.each_with_object([]) do |arg_node, lines|
|
87
|
-
lines << outer_lines(arg_node)
|
88
|
-
inner_lines << inner_lines(arg_node) if arg_node.multiline?
|
89
|
-
end
|
90
|
-
line_nums.flatten.uniq - inner_lines.flatten - outer_lines(node)
|
70
|
+
empty_range_for_starting_point(node.loc.end.begin, &block) if node.loc.end
|
91
71
|
end
|
92
72
|
|
93
|
-
def
|
94
|
-
|
95
|
-
|
73
|
+
def empty_range_for_starting_point(start)
|
74
|
+
range = range_with_surrounding_space(start, whitespace: true, side: :left)
|
75
|
+
return unless range.last_line - range.first_line > 1
|
96
76
|
|
97
|
-
|
98
|
-
[node.first_line - 1, node.last_line + 1]
|
77
|
+
yield range.source_buffer.line_range(range.last_line - 1).adjust(end_pos: 1)
|
99
78
|
end
|
100
79
|
end
|
101
80
|
end
|
@@ -54,6 +54,18 @@ module RuboCop
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
+
def on_or(node)
|
58
|
+
return unless node.lhs.falsey_literal?
|
59
|
+
|
60
|
+
add_offense(node.lhs) do |corrector|
|
61
|
+
# Don't autocorrect `'foo' && return` because having `return` as
|
62
|
+
# the leftmost node can lead to a void value expression syntax error.
|
63
|
+
next if node.rhs.type?(:return, :break, :next)
|
64
|
+
|
65
|
+
corrector.replace(node, node.rhs.source)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
57
69
|
def on_if(node)
|
58
70
|
cond = condition(node)
|
59
71
|
|
@@ -53,6 +53,12 @@ module RuboCop
|
|
53
53
|
# # good
|
54
54
|
# Struct.new(:foo_bar)
|
55
55
|
#
|
56
|
+
# # bad
|
57
|
+
# alias_method :fooBar, :some_method
|
58
|
+
#
|
59
|
+
# # good
|
60
|
+
# alias_method :foo_bar, :some_method
|
61
|
+
#
|
56
62
|
# @example EnforcedStyle: camelCase
|
57
63
|
# # bad
|
58
64
|
# def foo_bar; end
|
@@ -74,6 +80,12 @@ module RuboCop
|
|
74
80
|
# # good
|
75
81
|
# Struct.new(:fooBar)
|
76
82
|
#
|
83
|
+
# # bad
|
84
|
+
# alias_method :foo_bar, :some_method
|
85
|
+
#
|
86
|
+
# # good
|
87
|
+
# alias_method :fooBar, :some_method
|
88
|
+
#
|
77
89
|
# @example ForbiddenIdentifiers: ['def', 'super']
|
78
90
|
# # bad
|
79
91
|
# def def; end
|
@@ -116,6 +128,8 @@ module RuboCop
|
|
116
128
|
handle_new_struct(node)
|
117
129
|
elsif define_data?(node)
|
118
130
|
handle_define_data(node)
|
131
|
+
elsif node.method?(:alias_method)
|
132
|
+
handle_alias_method(node)
|
119
133
|
else
|
120
134
|
handle_attr_accessor(node)
|
121
135
|
end
|
@@ -132,6 +146,10 @@ module RuboCop
|
|
132
146
|
end
|
133
147
|
alias on_defs on_def
|
134
148
|
|
149
|
+
def on_alias(node)
|
150
|
+
handle_method_name(node.new_identifier, node.new_identifier.value)
|
151
|
+
end
|
152
|
+
|
135
153
|
private
|
136
154
|
|
137
155
|
def handle_define_method(node)
|
@@ -153,6 +171,13 @@ module RuboCop
|
|
153
171
|
end
|
154
172
|
end
|
155
173
|
|
174
|
+
def handle_alias_method(node)
|
175
|
+
return unless node.arguments.size == 2
|
176
|
+
return unless node.first_argument.type?(:str, :sym)
|
177
|
+
|
178
|
+
handle_method_name(node.first_argument, node.first_argument.value)
|
179
|
+
end
|
180
|
+
|
156
181
|
def handle_attr_accessor(node)
|
157
182
|
return unless (attrs = node.attribute_accessor?)
|
158
183
|
|
@@ -146,7 +146,6 @@ module RuboCop
|
|
146
146
|
minimum_target_ruby_version 2.7
|
147
147
|
|
148
148
|
FORWARDING_LVAR_TYPES = %i[splat kwsplat block_pass].freeze
|
149
|
-
ADDITIONAL_ARG_TYPES = %i[lvar arg optarg].freeze
|
150
149
|
|
151
150
|
FORWARDING_MSG = 'Use shorthand syntax `...` for arguments forwarding.'
|
152
151
|
ARGS_MSG = 'Use anonymous positional arguments forwarding (`*`).'
|
@@ -198,9 +197,9 @@ module RuboCop
|
|
198
197
|
send_classifications.all? { |_, c, _, _| all_classifications.include?(c) }
|
199
198
|
end
|
200
199
|
|
201
|
-
# rubocop:disable Metrics/MethodLength
|
200
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
202
201
|
def add_forward_all_offenses(node, send_classifications, forwardable_args)
|
203
|
-
|
202
|
+
rest_arg, kwrest_arg, block_arg = *forwardable_args
|
204
203
|
registered_block_arg_offense = false
|
205
204
|
|
206
205
|
send_classifications.each do |send_node, c, forward_rest, forward_kwrest, forward_block_arg| # rubocop:disable Layout/LineLength
|
@@ -212,16 +211,20 @@ module RuboCop
|
|
212
211
|
registered_block_arg_offense = true
|
213
212
|
break
|
214
213
|
else
|
215
|
-
|
214
|
+
first_arg = forward_rest || forward_kwrest || forward_all_first_argument(send_node)
|
215
|
+
register_forward_all_offense(send_node, send_node, first_arg)
|
216
216
|
end
|
217
217
|
end
|
218
218
|
|
219
219
|
return if registered_block_arg_offense
|
220
220
|
|
221
|
-
|
222
|
-
|
221
|
+
register_forward_all_offense(node, node.arguments, rest_arg || kwrest_arg)
|
222
|
+
end
|
223
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
224
|
+
|
225
|
+
def forward_all_first_argument(node)
|
226
|
+
node.arguments.reverse_each.find(&:forwarded_restarg_type?)
|
223
227
|
end
|
224
|
-
# rubocop:enable Metrics/MethodLength
|
225
228
|
|
226
229
|
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
227
230
|
def add_post_ruby_32_offenses(def_node, send_classifications, forwardable_args)
|
@@ -361,18 +364,9 @@ module RuboCop
|
|
361
364
|
end
|
362
365
|
end
|
363
366
|
|
364
|
-
# rubocop:disable Metrics/AbcSize
|
365
367
|
def arguments_range(node, first_node)
|
366
|
-
|
367
|
-
next true if ADDITIONAL_ARG_TYPES.include?(arg.type) || arg.variable? || arg.call_type?
|
368
|
-
|
369
|
-
arg.literal? && arg.each_descendant(:kwsplat).none?
|
370
|
-
end
|
371
|
-
|
372
|
-
start_node = first_node || arguments.first
|
373
|
-
start_node.source_range.begin.join(arguments.last.source_range.end)
|
368
|
+
first_node.source_range.begin.join(node.last_argument.source_range.end)
|
374
369
|
end
|
375
|
-
# rubocop:enable Metrics/AbcSize
|
376
370
|
|
377
371
|
def allow_only_rest_arguments?
|
378
372
|
cop_config.fetch('AllowOnlyRestArgument', true)
|
@@ -6,9 +6,11 @@ module RuboCop
|
|
6
6
|
# In Ruby 3.1, `Array#intersect?` has been added.
|
7
7
|
#
|
8
8
|
# This cop identifies places where:
|
9
|
+
#
|
9
10
|
# * `(array1 & array2).any?`
|
10
11
|
# * `(array1.intersection(array2)).any?`
|
11
12
|
# * `array1.any? { |elem| array2.member?(elem) }`
|
13
|
+
#
|
12
14
|
# can be replaced with `array1.intersect?(array2)`.
|
13
15
|
#
|
14
16
|
# `array1.intersect?(array2)` is faster and more readable.
|
@@ -56,12 +56,10 @@ module RuboCop
|
|
56
56
|
|
57
57
|
def on_send(node)
|
58
58
|
return unless (to_h_node, map_node = map_to_h(node))
|
59
|
+
return if to_h_node.block_literal?
|
59
60
|
|
60
61
|
message = format(MSG, method: map_node.loc.selector.source, dot: to_h_node.loc.dot.source)
|
61
62
|
add_offense(map_node.loc.selector, message: message) do |corrector|
|
62
|
-
# If the `to_h` call already has a block, do not autocorrect.
|
63
|
-
next if to_h_node.block_literal?
|
64
|
-
|
65
63
|
autocorrect(corrector, to_h_node, map_node)
|
66
64
|
end
|
67
65
|
end
|
@@ -40,12 +40,10 @@ module RuboCop
|
|
40
40
|
|
41
41
|
def on_send(node)
|
42
42
|
return unless (to_set_node, map_node = map_to_set?(node))
|
43
|
+
return if to_set_node.block_literal?
|
43
44
|
|
44
45
|
message = format(MSG, method: map_node.loc.selector.source)
|
45
46
|
add_offense(map_node.loc.selector, message: message) do |corrector|
|
46
|
-
# If the `to_set` call already has a block, do not autocorrect.
|
47
|
-
next if to_set_node.block_literal?
|
48
|
-
|
49
47
|
autocorrect(corrector, to_set_node, map_node)
|
50
48
|
end
|
51
49
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'tsort'
|
4
|
-
|
5
3
|
module RuboCop
|
6
4
|
module Cop
|
7
5
|
module Style
|
@@ -94,15 +92,9 @@ module RuboCop
|
|
94
92
|
def find_valid_order(left_elements, right_elements)
|
95
93
|
# arrange left_elements in an order such that no corresponding right
|
96
94
|
# element refers to a left element earlier in the sequence
|
97
|
-
# this can be done using an algorithm called a "topological sort"
|
98
|
-
# fortunately for us, Ruby's stdlib contains an implementation
|
99
95
|
assignments = left_elements.zip(right_elements)
|
100
96
|
|
101
|
-
|
102
|
-
AssignmentSorter.new(assignments).tsort
|
103
|
-
rescue TSort::Cyclic
|
104
|
-
nil
|
105
|
-
end
|
97
|
+
AssignmentSorter.new(assignments).tsort
|
106
98
|
end
|
107
99
|
|
108
100
|
# Converts (send nil :something) nodes to (send (:self) :something).
|
@@ -117,10 +109,9 @@ module RuboCop
|
|
117
109
|
# @!method implicit_self_getter?(node)
|
118
110
|
def_node_matcher :implicit_self_getter?, '(send nil? $_)'
|
119
111
|
|
120
|
-
#
|
121
|
-
#
|
112
|
+
# Topologically sorts the assignments with Kahn's algorithm.
|
113
|
+
# https://en.wikipedia.org/wiki/Topological_sorting#Kahn's_algorithm
|
122
114
|
class AssignmentSorter
|
123
|
-
include TSort
|
124
115
|
extend RuboCop::NodePattern::Macros
|
125
116
|
|
126
117
|
# @!method var_name(node)
|
@@ -136,21 +127,39 @@ module RuboCop
|
|
136
127
|
@assignments = assignments
|
137
128
|
end
|
138
129
|
|
139
|
-
def
|
140
|
-
@assignments.
|
130
|
+
def tsort
|
131
|
+
dependencies = @assignments.to_h do |assignment|
|
132
|
+
[assignment, dependencies_for_assignment(assignment)]
|
133
|
+
end
|
134
|
+
result = []
|
135
|
+
|
136
|
+
while (matched_node, = dependencies.find { |_node, edges| edges.empty? })
|
137
|
+
dependencies.delete(matched_node)
|
138
|
+
result.push(matched_node)
|
139
|
+
|
140
|
+
dependencies.each do |node, edges|
|
141
|
+
dependencies[node].delete(matched_node) if edges.include?(matched_node)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
# Cyclic dependency
|
145
|
+
return nil if dependencies.any?
|
146
|
+
|
147
|
+
result
|
141
148
|
end
|
142
149
|
|
143
|
-
|
144
|
-
|
145
|
-
|
150
|
+
# Returns all the assignments which must come after `assignment`
|
151
|
+
# (due to dependencies on the previous value of the assigned var)
|
152
|
+
def dependencies_for_assignment(assignment)
|
146
153
|
my_lhs, _my_rhs = *assignment
|
147
154
|
|
148
|
-
@assignments.
|
149
|
-
|
155
|
+
@assignments.filter_map do |other|
|
156
|
+
# Exclude self, there are no dependencies in cases such as `a, b = a, b`.
|
157
|
+
next if other == assignment
|
150
158
|
|
159
|
+
_other_lhs, other_rhs = *other
|
151
160
|
next unless dependency?(my_lhs, other_rhs)
|
152
161
|
|
153
|
-
|
162
|
+
other
|
154
163
|
end
|
155
164
|
end
|
156
165
|
|
@@ -149,7 +149,7 @@ module RuboCop
|
|
149
149
|
return offense(begin_node, message)
|
150
150
|
end
|
151
151
|
|
152
|
-
check_send(begin_node, node) if node
|
152
|
+
check_send(begin_node, node) if call_node?(node)
|
153
153
|
end
|
154
154
|
|
155
155
|
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
@@ -169,7 +169,7 @@ module RuboCop
|
|
169
169
|
end
|
170
170
|
return 'an interpolated expression' if interpolation?(begin_node)
|
171
171
|
return 'a method argument' if argument_of_parenthesized_method_call?(begin_node, node)
|
172
|
-
return 'a one-line rescue' if
|
172
|
+
return 'a one-line rescue' if oneline_rescue_parentheses_required?(begin_node, node)
|
173
173
|
|
174
174
|
return if begin_node.chained?
|
175
175
|
|
@@ -201,6 +201,14 @@ module RuboCop
|
|
201
201
|
parent.call_type? && parent.parenthesized? && parent.receiver != begin_node
|
202
202
|
end
|
203
203
|
|
204
|
+
def oneline_rescue_parentheses_required?(begin_node, node)
|
205
|
+
return false unless node.rescue_type?
|
206
|
+
return false unless (parent = begin_node.parent)
|
207
|
+
return false if parent.if_type? && parent.ternary?
|
208
|
+
|
209
|
+
!parent.type?(:call, :array, :pair)
|
210
|
+
end
|
211
|
+
|
204
212
|
def method_call_parentheses_required?(node)
|
205
213
|
return false unless node.call_type?
|
206
214
|
|
@@ -211,7 +219,13 @@ module RuboCop
|
|
211
219
|
!!config.for_enabled_cop('Style/ParenthesesAroundCondition')['AllowInMultilineConditions']
|
212
220
|
end
|
213
221
|
|
222
|
+
def call_node?(node)
|
223
|
+
node.call_type? || (node.any_block_type? && !node.lambda_or_proc?)
|
224
|
+
end
|
225
|
+
|
214
226
|
def check_send(begin_node, node)
|
227
|
+
node = node.send_node if node.any_block_type?
|
228
|
+
|
215
229
|
return check_unary(begin_node, node) if node.unary_operation?
|
216
230
|
|
217
231
|
return unless method_call_with_redundant_parentheses?(node)
|
@@ -259,6 +259,8 @@ module RuboCop
|
|
259
259
|
end
|
260
260
|
|
261
261
|
def dotless_operator_call?(method_call)
|
262
|
+
method_call = method_call.parent while method_call.parent.send_type?
|
263
|
+
|
262
264
|
return false if method_call.loc.dot
|
263
265
|
|
264
266
|
method_call.method?(:[]) || method_call.method?(:[]=) || method_call.operator_method?
|
@@ -71,6 +71,8 @@ module RuboCop
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
+
BRANCH_NODES = %i[if case case_match rescue].freeze
|
75
|
+
|
74
76
|
def variable_table
|
75
77
|
@variable_table ||= VariableTable.new(self)
|
76
78
|
end
|
@@ -353,13 +355,17 @@ module RuboCop
|
|
353
355
|
end
|
354
356
|
end
|
355
357
|
|
356
|
-
def reference_assignments(loop_assignments,
|
357
|
-
|
358
|
+
def reference_assignments(loop_assignments, loop_node)
|
359
|
+
node = loop_assignments.first.node
|
360
|
+
|
361
|
+
# If inside a branching statement, mark all as referenced.
|
358
362
|
# Otherwise, mark only the last assignment as referenced.
|
359
|
-
|
360
|
-
|
363
|
+
# Note that `rescue` must be considered as branching because of
|
364
|
+
# the `retry` keyword.
|
365
|
+
if node.each_ancestor(*BRANCH_NODES).any? || node.parent.each_descendant(*BRANCH_NODES).any?
|
366
|
+
loop_assignments.each { |assignment| assignment.reference!(loop_node) }
|
361
367
|
else
|
362
|
-
loop_assignments.last&.reference!(
|
368
|
+
loop_assignments.last&.reference!(loop_node)
|
363
369
|
end
|
364
370
|
end
|
365
371
|
|
data/lib/rubocop/lsp/routes.rb
CHANGED
@@ -194,7 +194,7 @@ module RuboCop
|
|
194
194
|
return []
|
195
195
|
end
|
196
196
|
|
197
|
-
new_text = @server.format(
|
197
|
+
new_text = @server.format(convert_file_uri_to_path(file_uri), text, command: command)
|
198
198
|
|
199
199
|
return [] if new_text == text
|
200
200
|
|
@@ -214,13 +214,13 @@ module RuboCop
|
|
214
214
|
method: 'textDocument/publishDiagnostics',
|
215
215
|
params: {
|
216
216
|
uri: file_uri,
|
217
|
-
diagnostics: @server.offenses(
|
217
|
+
diagnostics: @server.offenses(convert_file_uri_to_path(file_uri), text)
|
218
218
|
}
|
219
219
|
}
|
220
220
|
end
|
221
221
|
|
222
|
-
def
|
223
|
-
uri.delete_prefix('file://')
|
222
|
+
def convert_file_uri_to_path(uri)
|
223
|
+
URI.decode_www_form_component(uri.delete_prefix('file://'))
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
data/lib/rubocop/result_cache.rb
CHANGED
@@ -198,20 +198,22 @@ module RuboCop
|
|
198
198
|
end
|
199
199
|
|
200
200
|
def rubocop_extra_features
|
201
|
-
|
202
|
-
|
201
|
+
@rubocop_extra_features ||= begin
|
202
|
+
lib_root = File.join(File.dirname(__FILE__), '..')
|
203
|
+
exe_root = File.join(lib_root, '..', 'exe')
|
203
204
|
|
204
|
-
|
205
|
-
|
206
|
-
|
205
|
+
# Make sure to use an absolute path to prevent errors on Windows
|
206
|
+
# when traversing the relative paths with symlinks.
|
207
|
+
exe_root = File.absolute_path(exe_root)
|
207
208
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
209
|
+
# These are all the files we have `require`d plus everything in the
|
210
|
+
# exe directory. A change to any of them could affect the cop output
|
211
|
+
# so we include them in the cache hash.
|
212
|
+
source_files = $LOADED_FEATURES + Find.find(exe_root).to_a
|
213
|
+
source_files -= ResultCache.rubocop_required_features # Rely on gem versions
|
213
214
|
|
214
|
-
|
215
|
+
source_files
|
216
|
+
end
|
215
217
|
end
|
216
218
|
|
217
219
|
# Return a hash of the options given at invocation, minus the ones that have
|
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.79.
|
4
|
+
version: 1.79.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
- Yuji Nakayama
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-
|
12
|
+
date: 2025-08-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -155,20 +155,6 @@ dependencies:
|
|
155
155
|
- - "~>"
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '1.7'
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: tsort
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
161
|
-
requirements:
|
162
|
-
- - ">="
|
163
|
-
- !ruby/object:Gem::Version
|
164
|
-
version: 0.2.0
|
165
|
-
type: :runtime
|
166
|
-
prerelease: false
|
167
|
-
version_requirements: !ruby/object:Gem::Requirement
|
168
|
-
requirements:
|
169
|
-
- - ">="
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
version: 0.2.0
|
172
158
|
- !ruby/object:Gem::Dependency
|
173
159
|
name: unicode-display_width
|
174
160
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1104,7 +1090,7 @@ licenses:
|
|
1104
1090
|
- MIT
|
1105
1091
|
metadata:
|
1106
1092
|
homepage_uri: https://rubocop.org/
|
1107
|
-
changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.79.
|
1093
|
+
changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.79.2
|
1108
1094
|
source_code_uri: https://github.com/rubocop/rubocop/
|
1109
1095
|
documentation_uri: https://docs.rubocop.org/rubocop/1.79/
|
1110
1096
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|