rubocop 1.36.0 → 1.37.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/config/default.yml +21 -1
- data/lib/rubocop/arguments_env.rb +17 -0
- data/lib/rubocop/arguments_file.rb +17 -0
- data/lib/rubocop/cli/command/execute_runner.rb +7 -7
- data/lib/rubocop/cli/command/suggest_extensions.rb +8 -1
- data/lib/rubocop/cop/generator.rb +1 -2
- data/lib/rubocop/cop/internal_affairs/create_empty_file.rb +37 -0
- data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +111 -0
- data/lib/rubocop/cop/internal_affairs.rb +2 -0
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +1 -0
- data/lib/rubocop/cop/layout/indentation_width.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +13 -9
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +28 -3
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_magic_comment.rb +73 -0
- data/lib/rubocop/cop/lint/duplicate_methods.rb +11 -1
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +25 -6
- data/lib/rubocop/cop/lint/empty_class.rb +3 -1
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +19 -7
- data/lib/rubocop/cop/lint/nested_method_definition.rb +50 -1
- data/lib/rubocop/cop/lint/number_conversion.rb +1 -1
- data/lib/rubocop/cop/lint/ordered_magic_comments.rb +4 -5
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +12 -1
- data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +7 -0
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +29 -9
- data/lib/rubocop/cop/lint/require_parentheses.rb +1 -1
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +3 -2
- data/lib/rubocop/cop/lint/shadowed_exception.rb +0 -10
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +3 -0
- data/lib/rubocop/cop/lint/unreachable_loop.rb +1 -1
- data/lib/rubocop/cop/lint/unused_method_argument.rb +4 -0
- data/lib/rubocop/cop/mixin/comments_help.rb +12 -0
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +4 -0
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +6 -3
- data/lib/rubocop/cop/mixin/rescue_node.rb +3 -1
- data/lib/rubocop/cop/mixin/surrounding_space.rb +6 -5
- data/lib/rubocop/cop/naming/inclusive_language.rb +1 -1
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +24 -2
- data/lib/rubocop/cop/style/accessor_grouping.rb +7 -3
- data/lib/rubocop/cop/style/block_delimiters.rb +1 -1
- data/lib/rubocop/cop/style/character_literal.rb +1 -1
- data/lib/rubocop/cop/style/class_equality_comparison.rb +1 -1
- data/lib/rubocop/cop/style/collection_compact.rb +8 -1
- data/lib/rubocop/cop/style/empty_method.rb +1 -1
- data/lib/rubocop/cop/style/endless_method.rb +1 -1
- data/lib/rubocop/cop/style/explicit_block_argument.rb +4 -0
- data/lib/rubocop/cop/style/format_string_token.rb +1 -1
- data/lib/rubocop/cop/style/hash_syntax.rb +1 -1
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +13 -2
- data/lib/rubocop/cop/style/negated_if_else_condition.rb +7 -1
- data/lib/rubocop/cop/style/numeric_predicate.rb +1 -1
- data/lib/rubocop/cop/style/operator_method_call.rb +40 -0
- data/lib/rubocop/cop/style/redundant_begin.rb +1 -0
- data/lib/rubocop/cop/style/redundant_condition.rb +5 -2
- data/lib/rubocop/cop/style/redundant_initialize.rb +3 -1
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +8 -1
- data/lib/rubocop/cop/style/redundant_string_escape.rb +181 -0
- data/lib/rubocop/cop/style/rescue_modifier.rb +1 -1
- data/lib/rubocop/cop/style/static_class.rb +32 -1
- data/lib/rubocop/cop/style/symbol_array.rb +2 -0
- data/lib/rubocop/cop/style/symbol_proc.rb +1 -1
- data/lib/rubocop/cop/style/word_array.rb +2 -0
- data/lib/rubocop/formatter/disabled_config_formatter.rb +8 -2
- data/lib/rubocop/options.rb +13 -13
- data/lib/rubocop/rspec/shared_contexts.rb +13 -1
- data/lib/rubocop/server/cache.rb +5 -1
- data/lib/rubocop/server/cli.rb +9 -2
- data/lib/rubocop/server/client_command/exec.rb +5 -0
- data/lib/rubocop/server/core.rb +2 -1
- data/lib/rubocop/server/socket_reader.rb +5 -1
- data/lib/rubocop/server.rb +1 -1
- data/lib/rubocop/version.rb +8 -3
- data/lib/rubocop.rb +3 -0
- metadata +12 -5
data/lib/rubocop/server/core.rb
CHANGED
@@ -56,7 +56,8 @@ module RuboCop
|
|
56
56
|
def start_server(host, port)
|
57
57
|
@server = TCPServer.open(host, port)
|
58
58
|
|
59
|
-
|
59
|
+
output_stream = ARGV.include?('--stderr') ? $stderr : $stdout
|
60
|
+
output_stream.puts "RuboCop server starting on #{@server.addr[3]}:#{@server.addr[1]}."
|
60
61
|
end
|
61
62
|
|
62
63
|
def read_socket(socket)
|
@@ -24,13 +24,17 @@ module RuboCop
|
|
24
24
|
def read!
|
25
25
|
request = parse_request(@socket.read)
|
26
26
|
|
27
|
+
stderr = StringIO.new
|
27
28
|
Helper.redirect(
|
28
29
|
stdin: StringIO.new(request.body),
|
29
30
|
stdout: @socket,
|
30
|
-
stderr:
|
31
|
+
stderr: stderr
|
31
32
|
) do
|
32
33
|
create_command_instance(request).run
|
33
34
|
end
|
35
|
+
ensure
|
36
|
+
Cache.stderr_path.write(stderr.string)
|
37
|
+
@socket.close
|
34
38
|
end
|
35
39
|
|
36
40
|
private
|
data/lib/rubocop/server.rb
CHANGED
data/lib/rubocop/version.rb
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
module RuboCop
|
4
4
|
# This module holds the RuboCop version information.
|
5
5
|
module Version
|
6
|
-
STRING = '1.
|
6
|
+
STRING = '1.37.1'
|
7
7
|
|
8
8
|
MSG = '%<version>s (using Parser %<parser_version>s, ' \
|
9
9
|
'rubocop-ast %<rubocop_ast_version>s, ' \
|
10
|
-
'running on %<ruby_engine>s %<ruby_version>s)%<
|
10
|
+
'running on %<ruby_engine>s %<ruby_version>s)%<server_mode>s [%<ruby_platform>s]'
|
11
11
|
|
12
12
|
CANONICAL_FEATURE_NAMES = { 'Rspec' => 'RSpec', 'Graphql' => 'GraphQL', 'Md' => 'Markdown',
|
13
13
|
'Thread_safety' => 'ThreadSafety' }.freeze
|
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
verbose_version = format(MSG, version: STRING, parser_version: Parser::VERSION,
|
20
20
|
rubocop_ast_version: RuboCop::AST::Version::STRING,
|
21
21
|
ruby_engine: RUBY_ENGINE, ruby_version: RUBY_VERSION,
|
22
|
-
|
22
|
+
server_mode: server_mode,
|
23
23
|
ruby_platform: RUBY_PLATFORM)
|
24
24
|
return verbose_version unless env
|
25
25
|
|
@@ -89,5 +89,10 @@ module RuboCop
|
|
89
89
|
def self.document_version
|
90
90
|
STRING.match('\d+\.\d+').to_s
|
91
91
|
end
|
92
|
+
|
93
|
+
# @api private
|
94
|
+
def self.server_mode
|
95
|
+
RuboCop.const_defined?(:Server) && Server.running? ? ' +server' : ''
|
96
|
+
end
|
92
97
|
end
|
93
98
|
end
|
data/lib/rubocop.rb
CHANGED
@@ -292,6 +292,7 @@ require_relative 'rubocop/cop/lint/duplicate_branch'
|
|
292
292
|
require_relative 'rubocop/cop/lint/duplicate_case_condition'
|
293
293
|
require_relative 'rubocop/cop/lint/duplicate_elsif_condition'
|
294
294
|
require_relative 'rubocop/cop/lint/duplicate_hash_key'
|
295
|
+
require_relative 'rubocop/cop/lint/duplicate_magic_comment'
|
295
296
|
require_relative 'rubocop/cop/lint/duplicate_methods'
|
296
297
|
require_relative 'rubocop/cop/lint/duplicate_regexp_character_class_element'
|
297
298
|
require_relative 'rubocop/cop/lint/duplicate_require'
|
@@ -537,6 +538,7 @@ require_relative 'rubocop/cop/style/method_call_with_args_parentheses'
|
|
537
538
|
require_relative 'rubocop/cop/style/multiline_in_pattern_then'
|
538
539
|
require_relative 'rubocop/cop/style/numbered_parameters'
|
539
540
|
require_relative 'rubocop/cop/style/open_struct_use'
|
541
|
+
require_relative 'rubocop/cop/style/operator_method_call'
|
540
542
|
require_relative 'rubocop/cop/style/redundant_assignment'
|
541
543
|
require_relative 'rubocop/cop/style/redundant_fetch_block'
|
542
544
|
require_relative 'rubocop/cop/style/redundant_file_extension_in_require'
|
@@ -612,6 +614,7 @@ require_relative 'rubocop/cop/style/redundant_return'
|
|
612
614
|
require_relative 'rubocop/cop/style/redundant_self'
|
613
615
|
require_relative 'rubocop/cop/style/redundant_sort'
|
614
616
|
require_relative 'rubocop/cop/style/redundant_sort_by'
|
617
|
+
require_relative 'rubocop/cop/style/redundant_string_escape'
|
615
618
|
require_relative 'rubocop/cop/style/regexp_literal'
|
616
619
|
require_relative 'rubocop/cop/style/rescue_modifier'
|
617
620
|
require_relative 'rubocop/cop/style/rescue_standard_error'
|
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.37.1
|
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: 2022-
|
13
|
+
date: 2022-10-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
requirements:
|
121
121
|
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: 1.
|
123
|
+
version: 1.23.0
|
124
124
|
- - "<"
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '2.0'
|
@@ -130,7 +130,7 @@ dependencies:
|
|
130
130
|
requirements:
|
131
131
|
- - ">="
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: 1.
|
133
|
+
version: 1.23.0
|
134
134
|
- - "<"
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '2.0'
|
@@ -207,6 +207,8 @@ files:
|
|
207
207
|
- config/obsoletion.yml
|
208
208
|
- exe/rubocop
|
209
209
|
- lib/rubocop.rb
|
210
|
+
- lib/rubocop/arguments_env.rb
|
211
|
+
- lib/rubocop/arguments_file.rb
|
210
212
|
- lib/rubocop/ast_aliases.rb
|
211
213
|
- lib/rubocop/cache_config.rb
|
212
214
|
- lib/rubocop/cached_data.rb
|
@@ -284,8 +286,10 @@ files:
|
|
284
286
|
- lib/rubocop/cop/ignored_node.rb
|
285
287
|
- lib/rubocop/cop/internal_affairs.rb
|
286
288
|
- lib/rubocop/cop/internal_affairs/cop_description.rb
|
289
|
+
- lib/rubocop/cop/internal_affairs/create_empty_file.rb
|
287
290
|
- lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb
|
288
291
|
- lib/rubocop/cop/internal_affairs/example_description.rb
|
292
|
+
- lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb
|
289
293
|
- lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
|
290
294
|
- lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb
|
291
295
|
- lib/rubocop/cop/internal_affairs/method_name_end_with.rb
|
@@ -430,6 +434,7 @@ files:
|
|
430
434
|
- lib/rubocop/cop/lint/duplicate_case_condition.rb
|
431
435
|
- lib/rubocop/cop/lint/duplicate_elsif_condition.rb
|
432
436
|
- lib/rubocop/cop/lint/duplicate_hash_key.rb
|
437
|
+
- lib/rubocop/cop/lint/duplicate_magic_comment.rb
|
433
438
|
- lib/rubocop/cop/lint/duplicate_methods.rb
|
434
439
|
- lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb
|
435
440
|
- lib/rubocop/cop/lint/duplicate_require.rb
|
@@ -795,6 +800,7 @@ files:
|
|
795
800
|
- lib/rubocop/cop/style/object_then.rb
|
796
801
|
- lib/rubocop/cop/style/one_line_conditional.rb
|
797
802
|
- lib/rubocop/cop/style/open_struct_use.rb
|
803
|
+
- lib/rubocop/cop/style/operator_method_call.rb
|
798
804
|
- lib/rubocop/cop/style/option_hash.rb
|
799
805
|
- lib/rubocop/cop/style/optional_arguments.rb
|
800
806
|
- lib/rubocop/cop/style/optional_boolean_parameter.rb
|
@@ -831,6 +837,7 @@ files:
|
|
831
837
|
- lib/rubocop/cop/style/redundant_self_assignment_branch.rb
|
832
838
|
- lib/rubocop/cop/style/redundant_sort.rb
|
833
839
|
- lib/rubocop/cop/style/redundant_sort_by.rb
|
840
|
+
- lib/rubocop/cop/style/redundant_string_escape.rb
|
834
841
|
- lib/rubocop/cop/style/regexp_literal.rb
|
835
842
|
- lib/rubocop/cop/style/rescue_modifier.rb
|
836
843
|
- lib/rubocop/cop/style/rescue_standard_error.rb
|
@@ -977,7 +984,7 @@ metadata:
|
|
977
984
|
homepage_uri: https://rubocop.org/
|
978
985
|
changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
|
979
986
|
source_code_uri: https://github.com/rubocop/rubocop/
|
980
|
-
documentation_uri: https://docs.rubocop.org/rubocop/1.
|
987
|
+
documentation_uri: https://docs.rubocop.org/rubocop/1.37/
|
981
988
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|
982
989
|
rubygems_mfa_required: 'true'
|
983
990
|
post_install_message:
|