Skip to content

Split one-class-per-file todos#22212

Merged
MikeMcQuaid merged 1 commit into
mainfrom
split-classes-into-separate-files-rubocop-style/oneclassperfile
May 10, 2026
Merged

Split one-class-per-file todos#22212
MikeMcQuaid merged 1 commit into
mainfrom
split-classes-into-separate-files-rubocop-style/oneclassperfile

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

  • Removes inline Style/OneClassPerFile todos by giving each affected top-level class or module its own file.
  • Keeps existing entry-point requires so callers retain stable load paths while RuboCop can enforce the style.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes. Non-maintainers may only have one AI-assisted/generated PR open at a time.

OpenAI Codex 5.5 xhigh with local review.


Copilot AI review requested due to automatic review settings May 10, 2026 08:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes Style/OneClassPerFile RuboCop todos by extracting previously co-located top-level classes/modules into dedicated files, while keeping existing entry-point requires to preserve stable load paths across Homebrew.

Changes:

  • Split several top-level classes/modules out of “entry-point” files (e.g., tap.rb, tab.rb, resource.rb, options.rb, lock_file.rb, etc.) and replaced inline definitions with require statements.
  • Moved the download strategy class hierarchy into individual files under Library/Homebrew/download_strategy/.
  • Split various core extensions (blank?/deep_dup/duplicable/enumerable) into one-class-per-file layouts and added corresponding requires.

Reviewed changes

Copilot reviewed 84 out of 84 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Library/Homebrew/utils/github/artifacts/github_artifact_download_strategy.rb New per-class file for GitHub Actions artifact download strategy.
Library/Homebrew/utils/github/artifacts.rb Removes inline strategy class; requires the extracted strategy file.
Library/Homebrew/tap/abstract_core_tap.rb Extracts AbstractCoreTap into its own file.
Library/Homebrew/tap/core_tap.rb Extracts CoreTap into its own file.
Library/Homebrew/tap/core_cask_tap.rb Extracts CoreCaskTap into its own file.
Library/Homebrew/tap/tap_config.rb Extracts TapConfig into its own file.
Library/Homebrew/tap.rb Removes multiple inline classes; requires extracted tap-related files.
Library/Homebrew/tab/tab.rb Extracts Tab into its own file.
Library/Homebrew/tab.rb Removes inline Tab; requires extracted tab/tab.
Library/Homebrew/resource/resource_stage_context.rb Extracts ResourceStageContext into its own file.
Library/Homebrew/resource.rb Removes inline ResourceStageContext; requires extracted file.
Library/Homebrew/reinstall/reinstall.rb Extracts Homebrew::Reinstall implementation into its own file.
Library/Homebrew/reinstall.rb Removes inline module; requires extracted reinstall implementation.
Library/Homebrew/os/linux/elf/os.rb Extracts OS::Linux::Elf helper module into its own file.
Library/Homebrew/os/linux/elf.rb Removes inline OS::Linux::Elf; requires extracted file.
Library/Homebrew/options/options.rb Extracts Options into its own file.
Library/Homebrew/options/deprecated_option.rb Extracts DeprecatedOption into its own file.
Library/Homebrew/options.rb Removes inline Options/DeprecatedOption; requires extracted files.
Library/Homebrew/lock_file/formula_lock.rb Extracts FormulaLock into its own file.
Library/Homebrew/lock_file/cask_lock.rb Extracts CaskLock into its own file.
Library/Homebrew/lock_file/download_lock.rb Extracts DownloadLock into its own file.
Library/Homebrew/lock_file.rb Removes inline lock classes; requires extracted lock files.
Library/Homebrew/extend/os/mac/hardware/cpu/hardware.rb Extracts macOS CPU sysctl helpers into a dedicated file.
Library/Homebrew/extend/os/mac/hardware/cpu.rb Removes inline Hardware::CPU; requires extracted file.
Library/Homebrew/extend/os/mac/extend/pathname/os.rb Extracts OS::Mac::Pathname::ClassMethods into its own file.
Library/Homebrew/extend/os/mac/extend/pathname.rb Removes inline module; requires extracted file.
Library/Homebrew/extend/os/linux/extend/pathname/os.rb Extracts OS::Linux::Pathname::ClassMethods into its own file.
Library/Homebrew/extend/os/linux/extend/pathname.rb Removes inline module; requires extracted file.
Library/Homebrew/extend/object/duplicable/method.rb Extracts Method#duplicable? override into its own file.
Library/Homebrew/extend/object/duplicable/unbound_method.rb Extracts UnboundMethod#duplicable? override into its own file.
Library/Homebrew/extend/object/duplicable/singleton.rb Extracts Singleton#duplicable? override into its own file.
Library/Homebrew/extend/object/duplicable.rb Removes inline classes/modules; requires extracted duplicable extensions.
Library/Homebrew/extend/object/deep_dup/array.rb Extracts Array#deep_dup into its own file.
Library/Homebrew/extend/object/deep_dup/hash.rb Extracts Hash#deep_dup into its own file.
Library/Homebrew/extend/object/deep_dup/module.rb Extracts Module#deep_dup into its own file.
Library/Homebrew/extend/object/deep_dup.rb Removes inline deep-dup extensions; requires extracted files.
Library/Homebrew/extend/enumerable/hash.rb Extracts Hash#compact_blank override into its own file.
Library/Homebrew/extend/enumerable.rb Removes inline Hash#compact_blank; requires extracted file.
Library/Homebrew/extend/blank/nil_class.rb Extracts NilClass#blank?/present? into its own file.
Library/Homebrew/extend/blank/false_class.rb Extracts FalseClass#blank?/present? into its own file.
Library/Homebrew/extend/blank/true_class.rb Extracts TrueClass#blank?/present? into its own file.
Library/Homebrew/extend/blank/array.rb Extracts Array#blank?/present? into its own file.
Library/Homebrew/extend/blank/hash.rb Extracts Hash#blank?/present? into its own file.
Library/Homebrew/extend/blank/symbol.rb Extracts Symbol#blank?/present? into its own file.
Library/Homebrew/extend/blank/string.rb Extracts String#blank?/present? into its own file.
Library/Homebrew/extend/blank/numeric.rb Extracts Numeric#blank?/present? into its own file.
Library/Homebrew/extend/blank/time.rb Extracts Time#blank?/present? into its own file.
Library/Homebrew/extend/blank.rb Removes inline blank?/present? overrides; requires extracted files.
Library/Homebrew/download_strategy/abstract_download_strategy.rb Extracts AbstractDownloadStrategy into its own file.
Library/Homebrew/download_strategy/abstract_file_download_strategy.rb Extracts AbstractFileDownloadStrategy into its own file.
Library/Homebrew/download_strategy/vcs_download_strategy.rb Extracts VCSDownloadStrategy into its own file.
Library/Homebrew/download_strategy/curl_download_strategy.rb Extracts CurlDownloadStrategy into its own file.
Library/Homebrew/download_strategy/pypi_download_strategy.rb Extracts PyPIDownloadStrategy into its own file.
Library/Homebrew/download_strategy/homebrew_curl_download_strategy.rb Extracts HomebrewCurlDownloadStrategy into its own file.
Library/Homebrew/download_strategy/curl_github_packages_download_strategy.rb Extracts CurlGitHubPackagesDownloadStrategy into its own file.
Library/Homebrew/download_strategy/curl_apache_mirror_download_strategy.rb Extracts CurlApacheMirrorDownloadStrategy into its own file.
Library/Homebrew/download_strategy/curl_post_download_strategy.rb Extracts CurlPostDownloadStrategy into its own file.
Library/Homebrew/download_strategy/no_unzip_curl_download_strategy.rb Extracts NoUnzipCurlDownloadStrategy into its own file.
Library/Homebrew/download_strategy/local_bottle_download_strategy.rb Extracts LocalBottleDownloadStrategy into its own file.
Library/Homebrew/download_strategy/subversion_download_strategy.rb Extracts SubversionDownloadStrategy into its own file.
Library/Homebrew/download_strategy/git_download_strategy.rb Extracts GitDownloadStrategy into its own file.
Library/Homebrew/download_strategy/github_git_download_strategy.rb Extracts GitHubGitDownloadStrategy into its own file.
Library/Homebrew/download_strategy/cvs_download_strategy.rb Extracts CVSDownloadStrategy into its own file.
Library/Homebrew/download_strategy/mercurial_download_strategy.rb Extracts MercurialDownloadStrategy into its own file.
Library/Homebrew/download_strategy/bazaar_download_strategy.rb Extracts BazaarDownloadStrategy into its own file.
Library/Homebrew/download_strategy/fossil_download_strategy.rb Extracts FossilDownloadStrategy into its own file (contains a newly introduced parsing bug per review comments).
Library/Homebrew/download_strategy/download_strategy_detector.rb Extracts DownloadStrategyDetector into its own file.
Library/Homebrew/description_cache_store/cask_description_cache_store.rb Extracts CaskDescriptionCacheStore into its own file.
Library/Homebrew/description_cache_store.rb Removes inline cask cache store; requires extracted file.
Library/Homebrew/dependency/uses_from_macos_dependency.rb Extracts UsesFromMacOSDependency into its own file.
Library/Homebrew/dependency.rb Removes inline macOS dependency class; requires extracted file.
Library/Homebrew/dependencies/requirements.rb Extracts Requirements into its own file.
Library/Homebrew/dependencies.rb Removes inline Requirements; requires extracted file.
Library/Homebrew/compilers/compiler_failure.rb Extracts CompilerFailure into its own file.
Library/Homebrew/compilers/compiler_selector.rb Extracts CompilerSelector into its own file.
Library/Homebrew/compilers.rb Removes inline compiler classes; requires extracted files.
Library/Homebrew/cmd/update-report.rb Removes inline Reporter/ReporterHub; requires extracted files.
Library/Homebrew/cmd/update_report/reporter.rb Extracts Reporter into its own file.
Library/Homebrew/cmd/update_report/reporter_hub.rb Extracts ReporterHub into its own file.
Library/Homebrew/cache_store/cache_store.rb Extracts CacheStore into its own file.
Library/Homebrew/cache_store.rb Removes inline CacheStore; requires extracted file.
Library/Homebrew/brew_irb_helpers/symbol.rb Extracts Symbol IRB helper methods into its own file.
Library/Homebrew/brew_irb_helpers.rb Removes inline Symbol helper; requires extracted file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Library/Homebrew/download_strategy/fossil_download_strategy.rb
Comment thread Library/Homebrew/tap/core_tap.rb
@MikeMcQuaid
Copy link
Copy Markdown
Member Author

Will address Copilot comments in a follow-up PR to avoid any logic changes here.

- Removes inline `Style/OneClassPerFile` todos by giving each
  affected top-level class or module its own file.
- Keeps existing entry-point `require`s so callers retain stable load
  paths while RuboCop can enforce the style.
- Updates `Style/Documentation.Include` for split public API files so
  the generated CI check remains in sync.
@MikeMcQuaid MikeMcQuaid force-pushed the split-classes-into-separate-files-rubocop-style/oneclassperfile branch from 7981640 to 1086345 Compare May 10, 2026 08:25
@MikeMcQuaid MikeMcQuaid enabled auto-merge May 10, 2026 08:28
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue May 10, 2026
Merged via the queue into main with commit 0c62c87 May 10, 2026
36 checks passed
@MikeMcQuaid MikeMcQuaid deleted the split-classes-into-separate-files-rubocop-style/oneclassperfile branch May 10, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants