I have some text parsing code that passed all lints with rubocop 1.77.0 but has a Lint/UselessAssignment offense as of 1.79.0
I managed to simplify the code to this example:
# frozen_string_literal: true list = '3234(234)23'.chars in_parens = false until list.empty? c = list.shift if in_parens if c == ')' in_parens = false else $stdout.puts c end elsif c == '(' in_parens = true end endExpected behavior
No offenses
Actual behavior$ rubocop --debug test.rb
For /app: configuration from /app/.rubocop.yml
Default configuration from /home/docker-user/bundle/ruby/3.3.0/gems/rubocop-1.79.0/config/default.yml
Plugin configuration from /home/docker-user/bundle/ruby/3.3.0/gems/rubocop-rails-2.32.0/config/default.yml
Use parallel by default.
Skipping parallel inspection: only a single file needs inspection
Inspecting 1 file
Scanning /app/test.rb
W
Offenses:
test.rb:9:7: W: [Correctable] Lint/UselessAssignment: Useless assignment to variable - in_parens.
in_parens = false
^^^^^^^^^
1 file inspected, 1 offense detected, 1 offense autocorrectable
Finished in 0.26479940899298526 seconds
Steps to reproduce the problem
See sample code above
RuboCop version1.79.0 (using Parser 3.3.9.0, rubocop-ast 1.46.0, analyzing as Ruby 2.7, running on ruby 3.3.7) [x86_64-linux]
- rubocop-rails 2.32.0
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4