rubocop 1.80.0 → 1.80.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 496ab84015431ed6854f23f7a0e5ca4df59bc01056024b8895c59900c885530d
4
- data.tar.gz: '09bc286e311ba0b4e2cb9cbc9b4c4ed33b7154311e27be5c9604f30cde4c54d7'
3
+ metadata.gz: 5a047d4a83faf5e57dea4820484566645a9041e397a11cd995e9b5c558b0b657
4
+ data.tar.gz: 80fea4c35729d9eab11bd0d26ec3c98b8127804dd0abf42fda5303065382b772
5
5
  SHA512:
6
- metadata.gz: 9b647e72a501941d047a93c9d761840664ce140ae11a9d5326855d6a9755cab4d065dcbf37db926396ab078cf18a44378ab89ed4a40745dd35bf3cec9fbdb4ce
7
- data.tar.gz: 5f26cbc1e08e4fb9fa03b2cef099543864dfa741fb73e5e7062186f810a7f0f816bbe3dae981e8dba2c3758318fcbf015f7dbf140e472fbc8b5dd2f9fde1c9bf
6
+ metadata.gz: c971fe82aacd55238ee1b16f0329f4377491f0f1b175454d0cf3178a4fc759c625affbcca853a09dd106430f0e5462134e8ff2a2534ef898768121f3a482575e
7
+ data.tar.gz: 47bd2586ce3a6568b2b3c6657e104104c30b0440ddac2ec64f96e70fe630e5afffa38fbf9be439ab3d8b7ef29e7b433537279d2a2cd0022a15cf6015d53b4484
@@ -29,10 +29,13 @@ module RuboCop
29
29
  def align_end(corrector, processed_source, node, align_to)
30
30
  @processed_source = processed_source
31
31
  whitespace = whitespace_range(node)
32
- return false unless whitespace.source.strip.empty?
33
-
34
32
  column = alignment_column(align_to)
35
- corrector.replace(whitespace, ' ' * column)
33
+
34
+ if whitespace.source.strip.empty?
35
+ corrector.replace(whitespace, ' ' * column)
36
+ else
37
+ corrector.insert_after(whitespace, "\n#{' ' * column}")
38
+ end
36
39
  end
37
40
 
38
41
  private
@@ -19,8 +19,7 @@ module RuboCop
19
19
  def check_end_kw_alignment(node, align_ranges)
20
20
  return if ignored_node?(node)
21
21
 
22
- end_loc = node.loc.end
23
- return if accept_end_kw_alignment?(end_loc)
22
+ return unless (end_loc = node.loc.end)
24
23
 
25
24
  matching = matching_ranges(end_loc, align_ranges)
26
25
 
@@ -57,11 +56,6 @@ module RuboCop
57
56
  add_offense(end_loc, message: msg) { |corrector| autocorrect(corrector, node) }
58
57
  end
59
58
 
60
- def accept_end_kw_alignment?(end_loc)
61
- end_loc.nil? || # Discard modifier forms of if/while/until.
62
- !/\A[ \t]*end/.match?(processed_source.lines[end_loc.line - 1])
63
- end
64
-
65
59
  def style_parameter_name
66
60
  'EnforcedStyleAlignWith'
67
61
  end
@@ -203,6 +203,8 @@ module RuboCop
203
203
  end
204
204
 
205
205
  def begin_block_has_multiline_statements?(node)
206
+ return false unless node.parent
207
+
206
208
  node.children.count >= 2
207
209
  end
208
210
 
@@ -100,7 +100,7 @@ module RuboCop
100
100
  node.receiver.str_type? &&
101
101
  node.first_argument.str_type? &&
102
102
  node.multiline? &&
103
- node.source =~ /\+\s*\n/
103
+ node.source.match?(/\+\s*\n/)
104
104
  end
105
105
 
106
106
  def find_topmost_plus_node(node)
@@ -9,7 +9,7 @@ module RuboCop
9
9
  # Provides functionality for caching RuboCop runs.
10
10
  # @api private
11
11
  class ResultCache
12
- NON_CHANGING = %i[color format formatters out debug fail_level
12
+ NON_CHANGING = %i[color format formatters out debug display_time fail_level
13
13
  fix_layout autocorrect safe_autocorrect autocorrect_all
14
14
  cache fail_fast stdin parallel].freeze
15
15
 
@@ -273,7 +273,8 @@ module RuboCop
273
273
  end
274
274
 
275
275
  def do_inspection_loop(file)
276
- processed_source = get_processed_source(file)
276
+ # We can reuse the prism result since the source did not change yet.
277
+ processed_source = get_processed_source(file, @prism_result)
277
278
  # This variable is 2d array used to track corrected offenses after each
278
279
  # inspection iteration. This is used to output meaningful infinite loop
279
280
  # error message.
@@ -295,7 +296,8 @@ module RuboCop
295
296
  # loop if we find any.
296
297
  break unless updated_source_file
297
298
 
298
- processed_source = get_processed_source(file)
299
+ # Autocorrect has happened, don't use the prism result since it is stale.
300
+ processed_source = get_processed_source(file, nil)
299
301
  end
300
302
 
301
303
  # Return summary of corrected offenses after all iterations
@@ -482,7 +484,7 @@ module RuboCop
482
484
  end
483
485
 
484
486
  # rubocop:disable Metrics/MethodLength
485
- def get_processed_source(file)
487
+ def get_processed_source(file, prism_result)
486
488
  config = @config_store.for_file(file)
487
489
  ruby_version = config.target_ruby_version
488
490
  parser_engine = config.parser_engine
@@ -493,7 +495,7 @@ module RuboCop
493
495
  ruby_version,
494
496
  file,
495
497
  parser_engine: parser_engine,
496
- prism_result: @prism_result
498
+ prism_result: prism_result
497
499
  )
498
500
  else
499
501
  begin
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '1.80.0'
6
+ STRING = '1.80.1'
7
7
 
8
8
  MSG = '%<version>s (using %<parser_version>s, ' \
9
9
  'rubocop-ast %<rubocop_ast_version>s, ' \
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.80.0
4
+ version: 1.80.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-08-22 00:00:00.000000000 Z
12
+ date: 2025-08-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -1090,7 +1090,7 @@ licenses:
1090
1090
  - MIT
1091
1091
  metadata:
1092
1092
  homepage_uri: https://rubocop.org/
1093
- changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.80.0
1093
+ changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.80.1
1094
1094
  source_code_uri: https://github.com/rubocop/rubocop/
1095
1095
  documentation_uri: https://docs.rubocop.org/rubocop/1.80/
1096
1096
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues