rubocop 1.72.0 → 1.72.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubocop/config_loader.rb +4 -0
- data/lib/rubocop/cop/lint/redundant_type_conversion.rb +10 -0
- data/lib/rubocop/cop/style/redundant_parentheses.rb +3 -1
- data/lib/rubocop/plugin/load_error.rb +5 -14
- data/lib/rubocop/rspec/cop_helper.rb +7 -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: 9909c26bded9ccffc98132b899b68773a19b0e1259d834d2cd147abf2ca8534e
|
4
|
+
data.tar.gz: d6e58861b573240488aebcdaab3ec984a8c6fe75fd0da8cb51bfa8be3c4469ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 235ed1dea8218bf39fff25ebcb297391ced4a9aeb4c582979711c095958c0aaab44dcead59108f7463f0f0d7da046b4b9f88be0be4016bdc369259ef89c37162
|
7
|
+
data.tar.gz: b80078b908cbf8b75b0b9b047e7806521a65ca83cce802b38172d946cc625ffdd9bc255f91b1eba6e22d42670fee6aaa7d1ef2a81653a39ee1b1e869a7d0797b
|
@@ -163,6 +163,10 @@ module RuboCop
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
+
# This API is primarily intended for testing and documenting plugins.
|
167
|
+
# When testing a plugin using `rubocop/rspec/support`, the plugin is loaded automatically,
|
168
|
+
# so this API is usually not needed. It is intended to be used only when implementing tests
|
169
|
+
# that do not use `rubocop/rspec/support`.
|
166
170
|
# rubocop:disable Metrics/MethodLength
|
167
171
|
def inject_defaults!(config_yml_path)
|
168
172
|
if Pathname(config_yml_path).directory?
|
@@ -161,7 +161,10 @@ module RuboCop
|
|
161
161
|
}
|
162
162
|
PATTERN
|
163
163
|
|
164
|
+
# rubocop:disable Metrics/AbcSize
|
164
165
|
def on_send(node)
|
166
|
+
return if hash_or_set_with_block?(node)
|
167
|
+
|
165
168
|
receiver = find_receiver(node)
|
166
169
|
return unless literal_receiver?(node, receiver) ||
|
167
170
|
constructor?(node, receiver) ||
|
@@ -174,10 +177,17 @@ module RuboCop
|
|
174
177
|
corrector.remove(node.loc.dot.join(node.loc.selector))
|
175
178
|
end
|
176
179
|
end
|
180
|
+
# rubocop:enable Metrics/AbcSize
|
177
181
|
alias on_csend on_send
|
178
182
|
|
179
183
|
private
|
180
184
|
|
185
|
+
def hash_or_set_with_block?(node)
|
186
|
+
return false if !node.method?(:to_h) && !node.method?(:to_set)
|
187
|
+
|
188
|
+
node.parent&.any_block_type? || node.last_argument&.block_pass_type?
|
189
|
+
end
|
190
|
+
|
181
191
|
def find_receiver(node)
|
182
192
|
receiver = node.receiver
|
183
193
|
return unless receiver
|
@@ -217,7 +217,9 @@ module RuboCop
|
|
217
217
|
|
218
218
|
def disallowed_literal?(begin_node, node)
|
219
219
|
if node.range_type?
|
220
|
-
begin_node.parent
|
220
|
+
return false unless (parent = begin_node.parent)
|
221
|
+
|
222
|
+
parent.begin_type? && parent.children.one?
|
221
223
|
else
|
222
224
|
!raised_to_power_negative_numeric?(begin_node, node)
|
223
225
|
end
|
@@ -13,21 +13,12 @@ module RuboCop
|
|
13
13
|
|
14
14
|
def message
|
15
15
|
<<~MESSAGE
|
16
|
-
Failed
|
17
|
-
|
16
|
+
Failed to load plugin `#{@plugin_name}` because the corresponding plugin class could not be determined for instantiation.
|
17
|
+
Try upgrading it first (e.g., `bundle update #{@plugin_name}`).
|
18
|
+
If `#{@plugin_name}` is not yet a plugin, use `require: #{@plugin_name}` instead of `plugins: `#{@plugin_name}` in your configuration.
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
- If the plugin is a gem, defined in the gemspec as `default_lint_roller_plugin'
|
22
|
-
|
23
|
-
spec.metadata['default_lint_roller_plugin'] = 'MyModule::Plugin'
|
24
|
-
|
25
|
-
- Set in YAML as `plugin_class_name'; example:
|
26
|
-
|
27
|
-
plugins:
|
28
|
-
- incomplete:
|
29
|
-
require_path: my_module/plugin
|
30
|
-
plugin_class_name: "MyModule::Plugin"
|
20
|
+
For further assistance, check with the developer regarding the following points:
|
21
|
+
https://docs.rubocop.org/rubocop/plugin_migration_guide.html
|
31
22
|
MESSAGE
|
32
23
|
end
|
33
24
|
end
|
@@ -13,6 +13,13 @@ module CopHelper
|
|
13
13
|
let(:parser_engine) { ENV.fetch('PARSER_ENGINE', :parser_whitequark).to_sym }
|
14
14
|
let(:rails_version) { false }
|
15
15
|
|
16
|
+
before(:all) do
|
17
|
+
plugins = Gem.loaded_specs.filter_map do |feature_name, feature_specification|
|
18
|
+
feature_name if feature_specification.metadata['default_lint_roller_plugin']
|
19
|
+
end
|
20
|
+
RuboCop::Plugin.integrate_plugins(RuboCop::Config.new, plugins)
|
21
|
+
end
|
22
|
+
|
16
23
|
def inspect_source(source, file = nil)
|
17
24
|
RuboCop::Formatter::DisabledConfigFormatter.config_to_allow_offenses = {}
|
18
25
|
RuboCop::Formatter::DisabledConfigFormatter.detected_styles = {}
|
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.72.
|
4
|
+
version: 1.72.1
|
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-02-
|
12
|
+
date: 2025-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -1075,7 +1075,7 @@ licenses:
|
|
1075
1075
|
- MIT
|
1076
1076
|
metadata:
|
1077
1077
|
homepage_uri: https://rubocop.org/
|
1078
|
-
changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.72.
|
1078
|
+
changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.72.1
|
1079
1079
|
source_code_uri: https://github.com/rubocop/rubocop/
|
1080
1080
|
documentation_uri: https://docs.rubocop.org/rubocop/1.72/
|
1081
1081
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|