rubocop 1.63.4 → 1.64.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 -2
- data/config/default.yml +18 -2
- data/lib/rubocop/cli/command/show_docs_url.rb +2 -2
- data/lib/rubocop/cli.rb +4 -0
- data/lib/rubocop/config.rb +2 -3
- data/lib/rubocop/cop/base.rb +6 -13
- data/lib/rubocop/cop/bundler/gem_version.rb +3 -5
- data/lib/rubocop/cop/documentation.rb +16 -6
- data/lib/rubocop/cop/force.rb +12 -0
- data/lib/rubocop/cop/gemspec/dependency_version.rb +3 -5
- data/lib/rubocop/cop/layout/comment_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/empty_comment.rb +3 -1
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -0
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +3 -4
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +21 -14
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +5 -5
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +9 -2
- data/lib/rubocop/cop/security/compound_hash.rb +2 -2
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +50 -0
- data/lib/rubocop/cop/style/arguments_forwarding.rb +3 -1
- data/lib/rubocop/cop/style/conditional_assignment.rb +1 -1
- data/lib/rubocop/cop/style/copyright.rb +15 -10
- data/lib/rubocop/cop/style/documentation.rb +24 -24
- data/lib/rubocop/cop/style/documentation_method.rb +20 -0
- data/lib/rubocop/cop/style/hash_syntax.rb +18 -0
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +5 -3
- data/lib/rubocop/cop/style/map_into_array.rb +1 -1
- data/lib/rubocop/cop/style/numeric_predicate.rb +10 -2
- data/lib/rubocop/cop/style/one_line_conditional.rb +1 -1
- data/lib/rubocop/cop/style/redundant_line_continuation.rb +2 -1
- data/lib/rubocop/cop/style/send_with_literal_method_name.rb +90 -0
- data/lib/rubocop/cop/style/special_global_vars.rb +1 -2
- data/lib/rubocop/cop/style/super_arguments.rb +156 -0
- data/lib/rubocop/cop/style/symbol_proc.rb +32 -5
- data/lib/rubocop/cop/team.rb +2 -0
- data/lib/rubocop/formatter/disabled_config_formatter.rb +13 -9
- data/lib/rubocop/formatter/formatter_set.rb +7 -1
- data/lib/rubocop/lockfile.rb +1 -1
- data/lib/rubocop/lsp/routes.rb +10 -11
- data/lib/rubocop/lsp.rb +9 -2
- data/lib/rubocop/rake_task.rb +1 -1
- data/lib/rubocop/version.rb +1 -1
- data/lib/rubocop.rb +2 -0
- metadata +10 -8
data/lib/rubocop/lsp/routes.rb
CHANGED
@@ -45,10 +45,6 @@ module RuboCop
|
|
45
45
|
result: LanguageServer::Protocol::Interface::InitializeResult.new(
|
46
46
|
capabilities: LanguageServer::Protocol::Interface::ServerCapabilities.new(
|
47
47
|
document_formatting_provider: true,
|
48
|
-
diagnostic_provider: LanguageServer::Protocol::Interface::DiagnosticOptions.new(
|
49
|
-
inter_file_dependencies: false,
|
50
|
-
workspace_diagnostics: false
|
51
|
-
),
|
52
48
|
text_document_sync: LanguageServer::Protocol::Interface::TextDocumentSyncOptions.new(
|
53
49
|
change: LanguageServer::Protocol::Constant::TextDocumentSyncKind::FULL,
|
54
50
|
open_close: true
|
@@ -60,8 +56,9 @@ module RuboCop
|
|
60
56
|
|
61
57
|
handle 'initialized' do |_request|
|
62
58
|
version = RuboCop::Version::STRING
|
59
|
+
yjit = Object.const_defined?('RubyVM::YJIT') && RubyVM::YJIT.enabled? ? ' +YJIT' : ''
|
63
60
|
|
64
|
-
Logger.log("RuboCop #{version} language server initialized, PID #{Process.pid}")
|
61
|
+
Logger.log("RuboCop #{version} language server#{yjit} initialized, PID #{Process.pid}")
|
65
62
|
end
|
66
63
|
|
67
64
|
handle 'shutdown' do |request|
|
@@ -72,10 +69,6 @@ module RuboCop
|
|
72
69
|
end
|
73
70
|
end
|
74
71
|
|
75
|
-
handle 'textDocument/diagnostic' do |request|
|
76
|
-
# no-op, diagnostics are handled in textDocument/didChange
|
77
|
-
end
|
78
|
-
|
79
72
|
handle 'textDocument/didChange' do |request|
|
80
73
|
params = request[:params]
|
81
74
|
result = diagnostic(params[:textDocument][:uri], params[:contentChanges][0][:text])
|
@@ -124,6 +117,12 @@ module RuboCop
|
|
124
117
|
end
|
125
118
|
|
126
119
|
uri = request[:params][:arguments][0][:uri]
|
120
|
+
formatted = nil
|
121
|
+
|
122
|
+
# The `workspace/executeCommand` is an LSP method triggered by intentional user actions,
|
123
|
+
# so the user's intention for autocorrection is respected.
|
124
|
+
LSP.disable { formatted = format_file(uri, command: command) }
|
125
|
+
|
127
126
|
@server.write(
|
128
127
|
id: request[:id],
|
129
128
|
method: 'workspace/applyEdit',
|
@@ -131,7 +130,7 @@ module RuboCop
|
|
131
130
|
label: label,
|
132
131
|
edit: {
|
133
132
|
changes: {
|
134
|
-
uri =>
|
133
|
+
uri => formatted
|
135
134
|
}
|
136
135
|
}
|
137
136
|
}
|
@@ -236,7 +235,7 @@ module RuboCop
|
|
236
235
|
def to_range(location)
|
237
236
|
{
|
238
237
|
start: { character: location[:start_column] - 1, line: location[:start_line] - 1 },
|
239
|
-
end: { character: location[:last_column]
|
238
|
+
end: { character: location[:last_column], line: location[:last_line] - 1 }
|
240
239
|
}
|
241
240
|
end
|
242
241
|
end
|
data/lib/rubocop/lsp.rb
CHANGED
@@ -22,8 +22,15 @@ module RuboCop
|
|
22
22
|
# Disable LSP.
|
23
23
|
#
|
24
24
|
# @return [void]
|
25
|
-
def disable
|
26
|
-
|
25
|
+
def disable(&block)
|
26
|
+
if block
|
27
|
+
original = @enabled
|
28
|
+
@enabled = false
|
29
|
+
yield
|
30
|
+
@enabled = original
|
31
|
+
else
|
32
|
+
@enabled = false
|
33
|
+
end
|
27
34
|
end
|
28
35
|
end
|
29
36
|
end
|
data/lib/rubocop/rake_task.rb
CHANGED
@@ -44,7 +44,7 @@ module RuboCop
|
|
44
44
|
def run_cli(verbose, options)
|
45
45
|
# We lazy-load RuboCop so that the task doesn't dramatically impact the
|
46
46
|
# load time of your Rakefile.
|
47
|
-
|
47
|
+
require_relative '../rubocop'
|
48
48
|
|
49
49
|
cli = CLI.new
|
50
50
|
puts 'Running RuboCop...' if verbose
|
data/lib/rubocop/version.rb
CHANGED
data/lib/rubocop.rb
CHANGED
@@ -666,6 +666,7 @@ require_relative 'rubocop/cop/style/select_by_regexp'
|
|
666
666
|
require_relative 'rubocop/cop/style/self_assignment'
|
667
667
|
require_relative 'rubocop/cop/style/semicolon'
|
668
668
|
require_relative 'rubocop/cop/style/send'
|
669
|
+
require_relative 'rubocop/cop/style/send_with_literal_method_name'
|
669
670
|
require_relative 'rubocop/cop/style/signal_exception'
|
670
671
|
require_relative 'rubocop/cop/style/single_argument_dig'
|
671
672
|
require_relative 'rubocop/cop/style/single_line_block_params'
|
@@ -682,6 +683,7 @@ require_relative 'rubocop/cop/style/string_literals_in_interpolation'
|
|
682
683
|
require_relative 'rubocop/cop/style/string_methods'
|
683
684
|
require_relative 'rubocop/cop/style/strip'
|
684
685
|
require_relative 'rubocop/cop/style/struct_inheritance'
|
686
|
+
require_relative 'rubocop/cop/style/super_arguments'
|
685
687
|
require_relative 'rubocop/cop/style/super_with_args_parentheses'
|
686
688
|
require_relative 'rubocop/cop/style/swap_values'
|
687
689
|
require_relative 'rubocop/cop/style/symbol_array'
|
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.
|
4
|
+
version: 1.64.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: 2024-
|
13
|
+
date: 2024-05-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -885,6 +885,7 @@ files:
|
|
885
885
|
- lib/rubocop/cop/style/self_assignment.rb
|
886
886
|
- lib/rubocop/cop/style/semicolon.rb
|
887
887
|
- lib/rubocop/cop/style/send.rb
|
888
|
+
- lib/rubocop/cop/style/send_with_literal_method_name.rb
|
888
889
|
- lib/rubocop/cop/style/signal_exception.rb
|
889
890
|
- lib/rubocop/cop/style/single_argument_dig.rb
|
890
891
|
- lib/rubocop/cop/style/single_line_block_params.rb
|
@@ -904,6 +905,7 @@ files:
|
|
904
905
|
- lib/rubocop/cop/style/string_methods.rb
|
905
906
|
- lib/rubocop/cop/style/strip.rb
|
906
907
|
- lib/rubocop/cop/style/struct_inheritance.rb
|
908
|
+
- lib/rubocop/cop/style/super_arguments.rb
|
907
909
|
- lib/rubocop/cop/style/super_with_args_parentheses.rb
|
908
910
|
- lib/rubocop/cop/style/swap_values.rb
|
909
911
|
- lib/rubocop/cop/style/symbol_array.rb
|
@@ -1032,12 +1034,12 @@ licenses:
|
|
1032
1034
|
- MIT
|
1033
1035
|
metadata:
|
1034
1036
|
homepage_uri: https://rubocop.org/
|
1035
|
-
changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.
|
1037
|
+
changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.64.1
|
1036
1038
|
source_code_uri: https://github.com/rubocop/rubocop/
|
1037
|
-
documentation_uri: https://docs.rubocop.org/rubocop/1.
|
1039
|
+
documentation_uri: https://docs.rubocop.org/rubocop/1.64/
|
1038
1040
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|
1039
1041
|
rubygems_mfa_required: 'true'
|
1040
|
-
post_install_message:
|
1042
|
+
post_install_message:
|
1041
1043
|
rdoc_options: []
|
1042
1044
|
require_paths:
|
1043
1045
|
- lib
|
@@ -1052,8 +1054,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1052
1054
|
- !ruby/object:Gem::Version
|
1053
1055
|
version: '0'
|
1054
1056
|
requirements: []
|
1055
|
-
rubygems_version: 3.
|
1056
|
-
signing_key:
|
1057
|
+
rubygems_version: 3.3.7
|
1058
|
+
signing_key:
|
1057
1059
|
specification_version: 4
|
1058
1060
|
summary: Automatic Ruby code style checking tool.
|
1059
1061
|
test_files: []
|