rubocop 1.71.2 → 1.72.1
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 +1 -1
- data/config/default.yml +28 -0
- data/lib/rubocop/cli/command/suggest_extensions.rb +7 -1
- data/lib/rubocop/comment_config.rb +1 -1
- data/lib/rubocop/config.rb +4 -0
- data/lib/rubocop/config_loader.rb +44 -8
- data/lib/rubocop/config_loader_resolver.rb +21 -7
- data/lib/rubocop/cop/internal_affairs/location_exists.rb +116 -0
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_walker.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/plugin.rb +33 -0
- data/lib/rubocop/cop/internal_affairs/undefined_config.rb +7 -1
- data/lib/rubocop/cop/internal_affairs.rb +1 -16
- data/lib/rubocop/cop/layout/block_alignment.rb +2 -0
- data/lib/rubocop/cop/layout/else_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +22 -2
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +1 -1
- data/lib/rubocop/cop/lint/cop_directive_syntax.rb +84 -0
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_type_conversion.rb +231 -0
- data/lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb +111 -0
- data/lib/rubocop/cop/lint/useless_constant_scoping.rb +74 -0
- data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +7 -7
- data/lib/rubocop/cop/mixin/alignment.rb +2 -2
- data/lib/rubocop/cop/mixin/comments_help.rb +1 -1
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +18 -18
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +74 -74
- data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
- data/lib/rubocop/cop/mixin/range_help.rb +3 -3
- data/lib/rubocop/cop/mixin/string_help.rb +1 -1
- data/lib/rubocop/cop/naming/predicate_name.rb +44 -0
- data/lib/rubocop/cop/style/redundant_format.rb +222 -0
- data/lib/rubocop/cop/style/redundant_parentheses.rb +19 -3
- data/lib/rubocop/cop/util.rb +1 -1
- data/lib/rubocop/cop/utils/format_string.rb +7 -5
- data/lib/rubocop/directive_comment.rb +35 -2
- data/lib/rubocop/lsp/runtime.rb +2 -0
- data/lib/rubocop/lsp/server.rb +0 -2
- data/lib/rubocop/options.rb +26 -11
- data/lib/rubocop/path_util.rb +4 -0
- data/lib/rubocop/plugin/configuration_integrator.rb +141 -0
- data/lib/rubocop/plugin/load_error.rb +26 -0
- data/lib/rubocop/plugin/loader.rb +100 -0
- data/lib/rubocop/plugin/not_supported_error.rb +29 -0
- data/lib/rubocop/plugin.rb +39 -0
- data/lib/rubocop/rake_task.rb +4 -1
- data/lib/rubocop/rspec/cop_helper.rb +7 -0
- data/lib/rubocop/server/cache.rb +35 -2
- data/lib/rubocop/server/cli.rb +2 -2
- data/lib/rubocop/version.rb +17 -2
- data/lib/rubocop.rb +5 -0
- data/lib/ruby_lsp/rubocop/addon.rb +7 -10
- data/lib/ruby_lsp/rubocop/{wraps_built_in_lsp_runtime.rb → runtime_adapter.rb} +5 -8
- metadata +35 -9
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
require_relative '../../rubocop'
|
4
4
|
require_relative '../../rubocop/lsp/logger'
|
5
|
-
require_relative '
|
5
|
+
require_relative 'runtime_adapter'
|
6
6
|
|
7
7
|
module RubyLsp
|
8
8
|
module RuboCop
|
9
9
|
# A Ruby LSP add-on for RuboCop.
|
10
10
|
class Addon < RubyLsp::Addon
|
11
11
|
def initializer
|
12
|
-
@
|
12
|
+
@runtime_adapter = nil
|
13
13
|
end
|
14
14
|
|
15
15
|
def name
|
@@ -21,11 +21,8 @@ module RubyLsp
|
|
21
21
|
"Activating RuboCop LSP addon #{::RuboCop::Version::STRING}.", prefix: '[RuboCop]'
|
22
22
|
)
|
23
23
|
|
24
|
-
|
25
|
-
@
|
26
|
-
|
27
|
-
global_state.register_formatter('rubocop', @wraps_built_in_lsp_runtime)
|
28
|
-
|
24
|
+
@runtime_adapter = RuntimeAdapter.new
|
25
|
+
global_state.register_formatter('rubocop', @runtime_adapter)
|
29
26
|
register_additional_file_watchers(global_state, message_queue)
|
30
27
|
|
31
28
|
::RuboCop::LSP::Logger.log(
|
@@ -34,7 +31,7 @@ module RubyLsp
|
|
34
31
|
end
|
35
32
|
|
36
33
|
def deactivate
|
37
|
-
@
|
34
|
+
@runtime_adapter = nil
|
38
35
|
end
|
39
36
|
|
40
37
|
# rubocop:disable Layout/LineLength, Metrics/MethodLength
|
@@ -67,9 +64,9 @@ module RubyLsp
|
|
67
64
|
def workspace_did_change_watched_files(changes)
|
68
65
|
return unless changes.any? { |change| change[:uri].end_with?('.rubocop.yml') }
|
69
66
|
|
70
|
-
@
|
67
|
+
@runtime_adapter = RuntimeAdapter.new
|
71
68
|
|
72
|
-
::RuboCop::LSP::Logger(<<~MESSAGE, prefix: '[RuboCop]')
|
69
|
+
::RuboCop::LSP::Logger.log(<<~MESSAGE, prefix: '[RuboCop]')
|
73
70
|
Re-initialized RuboCop LSP addon #{::RuboCop::Version::STRING} due to .rubocop.yml file change.
|
74
71
|
MESSAGE
|
75
72
|
end
|
@@ -4,18 +4,15 @@ require_relative '../../rubocop/lsp/runtime'
|
|
4
4
|
|
5
5
|
module RubyLsp
|
6
6
|
module RuboCop
|
7
|
-
#
|
8
|
-
|
7
|
+
# Provides an adapter to bridge RuboCop's built-in LSP runtime with Ruby LSP's add-on.
|
8
|
+
# @api private
|
9
|
+
class RuntimeAdapter
|
9
10
|
include RubyLsp::Requests::Support::Formatter
|
10
11
|
|
11
12
|
def initialize
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def init!
|
16
|
-
config = ::RuboCop::ConfigStore.new
|
13
|
+
config_store = ::RuboCop::ConfigStore.new
|
17
14
|
|
18
|
-
@runtime = ::RuboCop::LSP::Runtime.new(
|
15
|
+
@runtime = ::RuboCop::LSP::Runtime.new(config_store)
|
19
16
|
end
|
20
17
|
|
21
18
|
def run_diagnostic(uri, document)
|
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.
|
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
|
@@ -29,16 +29,30 @@ dependencies:
|
|
29
29
|
name: language_server-protocol
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 3.17.0
|
34
|
+
version: 3.17.0.2
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 3.17.0.2
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: lint_roller
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 1.1.0
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
40
54
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
55
|
+
version: 1.1.0
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: parallel
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -272,6 +286,7 @@ files:
|
|
272
286
|
- lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb
|
273
287
|
- lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
|
274
288
|
- lib/rubocop/cop/internal_affairs/lambda_or_proc.rb
|
289
|
+
- lib/rubocop/cop/internal_affairs/location_exists.rb
|
275
290
|
- lib/rubocop/cop/internal_affairs/location_expression.rb
|
276
291
|
- lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb
|
277
292
|
- lib/rubocop/cop/internal_affairs/method_name_end_with.rb
|
@@ -288,6 +303,7 @@ files:
|
|
288
303
|
- lib/rubocop/cop/internal_affairs/offense_location_keyword.rb
|
289
304
|
- lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb
|
290
305
|
- lib/rubocop/cop/internal_affairs/operator_keyword.rb
|
306
|
+
- lib/rubocop/cop/internal_affairs/plugin.rb
|
291
307
|
- lib/rubocop/cop/internal_affairs/processed_source_buffer_name.rb
|
292
308
|
- lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb
|
293
309
|
- lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb
|
@@ -419,6 +435,7 @@ files:
|
|
419
435
|
- lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb
|
420
436
|
- lib/rubocop/cop/lint/constant_reassignment.rb
|
421
437
|
- lib/rubocop/cop/lint/constant_resolution.rb
|
438
|
+
- lib/rubocop/cop/lint/cop_directive_syntax.rb
|
422
439
|
- lib/rubocop/cop/lint/debugger.rb
|
423
440
|
- lib/rubocop/cop/lint/deprecated_class_methods.rb
|
424
441
|
- lib/rubocop/cop/lint/deprecated_constants.rb
|
@@ -498,6 +515,7 @@ files:
|
|
498
515
|
- lib/rubocop/cop/lint/redundant_safe_navigation.rb
|
499
516
|
- lib/rubocop/cop/lint/redundant_splat_expansion.rb
|
500
517
|
- lib/rubocop/cop/lint/redundant_string_coercion.rb
|
518
|
+
- lib/rubocop/cop/lint/redundant_type_conversion.rb
|
501
519
|
- lib/rubocop/cop/lint/redundant_with_index.rb
|
502
520
|
- lib/rubocop/cop/lint/redundant_with_object.rb
|
503
521
|
- lib/rubocop/cop/lint/refinement_import_methods.rb
|
@@ -520,6 +538,7 @@ files:
|
|
520
538
|
- lib/rubocop/cop/lint/shared_mutable_default.rb
|
521
539
|
- lib/rubocop/cop/lint/struct_new_override.rb
|
522
540
|
- lib/rubocop/cop/lint/suppressed_exception.rb
|
541
|
+
- lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb
|
523
542
|
- lib/rubocop/cop/lint/symbol_conversion.rb
|
524
543
|
- lib/rubocop/cop/lint/syntax.rb
|
525
544
|
- lib/rubocop/cop/lint/to_enum_arguments.rb
|
@@ -540,6 +559,7 @@ files:
|
|
540
559
|
- lib/rubocop/cop/lint/uri_regexp.rb
|
541
560
|
- lib/rubocop/cop/lint/useless_access_modifier.rb
|
542
561
|
- lib/rubocop/cop/lint/useless_assignment.rb
|
562
|
+
- lib/rubocop/cop/lint/useless_constant_scoping.rb
|
543
563
|
- lib/rubocop/cop/lint/useless_defined.rb
|
544
564
|
- lib/rubocop/cop/lint/useless_else_without_rescue.rb
|
545
565
|
- lib/rubocop/cop/lint/useless_method_definition.rb
|
@@ -865,6 +885,7 @@ files:
|
|
865
885
|
- lib/rubocop/cop/style/redundant_fetch_block.rb
|
866
886
|
- lib/rubocop/cop/style/redundant_file_extension_in_require.rb
|
867
887
|
- lib/rubocop/cop/style/redundant_filter_chain.rb
|
888
|
+
- lib/rubocop/cop/style/redundant_format.rb
|
868
889
|
- lib/rubocop/cop/style/redundant_freeze.rb
|
869
890
|
- lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb
|
870
891
|
- lib/rubocop/cop/style/redundant_initialize.rb
|
@@ -1008,6 +1029,11 @@ files:
|
|
1008
1029
|
- lib/rubocop/options.rb
|
1009
1030
|
- lib/rubocop/path_util.rb
|
1010
1031
|
- lib/rubocop/platform.rb
|
1032
|
+
- lib/rubocop/plugin.rb
|
1033
|
+
- lib/rubocop/plugin/configuration_integrator.rb
|
1034
|
+
- lib/rubocop/plugin/load_error.rb
|
1035
|
+
- lib/rubocop/plugin/loader.rb
|
1036
|
+
- lib/rubocop/plugin/not_supported_error.rb
|
1011
1037
|
- lib/rubocop/rake_task.rb
|
1012
1038
|
- lib/rubocop/remote_config.rb
|
1013
1039
|
- lib/rubocop/result_cache.rb
|
@@ -1043,15 +1069,15 @@ files:
|
|
1043
1069
|
- lib/rubocop/warning.rb
|
1044
1070
|
- lib/rubocop/yaml_duplication_checker.rb
|
1045
1071
|
- lib/ruby_lsp/rubocop/addon.rb
|
1046
|
-
- lib/ruby_lsp/rubocop/
|
1072
|
+
- lib/ruby_lsp/rubocop/runtime_adapter.rb
|
1047
1073
|
homepage: https://github.com/rubocop/rubocop
|
1048
1074
|
licenses:
|
1049
1075
|
- MIT
|
1050
1076
|
metadata:
|
1051
1077
|
homepage_uri: https://rubocop.org/
|
1052
|
-
changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.
|
1078
|
+
changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.72.1
|
1053
1079
|
source_code_uri: https://github.com/rubocop/rubocop/
|
1054
|
-
documentation_uri: https://docs.rubocop.org/rubocop/1.
|
1080
|
+
documentation_uri: https://docs.rubocop.org/rubocop/1.72/
|
1055
1081
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|
1056
1082
|
rubygems_mfa_required: 'true'
|
1057
1083
|
rdoc_options: []
|