rubocop 1.37.0 → 1.38.0
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 +6 -0
- data/lib/rubocop/cli/command/suggest_extensions.rb +8 -1
- data/lib/rubocop/comment_config.rb +36 -1
- data/lib/rubocop/cop/commissioner.rb +3 -1
- 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/indentation_style.rb +1 -1
- data/lib/rubocop/cop/layout/line_continuation_spacing.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +2 -0
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +6 -2
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +1 -1
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +18 -3
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +11 -0
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +10 -2
- data/lib/rubocop/cop/mixin/surrounding_space.rb +4 -3
- data/lib/rubocop/cop/registry.rb +10 -4
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +3 -1
- 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/collection_compact.rb +6 -2
- data/lib/rubocop/cop/style/guard_clause.rb +62 -21
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +25 -2
- data/lib/rubocop/cop/style/module_function.rb +28 -6
- data/lib/rubocop/cop/style/operator_method_call.rb +2 -1
- data/lib/rubocop/cop/style/redundant_each.rb +111 -0
- data/lib/rubocop/cop/style/redundant_string_escape.rb +13 -5
- data/lib/rubocop/cop/team.rb +3 -4
- data/lib/rubocop/cop/variable_force/variable_table.rb +1 -1
- data/lib/rubocop/cops_documentation_generator.rb +4 -2
- data/lib/rubocop/ext/processed_source.rb +2 -0
- data/lib/rubocop/formatter/offense_count_formatter.rb +8 -5
- data/lib/rubocop/formatter/worst_offenders_formatter.rb +6 -3
- data/lib/rubocop/options.rb +6 -2
- data/lib/rubocop/rspec/cop_helper.rb +21 -1
- data/lib/rubocop/rspec/shared_contexts.rb +13 -12
- data/lib/rubocop/runner.rb +15 -11
- data/lib/rubocop/server/core.rb +1 -0
- data/lib/rubocop/version.rb +1 -1
- data/lib/rubocop.rb +1 -0
- metadata +8 -5
data/lib/rubocop/runner.rb
CHANGED
@@ -423,17 +423,21 @@ module RuboCop
|
|
423
423
|
end
|
424
424
|
|
425
425
|
def get_processed_source(file)
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
426
|
+
config = @config_store.for_file(file)
|
427
|
+
ruby_version = config.target_ruby_version
|
428
|
+
|
429
|
+
processed_source = if @options[:stdin]
|
430
|
+
ProcessedSource.new(@options[:stdin], ruby_version, file)
|
431
|
+
else
|
432
|
+
begin
|
433
|
+
ProcessedSource.from_file(file, ruby_version)
|
434
|
+
rescue Errno::ENOENT
|
435
|
+
raise RuboCop::Error, "No such file or directory: #{file}"
|
436
|
+
end
|
437
|
+
end
|
438
|
+
processed_source.config = config
|
439
|
+
processed_source.registry = mobilized_cop_classes(config)
|
440
|
+
processed_source
|
437
441
|
end
|
438
442
|
|
439
443
|
# A Cop::Team instance is stateful and may change when inspecting.
|
data/lib/rubocop/server/core.rb
CHANGED
data/lib/rubocop/version.rb
CHANGED
data/lib/rubocop.rb
CHANGED
@@ -540,6 +540,7 @@ require_relative 'rubocop/cop/style/numbered_parameters'
|
|
540
540
|
require_relative 'rubocop/cop/style/open_struct_use'
|
541
541
|
require_relative 'rubocop/cop/style/operator_method_call'
|
542
542
|
require_relative 'rubocop/cop/style/redundant_assignment'
|
543
|
+
require_relative 'rubocop/cop/style/redundant_each'
|
543
544
|
require_relative 'rubocop/cop/style/redundant_fetch_block'
|
544
545
|
require_relative 'rubocop/cop/style/redundant_file_extension_in_require'
|
545
546
|
require_relative 'rubocop/cop/style/redundant_initialize'
|
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.38.0
|
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-11-01 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'
|
@@ -286,8 +286,10 @@ files:
|
|
286
286
|
- lib/rubocop/cop/ignored_node.rb
|
287
287
|
- lib/rubocop/cop/internal_affairs.rb
|
288
288
|
- lib/rubocop/cop/internal_affairs/cop_description.rb
|
289
|
+
- lib/rubocop/cop/internal_affairs/create_empty_file.rb
|
289
290
|
- lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb
|
290
291
|
- lib/rubocop/cop/internal_affairs/example_description.rb
|
292
|
+
- lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb
|
291
293
|
- lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
|
292
294
|
- lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb
|
293
295
|
- lib/rubocop/cop/internal_affairs/method_name_end_with.rb
|
@@ -819,6 +821,7 @@ files:
|
|
819
821
|
- lib/rubocop/cop/style/redundant_capital_w.rb
|
820
822
|
- lib/rubocop/cop/style/redundant_condition.rb
|
821
823
|
- lib/rubocop/cop/style/redundant_conditional.rb
|
824
|
+
- lib/rubocop/cop/style/redundant_each.rb
|
822
825
|
- lib/rubocop/cop/style/redundant_exception.rb
|
823
826
|
- lib/rubocop/cop/style/redundant_fetch_block.rb
|
824
827
|
- lib/rubocop/cop/style/redundant_file_extension_in_require.rb
|
@@ -982,7 +985,7 @@ metadata:
|
|
982
985
|
homepage_uri: https://rubocop.org/
|
983
986
|
changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
|
984
987
|
source_code_uri: https://github.com/rubocop/rubocop/
|
985
|
-
documentation_uri: https://docs.rubocop.org/rubocop/1.
|
988
|
+
documentation_uri: https://docs.rubocop.org/rubocop/1.38/
|
986
989
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|
987
990
|
rubygems_mfa_required: 'true'
|
988
991
|
post_install_message:
|