René's URL Explorer Experiment


Title: Style/ClassAndModuleChildren not safe within module or class · Issue #14476 · rubocop/rubocop · GitHub

Open Graph Title: Style/ClassAndModuleChildren not safe within module or class · Issue #14476 · rubocop/rubocop

X Title: Style/ClassAndModuleChildren not safe within module or class · Issue #14476 · rubocop/rubocop

Description: The Style/ClassAndModuleChildren cop is not safe to correct when the code occurs within another scope. This led to a bug in JRuby's build when using automated corrections. Nested module access will not walk up to the toplevel to look for...

Open Graph Description: The Style/ClassAndModuleChildren cop is not safe to correct when the code occurs within another scope. This led to a bug in JRuby's build when using automated corrections. Nested module access will...

X Description: The Style/ClassAndModuleChildren cop is not safe to correct when the code occurs within another scope. This led to a bug in JRuby's build when using automated corrections. Nested module access ...

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

X: @github

direct link

Domain: redirect.github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Style/ClassAndModuleChildren not safe within module or class","articleBody":"The Style/ClassAndModuleChildren cop is not safe to correct when the code occurs within another scope. This led to a bug in JRuby's build when using automated corrections.\n\nNested module access will not walk up to the toplevel to look for modules or classes to open, while path-based access does do this.\n\n--------\n\n## Expected behavior\n\nCode below should behave this way before or after correction, or else it should be considered an unsafe correction.\n\nOriginal code:\n\n```ruby\nmodule X\n  module Y\n    puts object_id\n  end\nend\nmodule Z\n  module X::Y\n    puts object_id\n  end\nend\n# prints same object id for Y, because path-based access uses the toplevel X\n# and reopens the existing modules\n```\n\n## Actual behavior\n\nWhen corrected to nested modules, the reopen of X creates a new module tree rather than accessing the toplevel X.\n\nCorrected code:\n\n```ruby\n...\nmodule Z\n  module X\n    module Y\n      puts object_id\n    end\n  end\nend\n# Reopen of X is a new module and Y is also new with a different object_id\n```\n\nFull script example of the behavior:\n\n```ruby\nmodule X\n  module Y\n    puts object_id\n  end\nend\nmodule Z\n  module X::Y\n    puts object_id\n  end\nend\nmodule Q\n  module X\n    module Y\n      puts object_id\n    end\n  end\nend\n```\n\nOutput from example, showing that the correction is not safe:\n\n```\n$ cx 3.4 ruby -v blah.rb\nruby 3.4.5 (2025-07-16 revision 20cda200d3) +PRISM [arm64-darwin24]\n16\n16\n24\n```\n\n## RuboCop version\n\n```\n$ rubocop -V\n1.80.0 (using Parser 3.3.9.0, rubocop-ast 1.46.0, analyzing as Ruby 2.7, running on jruby 3.1.7) [java]\n```","author":{"url":"https://github.com/headius","@type":"Person","name":"headius"},"datePublished":"2025-08-25T18:12:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/14476/rubocop/issues/14476"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:fdd0471c-2d39-85cd-70c8-5c01c4c6bff0
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB090:ADA4B:752C608:9F74FD7:69960242
html-safe-nonced43e1246b02f5843f80ff9fb8efc5bf6e534e5394569ad7efa0606404a8081b5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDkwOkFEQTRCOjc1MkM2MDg6OUY3NEZENzo2OTk2MDI0MiIsInZpc2l0b3JfaWQiOiI0OTkwODc2MjcwMzA3MTgxMTIzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac6a2dab4250889e7f3035c4c265388011f93e6ee4e39f0b4ec6add4de0e93aa5e
hovercard-subject-tagissue:3352756861
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/14476/issue_layout
twitter:imagehttps://opengraph.githubassets.com/fb5d61eeffd4b828bc7781e3576d5c8c724a3a05271e43fefb5361bff0d826d0/rubocop/rubocop/issues/14476
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/fb5d61eeffd4b828bc7781e3576d5c8c724a3a05271e43fefb5361bff0d826d0/rubocop/rubocop/issues/14476
og:image:altThe Style/ClassAndModuleChildren cop is not safe to correct when the code occurs within another scope. This led to a bug in JRuby's build when using automated corrections. Nested module access will...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameheadius
hostnamegithub.com
expected-hostnamegithub.com
None7490a2fd98baca866acf503b81aa249491b42e5b4bab7f7a2801be81175c8845
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
release5814362c11fe63ca811caa7c470897ee2b3e593e
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://redirect.github.com/rubocop/rubocop/issues/14476#start-of-content
https://redirect.github.com/
Sign in https://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Frubocop%2Frubocop%2Fissues%2F14476
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%2F14476
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/14476
Reloadhttps://redirect.github.com/rubocop/rubocop/issues/14476
Reloadhttps://redirect.github.com/rubocop/rubocop/issues/14476
rubocop https://redirect.github.com/rubocop
rubocophttps://redirect.github.com/rubocop/rubocop
Please reload this pagehttps://redirect.github.com/rubocop/rubocop/issues/14476
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 119 https://redirect.github.com/rubocop/rubocop/issues
Pull requests 29 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/14476
New issuehttps://redirect.github.com/login?return_to=https://github.com/rubocop/rubocop/issues/14476
#14685https://github.com/rubocop/rubocop/pull/14685
Style/ClassAndModuleChildren not safe within module or classhttps://redirect.github.com/rubocop/rubocop/issues/14476#top
#14685https://github.com/rubocop/rubocop/pull/14685
bughttps://github.com/rubocop/rubocop/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/headius
https://github.com/headius
headiushttps://github.com/headius
on Aug 25, 2025https://github.com/rubocop/rubocop/issues/14476#issue-3352756861
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.