rubocop 1.75.1 → 1.75.3
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/config/default.yml +29 -18
- data/lib/rubocop/config_validator.rb +6 -6
- data/lib/rubocop/cop/internal_affairs/example_description.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +1 -0
- data/lib/rubocop/cop/internal_affairs/undefined_config.rb +6 -1
- data/lib/rubocop/cop/layout/block_alignment.rb +1 -2
- data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +2 -2
- data/lib/rubocop/cop/layout/hash_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +2 -4
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_methods.rb +2 -3
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/nested_method_definition.rb +1 -1
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +2 -2
- data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_type_conversion.rb +7 -4
- data/lib/rubocop/cop/lint/return_in_void_context.rb +7 -2
- data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +1 -1
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
- data/lib/rubocop/cop/lint/useless_rescue.rb +1 -1
- data/lib/rubocop/cop/message_annotator.rb +7 -3
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +2 -2
- data/lib/rubocop/cop/mixin/check_single_line_suitability.rb +1 -1
- data/lib/rubocop/cop/mixin/def_node.rb +1 -1
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +1 -1
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +0 -1
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +2 -0
- data/lib/rubocop/cop/mixin/trailing_comma.rb +3 -3
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +1 -1
- data/lib/rubocop/cop/naming/method_name.rb +1 -1
- data/lib/rubocop/cop/style/arguments_forwarding.rb +4 -4
- data/lib/rubocop/cop/style/class_and_module_children.rb +7 -1
- data/lib/rubocop/cop/style/class_equality_comparison.rb +1 -1
- data/lib/rubocop/cop/style/commented_keyword.rb +2 -2
- data/lib/rubocop/cop/style/conditional_assignment.rb +16 -4
- data/lib/rubocop/cop/style/double_negation.rb +1 -1
- data/lib/rubocop/cop/style/empty_literal.rb +4 -0
- data/lib/rubocop/cop/style/eval_with_location.rb +3 -3
- data/lib/rubocop/cop/style/explicit_block_argument.rb +2 -2
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -2
- data/lib/rubocop/cop/style/global_std_stream.rb +3 -0
- data/lib/rubocop/cop/style/hash_fetch_chain.rb +0 -1
- data/lib/rubocop/cop/style/hash_syntax.rb +3 -0
- data/lib/rubocop/cop/style/hash_transform_keys.rb +2 -2
- data/lib/rubocop/cop/style/hash_transform_values.rb +2 -2
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +1 -1
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +1 -1
- data/lib/rubocop/cop/style/lambda_call.rb +7 -2
- data/lib/rubocop/cop/style/map_into_array.rb +3 -1
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/redundant_condition.rb +13 -1
- data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +1 -1
- data/lib/rubocop/cop/style/redundant_line_continuation.rb +0 -3
- data/lib/rubocop/cop/style/redundant_parentheses.rb +12 -3
- data/lib/rubocop/cop/style/return_nil.rb +2 -2
- data/lib/rubocop/cop/style/safe_navigation.rb +18 -3
- data/lib/rubocop/cop/style/super_arguments.rb +1 -2
- data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +1 -1
- data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +1 -1
- data/lib/rubocop/cop/util.rb +1 -1
- data/lib/rubocop/cop/variable_force/variable.rb +1 -1
- data/lib/rubocop/cops_documentation_generator.rb +6 -2
- data/lib/rubocop/formatter/disabled_config_formatter.rb +1 -1
- data/lib/rubocop/formatter/pacman_formatter.rb +1 -1
- data/lib/rubocop/magic_comment.rb +8 -0
- data/lib/rubocop/server/cache.rb +13 -10
- data/lib/rubocop/target_finder.rb +6 -2
- data/lib/rubocop/version.rb +1 -1
- metadata +5 -5
data/lib/rubocop/server/cache.rb
CHANGED
@@ -52,7 +52,8 @@ module RuboCop
|
|
52
52
|
end.find(&:exist?)
|
53
53
|
version_data = lockfile_path&.read || RuboCop::Version::STRING
|
54
54
|
config_data = Pathname(ConfigFinder.find_config_path(Dir.pwd)).read
|
55
|
-
yaml =
|
55
|
+
yaml = load_erb_templated_yaml(config_data)
|
56
|
+
|
56
57
|
inherit_from_data = inherit_from_data(yaml)
|
57
58
|
require_data = require_data(yaml)
|
58
59
|
|
@@ -76,7 +77,6 @@ module RuboCop
|
|
76
77
|
File.expand_path(File.join(cache_root_dir, 'server'))
|
77
78
|
end
|
78
79
|
|
79
|
-
# rubocop:disable Metrics/MethodLength
|
80
80
|
def cache_root_dir_from_config
|
81
81
|
CacheConfig.root_dir do
|
82
82
|
# `RuboCop::ConfigStore` has heavy dependencies, this is a lightweight implementation
|
@@ -87,13 +87,7 @@ module RuboCop
|
|
87
87
|
# Returns early if `CacheRootDirectory` is not used before requiring `erb` or `yaml`.
|
88
88
|
next unless file_contents.include?('CacheRootDirectory')
|
89
89
|
|
90
|
-
|
91
|
-
yaml_code = ERB.new(file_contents).result
|
92
|
-
|
93
|
-
require 'yaml'
|
94
|
-
config_yaml = YAML.safe_load(
|
95
|
-
yaml_code, permitted_classes: [Regexp, Symbol], aliases: true
|
96
|
-
)
|
90
|
+
config_yaml = load_erb_templated_yaml(file_contents)
|
97
91
|
|
98
92
|
# For compatibility with Ruby 3.0 or lower.
|
99
93
|
if Gem::Version.new(Psych::VERSION) < Gem::Version.new('4.0.0')
|
@@ -103,7 +97,6 @@ module RuboCop
|
|
103
97
|
config_yaml&.dig('AllCops', 'CacheRootDirectory')
|
104
98
|
end
|
105
99
|
end
|
106
|
-
# rubocop:enable Metrics/MethodLength
|
107
100
|
|
108
101
|
def port_path
|
109
102
|
dir.join('port')
|
@@ -197,6 +190,16 @@ module RuboCop
|
|
197
190
|
path.exist? ? path.read : ''
|
198
191
|
end.join
|
199
192
|
end
|
193
|
+
|
194
|
+
private
|
195
|
+
|
196
|
+
def load_erb_templated_yaml(content)
|
197
|
+
require 'erb'
|
198
|
+
yaml_code = ERB.new(content).result
|
199
|
+
|
200
|
+
require 'yaml'
|
201
|
+
YAML.safe_load(yaml_code, permitted_classes: [Regexp, Symbol], aliases: true)
|
202
|
+
end
|
200
203
|
end
|
201
204
|
end
|
202
205
|
end
|
@@ -46,7 +46,11 @@ module RuboCop
|
|
46
46
|
hidden_files = all_files.select { |file| file.include?(HIDDEN_PATH_SUBSTRING) }.sort
|
47
47
|
base_dir_config = @config_store.for(base_dir)
|
48
48
|
|
49
|
-
target_files =
|
49
|
+
target_files = if base_dir.include?(HIDDEN_PATH_SUBSTRING)
|
50
|
+
all_files.select { |file| ruby_file?(file) }
|
51
|
+
else
|
52
|
+
all_files.select { |file| to_inspect?(file, hidden_files, base_dir_config) }
|
53
|
+
end
|
50
54
|
|
51
55
|
target_files.sort_by!(&order)
|
52
56
|
end
|
@@ -175,7 +179,7 @@ module RuboCop
|
|
175
179
|
end
|
176
180
|
|
177
181
|
def ruby_executable?(file)
|
178
|
-
return false
|
182
|
+
return false if !File.extname(file).empty? || !File.exist?(file) || File.empty?(file)
|
179
183
|
|
180
184
|
first_line = File.open(file, &:readline)
|
181
185
|
/#!.*(#{ruby_interpreters(file).join('|')})/.match?(first_line)
|
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.75.
|
4
|
+
version: 1.75.3
|
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-
|
12
|
+
date: 2025-04-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -127,7 +127,7 @@ dependencies:
|
|
127
127
|
requirements:
|
128
128
|
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: 1.
|
130
|
+
version: 1.44.0
|
131
131
|
- - "<"
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '2.0'
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
requirements:
|
138
138
|
- - ">="
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version: 1.
|
140
|
+
version: 1.44.0
|
141
141
|
- - "<"
|
142
142
|
- !ruby/object:Gem::Version
|
143
143
|
version: '2.0'
|
@@ -1080,7 +1080,7 @@ licenses:
|
|
1080
1080
|
- MIT
|
1081
1081
|
metadata:
|
1082
1082
|
homepage_uri: https://rubocop.org/
|
1083
|
-
changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.75.
|
1083
|
+
changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.75.3
|
1084
1084
|
source_code_uri: https://github.com/rubocop/rubocop/
|
1085
1085
|
documentation_uri: https://docs.rubocop.org/rubocop/1.75/
|
1086
1086
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|