René's URL Explorer Experiment


Title: Lint/UselessAssignment: false positives with `+=` · Issue #14419 · rubocop/rubocop · GitHub

Open Graph Title: Lint/UselessAssignment: false positives with `+=` · Issue #14419 · rubocop/rubocop

X Title: Lint/UselessAssignment: false positives with `+=` · Issue #14419 · rubocop/rubocop

Description: Lint/UselessAssignment reports false positives even after 1.79.1 and #14409 Expected behavior rubocop should not report a violation Actual behavior Rubocop reports lines 8 and 12 are useless assignments, but not 16 for some reason. If I ...

Open Graph Description: Lint/UselessAssignment reports false positives even after 1.79.1 and #14409 Expected behavior rubocop should not report a violation Actual behavior Rubocop reports lines 8 and 12 are useless assign...

X Description: Lint/UselessAssignment reports false positives even after 1.79.1 and #14409 Expected behavior rubocop should not report a violation Actual behavior Rubocop reports lines 8 and 12 are useless assign...

Opengraph URL: https://github.com/rubocop/rubocop/issues/14419

X: @github

direct link

Domain: redirect.github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Lint/UselessAssignment: false positives with `+=`","articleBody":"`Lint/UselessAssignment` reports false positives even after `1.79.1` and https://github.com/rubocop/rubocop/pull/14409\n\n## Expected behavior\n\nrubocop should not report a violation\n\n## Actual behavior\n\nRubocop reports lines 8 and 12 are useless assignments, but not 16 for some reason. If I remove line 4, then the false positives are eliminated.\n\n## Steps to reproduce the problem\n\n```ruby\ndef parse_options\n  index = -1\n  while loop_cond\n    index += 1\n\n    item = command_line.args[index]\n    if option\n      index += 1\n    else\n      option = foo(item)\n      if option\n        index += 1\n      else\n        option = bar(item)\n        if option\n          index += 1\n        end\n      end\n    end\n  end\nend\n```\n```\n❯ git rev-parse HEAD\neb470cef93cacb1e8806c6202e976d5693f91b3d\n\n❯ rm -rf /home/josh/.cache/rubocop_cache\n\n❯ bundle exec rubocop --debug --only Lint/UselessAssignment example.rb\nFor /home/josh/work/rubocop: configuration from /home/josh/work/rubocop/.rubocop.yml\nDefault configuration from /home/josh/work/rubocop/config/default.yml\nPlugin configuration from /home/josh/work/rubocop/config/internal_affairs.yml\nPlugin configuration from /home/josh/.rbenv/versions/3.2.5/lib/ruby/gems/3.2.0/gems/rubocop-performance-1.25.0/config/default.yml\nPlugin configuration from /home/josh/.rbenv/versions/3.2.5/lib/ruby/gems/3.2.0/gems/rubocop-rake-0.7.1/config/default.yml\nPlugin configuration from /home/josh/.rbenv/versions/3.2.5/lib/ruby/gems/3.2.0/gems/rubocop-rspec-3.6.0/config/default.yml\nInheriting configuration from /home/josh/work/rubocop/.rubocop_todo.yml\nUse parallel by default.\nSkipping parallel inspection: only a single file needs inspection\nInspecting 1 file\nScanning /home/josh/work/rubocop/example.rb\nW\n\nOffenses:\n\nexample.rb:8:7: W: [Correctable] Lint/UselessAssignment: Useless assignment to variable - index.\n      index += 1\n      ^^^^^\nexample.rb:12:9: W: [Correctable] Lint/UselessAssignment: Useless assignment to variable - index.\n        index += 1\n        ^^^^^\n\n1 file inspected, 2 offenses detected, 2 offenses autocorrectable\nFinished in 0.25948607735335827 seconds\n```\n\n## RuboCop version\n\n```\n❯ bundle exec rubocop -V \n1.79.1 (using Parser 3.3.9.0, rubocop-ast 1.46.0, analyzing as Ruby 2.7, running on ruby 3.2.5) [x86_64-linux]\n  - rubocop-performance 1.25.0\n  - rubocop-rake 0.7.1\n  - rubocop-rspec 3.6.0\n\n```","author":{"url":"https://github.com/joshcooper","@type":"Person","name":"joshcooper"},"datePublished":"2025-08-04T17:02:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/14419/rubocop/issues/14419"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:90e9e59e-2480-68a0-5f2d-91b6027f1387
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD30E:53AD4:2DCC81:3AF3F1:69951323
html-safe-nonce278b9687ec715f1449cf5fe0e2bde04da555c71518cca454c288cfcfff079351
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzBFOjUzQUQ0OjJEQ0M4MTozQUYzRjE6Njk5NTEzMjMiLCJ2aXNpdG9yX2lkIjoiNjU4MTI2MjE3NTY1NDE4NzgxMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac87cbb2b77bd0aee418a799c209eff572822ec2ca9c5dcbdeaf748c643f8eab63
hovercard-subject-tagissue:3290175812
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/rubocop/rubocop/14419/issue_layout
twitter:imagehttps://opengraph.githubassets.com/b33d94378414b823e7050b04f8092493bc2e0eab6accaca6d0c5f7300f71d365/rubocop/rubocop/issues/14419
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/b33d94378414b823e7050b04f8092493bc2e0eab6accaca6d0c5f7300f71d365/rubocop/rubocop/issues/14419
og:image:altLint/UselessAssignment reports false positives even after 1.79.1 and #14409 Expected behavior rubocop should not report a violation Actual behavior Rubocop reports lines 8 and 12 are useless assign...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejoshcooper
hostnamegithub.com
expected-hostnamegithub.com
None4bd759bc5f83244e2a0de29b937365905c0fefd238b6f077c24a49830375b4df
turbo-cache-controlno-preview
go-importgithub.com/rubocop/rubocop git https://github.com/rubocop/rubocop.git
octolytics-dimension-user_id10871348
octolytics-dimension-user_loginrubocop
octolytics-dimension-repository_id4095287
octolytics-dimension-repository_nworubocop/rubocop
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id4095287
octolytics-dimension-repository_network_root_nworubocop/rubocop
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasecac7d4a5a6053f6655d0c3e8bfe5fd7a55c216fd
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://redirect.github.com/rubocop/rubocop/issues/14419#start-of-content
https://redirect.github.com/
Sign in https://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Frubocop%2Frubocop%2Fissues%2F14419
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Frubocop%2Frubocop%2Fissues%2F14419
Sign up https://redirect.github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=rubocop%2Frubocop
Reloadhttps://redirect.github.com/rubocop/rubocop/issues/14419
Reloadhttps://redirect.github.com/rubocop/rubocop/issues/14419
Reloadhttps://redirect.github.com/rubocop/rubocop/issues/14419
rubocop https://redirect.github.com/rubocop
rubocophttps://redirect.github.com/rubocop/rubocop
Please reload this pagehttps://redirect.github.com/rubocop/rubocop/issues/14419
Notifications https://redirect.github.com/login?return_to=%2Frubocop%2Frubocop
Fork 3.1k https://redirect.github.com/login?return_to=%2Frubocop%2Frubocop
Star 12.8k https://redirect.github.com/login?return_to=%2Frubocop%2Frubocop
Code https://redirect.github.com/rubocop/rubocop
Issues 123 https://redirect.github.com/rubocop/rubocop/issues
Pull requests 31 https://redirect.github.com/rubocop/rubocop/pulls
Discussions https://redirect.github.com/rubocop/rubocop/discussions
Actions https://redirect.github.com/rubocop/rubocop/actions
Security 0 https://redirect.github.com/rubocop/rubocop/security
Insights https://redirect.github.com/rubocop/rubocop/pulse
Code https://redirect.github.com/rubocop/rubocop
Issues https://redirect.github.com/rubocop/rubocop/issues
Pull requests https://redirect.github.com/rubocop/rubocop/pulls
Discussions https://redirect.github.com/rubocop/rubocop/discussions
Actions https://redirect.github.com/rubocop/rubocop/actions
Security https://redirect.github.com/rubocop/rubocop/security
Insights https://redirect.github.com/rubocop/rubocop/pulse
New issuehttps://redirect.github.com/login?return_to=https://github.com/rubocop/rubocop/issues/14419
New issuehttps://redirect.github.com/login?return_to=https://github.com/rubocop/rubocop/issues/14419
#14425https://github.com/rubocop/rubocop/pull/14425
Lint/UselessAssignment: false positives with +=https://redirect.github.com/rubocop/rubocop/issues/14419#top
#14425https://github.com/rubocop/rubocop/pull/14425
bughttps://github.com/rubocop/rubocop/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/joshcooper
https://github.com/joshcooper
joshcooperhttps://github.com/joshcooper
on Aug 4, 2025https://github.com/rubocop/rubocop/issues/14419#issue-3290175812
#14409https://github.com/rubocop/rubocop/pull/14409
bughttps://github.com/rubocop/rubocop/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.