325 Commits

Author SHA1 Message Date
Ruoyu Zhong
96048f0a5a
cmd/update-report: fix cask desc display too 2025-09-13 23:48:15 +08:00
Ruoyu Zhong
c834a862ab
cmd/update-report: fix formula description display
When on a non-default branch (for e.g., testing), `Formula[formula]` can
return an error. In that case let's silently ignore it.
2025-09-13 23:27:25 +08:00
Mike McQuaid
07091cfbea
Simplify pluralisation of common words
Formulae, dependencies, tries are all used in multiple places so let's
simplify them
2025-09-12 09:02:43 +01:00
Douglas Eichelberger
4d11307d41
Refactor T.must called on .last 2025-08-25 20:30:31 -07:00
Mike McQuaid
3bbff84ff1
Merge pull request #20525 from Homebrew/utils_output
Move `o*` output methods to `Utils::Output`
2025-08-22 09:10:29 +00:00
Ruoyu Zhong
16bc592e08
settings: typed: strict 2025-08-21 14:19:34 +08:00
Mike McQuaid
a1f112f3fe
Move o* output methods to Utils::Output
This reduces the surface area of our `Kernel` monkeypatch and removes
the need to `include Kernel` in a bunch of modules.

While we're here, also move `Kernel#require?` to `Homebrew` and fully
scope the calls to it.
2025-08-20 19:20:19 +01:00
Ruoyu Zhong
c481e71092
cmd/update-report: rework 2025-08-19 14:27:05 +08:00
Ruoyu Zhong
7cec7586ff
cmd/update-report: remove unused methods 2025-08-19 02:39:26 +08:00
Ruoyu Zhong
ee515fd5e0
cmd/update-report: show new formula/cask desc for non-API users too
This will make non-API users like myself happy.
2025-08-19 02:35:44 +08:00
Rylan Polster
fe3aec30bb
Fetch new API 2025-08-12 17:04:15 -04:00
Eric Knibbe
6255263b51
output: express environment variables consistently 2025-08-04 09:50:06 -04:00
Mike McQuaid
28753ef002
cmd/update-report: display descriptions for new formulae and casks.
This parses Homebrew's API JSON data to display descriptions for new
formulae and casks if available.

While we're here also add tests for ReporterHub.
2025-06-24 16:59:24 +01:00
Mike McQuaid
c4c66d41ef
cmd: set typed: strict 2025-06-17 16:33:16 +01:00
Mike McQuaid
08eae94955
cmd/update*: more fixes to allow migration from master to main.
We're not migrating Homebrew/brew to `main` yet but this will allow us
to ensure we have a `brew update` ready in future when we're ready to do
this.
2025-06-13 17:13:51 +01:00
Douglas Eichelberger
a81239ec2d
Enable strict typing in Formula 2025-02-24 10:23:42 -08:00
Douglas Eichelberger
8763fb6d29 Resolve rubocop violations 2025-02-17 18:56:31 -08:00
Issy Long
6ada9a9665
Add clarifying comments to rubocop:disables
- Needed for PR 18842 that adds a `DisableComment` RuboCop to ensure that all RuboCop disables have comments.
2025-01-12 16:59:07 +00:00
Mike McQuaid
94416e82f0
Add new odeprecated, odisabled, remove disabled code.
Prepare the usual deprecation cycle for Homebrew 4.4.0.
2024-09-24 10:15:34 +01:00
Issy Long
45978435e7
rubocop: Use Sorbet/StrictSigil as it's better than comments
- Previously I thought that comments were fine to discourage people from
  wasting their time trying to bump things that used `undef` that Sorbet
  didn't support. But RuboCop is better at this since it'll complain if
  the comments are unnecessary.

- Suggested in https://github.com/Homebrew/brew/pull/18018#issuecomment-2283369501.

- I've gone for a mixture of `rubocop:disable` for the files that can't
  be `typed: strict` (use of undef, required before everything else, etc)
  and `rubocop:todo` for everything else that should be tried to make
  strictly typed. There's no functional difference between the two as
  `rubocop:todo` is `rubocop:disable` with a different name.

- And I entirely disabled the cop for the docs/ directory since
  `typed: strict` isn't going to gain us anything for some Markdown
  linting config files.

- This means that now it's easier to track what needs to be done rather
  than relying on checklists of files in our big Sorbet issue:

```shell
$ git grep 'typed: true # rubocop:todo Sorbet/StrictSigil' | wc -l
    268
```

- And this is confirmed working for new files:

```shell
$ git status
On branch use-rubocop-for-sorbet-strict-sigils
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Library/Homebrew/bad.rb
        Library/Homebrew/good.rb

nothing added to commit but untracked files present (use "git add" to track)

$ brew style
Offenses:

bad.rb:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true.
^^^^^^^^^^^^^

1340 files inspected, 1 offense detected
```
2024-08-12 15:24:27 +01:00
Bevan Kay
0a9883a8dc
cmd/update-report: don't output cask updates on linux 2024-08-12 17:12:19 +10:00
Sam Ford
11d6785bea
Add utils/backtrace requires
This is primarily intended to resolve the `uninitialized constant
Utils::Backtrace` error in `formula_versions.rb:60` but I expanded it
to try to cover all existing usage of `Utils::Backtrace`.

I've followed the existing pattern, where `utils/backtrace` is
required in the context of where it's used. Many of these cases use
`Backtrace` in a conditional manner, so I've tried to ensure that the
`require` follows suit.
2024-07-15 17:48:47 -04:00
Mike McQuaid
c13700af00
Use repository consistently instead of repo
The documentation linting job doesn't like `repo` so let's fix this
globally rather than naming it differently in documentation and code.
2024-06-10 09:31:53 +01:00
Mike McQuaid
222fe8ef0b
Homebrew 4.3.0 deprecation/disable/removals.
The usual pass of deprecating/disabling/removing code for the next
minor Homebrew release.
2024-05-07 12:18:04 +01:00
Markus Reiter
caf87c0336
Warn about undocumented non-private APIs. 2024-05-01 11:35:20 +02:00
Markus Reiter
0b56d0be4a
Document Tab.for_keg and use Keg#tab where possible. 2024-04-28 20:50:13 +02:00
Douglas Eichelberger
d5add6565c Port Homebrew::Cmd::UpdateReport 2024-04-01 11:58:20 -07:00
apainintheneck
fb8c0d2b30 s/Tap.select(&:installed?)/Tap.installed/ 2024-03-08 23:22:00 -08:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Patrick Linnane
faf399716f
Fix Style/RedundantLineContinuation offenses
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-02-29 09:26:51 -08:00
Markus Reiter
18571e8991
Merge pull request #16732 from reitermarkus/repo-var-suffix
Rename `Tap#repo_var` to `Tap#repo_var_suffix`.
2024-02-27 11:26:16 +01:00
Issy Long
f4218a6316
Fix RuboCop Performance/MapCompact offenses
- Rename an iterator variable since it would make the line too long.
2024-02-25 22:59:59 +00:00
Markus Reiter
132a87aff5
Rename Tap#repo_var to Tap#repo_var_suffix. 2024-02-23 16:02:29 +01:00
Markus Reiter
ab27efbd9d
Make Tap::each respect the API. 2024-02-22 17:56:47 +01:00
Markus Reiter
9f5e1f2870
Clean up Tap#ensure_installed! usage. 2024-02-21 03:21:02 +01:00
Mike McQuaid
36024e2a4d
Merge pull request #16506 from MikeMcQuaid/adjust_installfromapimessage
cmd/update-report: adjust installfromapimessage.
2024-01-19 19:20:04 +00:00
Mike McQuaid
6a8ac2bd0e
cmd/update-report: adjust installfromapimessage.
Only warn about `HOMEBREW_NO_INSTALL_FROM_API` and make this a one-time
message.

Fixes #16481
2024-01-19 08:55:03 +00:00
Issy Long
f682147598
Fix RuboCop Style/RedundantFreeze offenses 2024-01-18 22:20:01 +00:00
Douglas Eichelberger
0191af7899 resolve typecheck errors 2023-11-05 08:55:58 -08:00
apainintheneck
85bd4c7e1f utils/backtrace: scrub sorbet-runtime from backtrace
Ever since we started using this at runtime it's been polluting
the backtrace output. This makes it harder to debug errors and
increases the amount of info users have to paste into the box
when filing an issue.

This is a very direct approach. Essentially, we strip out
everything related to the `sorbet-runtime` gem whenever the top
line in the backtrace is unrelated to sorbet-runtime.

The hope is that this will allow errors related to sorbet to
be diagnosed easily while also reducing the backtrace size
for all other types of errors.

Sometimes it is useful to see the full backtrace though.
For those cases, we include the full backtrace when
`--verbose` is passed in and print a warning that the
Sorbet lines have been removed from the backtrace the
first time they are removed.

Note: This requires gems to be set up so that the call to
`Gem.paths.home` works correctly. For that reason, it must
be included after `utils/gems` which is included in
`standalone/load_path` already.
2023-09-21 21:07:22 -07:00
Mike McQuaid
2d133ba1a6
cmd/update-report: improve tap/untap behaviour.
- unify core tapping/untapping behaviour (so we can never tap and then
  immediately untap)
- automatically untap homebrew-core or homebrew-cask if it's old, on
  the default branch and it doesn't seem to be needed
- if we think it's unneeded but it's too new: output a message instead

Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2023-08-16 14:06:26 +01:00
Mike McQuaid
1481eac57c
brew.sh: don't set HOMEBREW_NO_INSTALL_FROM_API automatically.
My understanding is that now https://github.com/Homebrew/brew/pull/15778
has been merged this should now work fine on both older macOS versions
and non-default prefixes so let's try this again.
2023-08-15 11:42:02 +01:00
Mike McQuaid
38f00671c4
cmd/update-report: correctly handle added/deleted formulae/casks.
If a formulae or cask is marked as both added and deleted, we've just
incorrectly detected it. Remove it from the report.

This can happen when a formula or cask is moved around in the repository
e.g. with sharding.
2023-08-14 19:28:56 +01:00
Mike McQuaid
565eb363ea
update_report: show "Delete and Installed" header.
Clarify that the deleted formulae/casks when not using `report_all`
are only those that have been deleted _and_ the user has them
installed. This should avoid users glossing over this information as
it is pretty relevant to them.

While we're here, refactor some of the `report_all` logic to make it
easier to remove it all on the next Homebrew major/minor version.
2023-08-08 16:57:03 +01:00
eugenesvk
2c7c064040 Allow hiding new formula/cask sections on update 2023-08-07 20:38:54 +07:00
Mike McQuaid
21d8f82056
Add/use HOMEBREW_INSTALL_FROM_API_UNSUPPORTED
When we're automatically setting `HOMEBREW_NO_INSTALL_FROM_API`
when on an old macOS version or with a non-default prefix (e.g. cases
where you're going to be mostly building from source).

My initial plan was to set
`HOMEBREW_AUTOMATICALLY_SET_NO_INSTALL_FROM_API` in these cases but
it's used differently enough it made sense to add another internal
variable instead: `HOMEBREW_INSTALL_FROM_API_UNSUPPORTED`.

At the moment this is only used to avoid printing the "You have set
`HOMEBREW_NO_INSTALL_FROM_API`" message inside `brew update` but may
make sense to use in other places over time.

Ideally, we'll get rid of these automatic sets of
`HOMEBREW_NO_INSTALL_FROM_API` and perhaps even the variable entirely.
2023-07-27 12:36:54 +01:00
Mike McQuaid
77061817f7
Fix (again) InfluxDB analytics messaging
Address https://github.com/Homebrew/brew/pull/15688#issuecomment-1638725595

Fixes https://github.com/Homebrew/brew/issues/15678
2023-07-18 08:03:57 +01:00
Bo Anderson
beaa6c32a0
Fix cases of core taps being unnecessarily installed 2023-07-13 20:33:31 +01:00
Bo Anderson
ba02c669e1
Introduce CoreCaskTap class 2023-07-13 20:33:26 +01:00
Bo Anderson
623eeb4e47
cmd/update-report: tweak messages for CI 2023-07-07 21:10:21 +01:00