Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Sorbet typed: strict in all (non-package) files in Homebrew organisation #17297

Open
3 of 5 tasks
MikeMcQuaid opened this issue May 14, 2024 · 9 comments
Open
3 of 5 tasks
Assignees
Labels
features New features help wanted We want help addressing this

Comments

@MikeMcQuaid
Copy link
Member

MikeMcQuaid commented May 14, 2024

Verification

Provide a detailed description of the proposed feature

We should use Sorbet's typed: strict for all (non-package i.e. not casks or formulae) files in the Homebrew organisation.

Some good transition steps will include:

What is the motivation for the feature?

  • Improving the reliability of Homebrew
  • Providing additional support to tests to avoiding regressions
  • Improving our API documentation

How will the feature be relevant to at least 90% of Homebrew users?

Making Homebrew more reliable.

What alternatives to the feature have been considered?

Not doing this.

@MikeMcQuaid MikeMcQuaid added help wanted We want help addressing this features New features labels May 14, 2024
@issyl0

This comment has been minimized.

@issyl0
Copy link
Member

issyl0 commented Jul 4, 2024

Follow-up work for dev-cmd and patterns to be aware of for future conversions:

Think it'd be good to get rid of some of the T.nilable and T.untyped when possible later but: this is better than the status quo for sure. There's also some returns(NilClass) that should probably be void. All this can be done in follow-ups. Thanks again!

@issyl0
Copy link
Member

issyl0 commented Aug 8, 2024

To set expectations: this is a slow burn kind of task because if I do too much of it at once then my brain melts. But I've got some branches on the go.

@issyl0
Copy link
Member

issyl0 commented Aug 9, 2024

I reran spoom bump [...] -f --dry as of 2024-08-09 and categorized (ish) these into groups to make it seem less 😱.

Public APIs

grep -rL "# typed: strict" Library/Homebrew | xargs grep -l "@api public"

  • extend/pathname.rb
  • extend/ENV/super.rb
  • extend/kernel.rb
  • download_strategy.rb
  • utils/inreplace.rb
  • tap.rb
  • resource.rb
  • cask/cask.rb
  • cask/url.rb
  • cask/dsl/version.rb
  • cask/dsl.rb
  • formula.rb

API

  • api.rb
  • api/analytics.rb
  • api/cask.rb
  • api/download.rb
  • api/formula.rb

Cask

  • cask/artifact/abstract_artifact.rb
  • cask/artifact/abstract_flight_block.rb
  • cask/artifact/abstract_uninstall.rb
  • cask/artifact/binary.rb
  • cask/artifact/installer.rb
  • cask/artifact/keyboard_layout.rb
  • cask/artifact/manpage.rb
  • cask/artifact/mdimporter.rb
  • cask/artifact/moved.rb
  • cask/artifact/pkg.rb
  • cask/artifact/qlplugin.rb
  • cask/artifact/relocated.rb
  • cask/artifact/stage_only.rb
  • cask/artifact/symlinked.rb
  • cask/artifact/uninstall.rb
  • cask/artifact/zap.rb
  • cask/artifact_set.rb
  • cask/audit.rb
  • cask/auditor.rb
  • cask/cask_loader.rb
  • cask/caskroom.rb
  • cask/config.rb
  • cask/download.rb
  • cask/dsl/base.rb
  • cask/dsl/caveats.rb
  • cask/dsl/conflicts_with.rb
  • cask/dsl/container.rb
  • cask/dsl/depends_on.rb
  • cask/exceptions.rb
  • cask/installer.rb
  • cask/list.rb
  • cask/macos.rb
  • cask/metadata.rb
  • cask/migrator.rb
  • cask/pkg.rb
  • cask/quarantine.rb
  • cask/reinstall.rb
  • cask/staged.rb
  • cask/tab.rb
  • cask/uninstall.rb
  • cask/utils.rb
  • cask_dependent.rb

Commands

  • cli/named_args.rb
  • cmd/--prefix.rb
  • cmd/deps.rb
  • cmd/fetch.rb
  • cmd/gist-logs.rb
  • cmd/home.rb
  • cmd/info.rb
  • cmd/leaves.rb
  • cmd/link.rb
  • cmd/list.rb
  • cmd/options.rb
  • cmd/outdated.rb
  • cmd/search.rb
  • cmd/tap-info.rb
  • cmd/update-report.rb
  • cmd/uses.rb
  • commands.rb
  • dev-cmd/extract.rb
  • compilers.rb
  • completions.rb
  • context.rb
  • cxxstdlib.rb
  • debrew.rb
  • debrew/irb.rb
  • dependable.rb
  • dependencies.rb
  • dependencies_helpers.rb
  • dependency.rb
  • dependency_collector.rb
  • deprecate_disable.rb
  • description_cache_store.rb
  • descriptions.rb
  • diagnostic.rb
  • downloadable.rb
  • exceptions.rb

Extend

  • extend/ENV/shared.rb
  • extend/api_hashable.rb
  • extend/io.rb
  • extend/on_system.rb
  • extend/os/linux/cleanup.rb
  • extend/os/linux/cmd/update-report.rb
  • extend/os/linux/dependency_collector.rb
  • extend/os/linux/development_tools.rb
  • extend/os/linux/diagnostic.rb
  • extend/os/linux/extend/ENV/shared.rb
  • extend/os/linux/extend/ENV/std.rb
  • extend/os/linux/extend/ENV/super.rb
  • extend/os/linux/formula.rb
  • extend/os/linux/formula_installer.rb
  • extend/os/linux/hardware/cpu.rb
  • extend/os/linux/install.rb
  • extend/os/linux/keg.rb
  • extend/os/linux/keg_relocate.rb
  • extend/os/linux/linkage_checker.rb
  • extend/os/linux/parser.rb
  • extend/os/linux/simulate_system.rb
  • extend/os/linux/system_config.rb
  • extend/os/mac/cleaner.rb
  • extend/os/mac/cleanup.rb
  • extend/os/mac/dependency_collector.rb
  • extend/os/mac/dev-cmd/bottle.rb
  • extend/os/mac/development_tools.rb
  • extend/os/mac/diagnostic.rb
  • extend/os/mac/extend/ENV/std.rb
  • extend/os/mac/extend/ENV/super.rb
  • extend/os/mac/formula.rb
  • extend/os/mac/formula_installer.rb
  • extend/os/mac/hardware/cpu.rb
  • extend/os/mac/keg.rb
  • extend/os/mac/keg_relocate.rb
  • extend/os/mac/linkage_checker.rb
  • extend/os/mac/readall.rb
  • extend/os/mac/simulate_system.rb
  • extend/os/mac/system_config.rb
  • extend/os/mac/utils/bottles.rb

Formula

  • formula_auditor.rb
  • formula_cellar_checks.rb
  • formula_creator.rb
  • formula_info.rb
  • formula_installer.rb
  • formula_pin.rb
  • formula_support.rb
  • formula_versions.rb
  • formulary.rb

Linters

  • rubocops/blank.rb
  • rubocops/bottle.rb
  • rubocops/cask/array_alphabetization.rb
  • rubocops/cask/ast/cask_block.rb
  • rubocops/cask/ast/cask_header.rb
  • rubocops/cask/ast/stanza.rb
  • rubocops/cask/constants/stanza.rb
  • rubocops/cask/desc.rb
  • rubocops/cask/discontinued.rb
  • rubocops/cask/extend/node.rb
  • rubocops/cask/homepage_url_styling.rb
  • rubocops/cask/mixin/cask_help.rb
  • rubocops/cask/mixin/on_desc_stanza.rb
  • rubocops/cask/mixin/on_homepage_stanza.rb
  • rubocops/cask/mixin/on_url_stanza.rb
  • rubocops/cask/no_overrides.rb
  • rubocops/cask/on_system_conditionals.rb
  • rubocops/cask/shared_filelist_glob.rb
  • rubocops/cask/stanza_grouping.rb
  • rubocops/cask/stanza_order.rb
  • rubocops/cask/url.rb
  • rubocops/cask/url_legacy_comma_separators.rb
  • rubocops/cask/variables.rb
  • rubocops/checksum.rb
  • rubocops/compact_blank.rb
  • rubocops/components_order.rb
  • rubocops/conflicts.rb
  • rubocops/dependency_order.rb
  • rubocops/deprecate_disable.rb
  • rubocops/desc.rb
  • rubocops/extend/formula_cop.rb
  • rubocops/install_bundler_gems.rb
  • rubocops/io_read.rb
  • rubocops/keg_only.rb
  • rubocops/lines.rb
  • rubocops/move_to_extend_os.rb
  • rubocops/negate_include.rb
  • rubocops/no_fileutils_rmrf.rb
  • rubocops/patches.rb
  • rubocops/presence.rb
  • rubocops/present.rb
  • rubocops/safe_navigation_with_blank.rb
  • rubocops/service.rb
  • rubocops/shared/desc_helper.rb
  • rubocops/shared/helper_functions.rb
  • rubocops/shared/homepage_helper.rb
  • rubocops/shared/on_system_conditionals_helper.rb
  • rubocops/shared/url_helper.rb
  • rubocops/shell_commands.rb
  • rubocops/text.rb
  • rubocops/urls.rb
  • rubocops/uses_from_macos.rb

Utils

  • url.rb
  • utils.rb
  • utils/analytics.rb
  • utils/bottles.rb
  • utils/curl.rb
  • utils/fork.rb
  • utils/formatter.rb
  • utils/gems.rb
  • utils/git.rb
  • utils/github.rb
  • utils/github/api.rb
  • utils/link.rb
  • utils/popen.rb
  • utils/pypi.rb
  • utils/repology.rb
  • utils/ruby_check_version_script.rb
  • utils/service.rb
  • utils/shared_audits.rb
  • utils/shell.rb
  • utils/spdx.rb
  • utils/svn.rb
  • utils/topological_hash.rb
  • utils/tty.rb
  • utils/user.rb

Other (TODO: break these down further, or just grab a few and start)

  • PATH.rb
  • build.rb
  • build_environment.rb
  • build_options.rb
  • bundle_version.rb
  • cache_store.rb
  • caveats.rb
  • cleaner.rb
  • cleanup.rb
  • cli/args.rb # Can't bump to strict because it uses undef
  • sbom.rb
  • search.rb
  • service.rb
  • settings.rb
  • simulate_system.rb
  • software_spec.rb
  • sorbet/parlour.rb
  • standalone/init.rb
  • standalone/sorbet.rb
  • startup/config.rb
  • startup/ruby_path.rb
  • style.rb
  • system_command.rb
  • system_config.rb
  • tab.rb
  • tap_auditor.rb
  • test.rb
  • test/support/fixtures/failball.rb
  • test/support/fixtures/failball_offline_install.rb
  • test/support/fixtures/testball.rb
  • test/support/fixtures/testball_bottle.rb
  • test/support/fixtures/testball_bottle_cellar.rb
  • test/support/helper/cask/install_helper.rb
  • test/support/helper/cask/never_sudo_system_command.rb
  • test/support/helper/files.rb
  • test/support/helper/fixtures.rb
  • test/support/helper/integration_mocks.rb
  • test/support/lib/startup/config.rb
  • test/support/quiet_progress_formatter.rb
  • uninstall.rb
  • unlink.rb
  • unversioned_cask_checker.rb
  • upgrade.rb
  • warnings.rb
  • yard/docstring_parser.rb
  • yard/templates/default/docstring/html/setup.rb
  • - [ ] github_packages.rb
  • global.rb
  • hardware.rb
  • help.rb
  • ignorable.rb
  • install.rb
  • install_renamed.rb
  • installed_dependents.rb
  • keg.rb
  • keg_relocate.rb
  • lazy_object.rb
  • linkage_cache_store.rb
  • linkage_checker.rb
  • locale.rb
  • lock_file.rb
  • macos_version.rb
  • manpages.rb
  • manpages/converter/kramdown.rb
  • manpages/converter/roff.rb
  • manpages/parser/ronn.rb
  • metafiles.rb
  • migrator.rb
  • missing_formula.rb
  • mktemp.rb
  • options.rb
  • os/linux.rb
  • os/linux/elf.rb
  • os/linux/glibc.rb
  • os/mac.rb
  • os/mac/keg.rb
  • os/mac/mach.rb
  • os/mac/sdk.rb
  • os/mac/xcode.rb
  • patch.rb
  • pkg_version.rb
  • readall.rb
  • reinstall.rb
  • requirement.rb
  • requirements/arch_requirement.rb
  • requirements/codesign_requirement.rb
  • requirements/macos_requirement.rb
  • requirements/xcode_requirement.rb
  • resource_auditor.rb

@issyl0
Copy link
Member

issyl0 commented Aug 12, 2024

For item two on the initial transition ideas list:

enabling Sorbet in brew test-bot for taps

I have no idea how test-bot works in this case, but it sounds good. Anyone else got any ideas for approaches here? I do know that brew typecheck does HOMEBREW_LIBRARY_PATH.cd so that it only runs on Library/Homebrew/ code, not taps.

@MikeMcQuaid
Copy link
Member Author

Anyone else got any ideas for approaches here?

brew typecheck should/could take a tap or path argument and then it should be scoped to that directory when run (like brew style).

@issyl0
Copy link
Member

issyl0 commented Aug 13, 2024

If anyone's looking to help with this (thank you), please note that git grep rubocop:todo Sorbet/StrictSigil should give you a good starting point. The ones with rubocop:disable Sorbet/StrictSigil are probably related to #17998 which is a question we still need to answer, but there's plenty of TODOs to do in the meantime.

@issyl0
Copy link
Member

issyl0 commented Aug 20, 2024

Which taps need typing? So far I've done homebrew/test-bot, homebrew/services, homebrew/command-not-found. Still on my list are homebrew/bundle and?

@MikeMcQuaid
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
features New features help wanted We want help addressing this
Projects
None yet
Development

No branches or pull requests

2 participants