Ensure that `FormulaVersions` correctly also looks at older paths for
sharded formulae.
While we're here, also cleanup `FormulaVersions` a bit to have more
signatures, cleanup dead code, make more code private, improve
variable naming.
This supports the use of `*-staging` branches in the future for projects
similar to the OpenSSL migration (e.g. Python migration). We already
have branch protections set for these branches, so it makes sense to
keep using them with the supporting code.
1. Adjust audit so that it ignore conflicts only for `brew audit --tap`.
This is useful because it prevents us from trying to migrate a formula
to `openssl@3` before all its dependencies have also been migrated.
2. Exempt only PRs that target a branch called
`openssl-migration-staging`.
- Fixes issue 14996.
- The API JSON is generated with a `/usr/local` Homebrew prefix, but
frequently now users have `/opt/homebrew` as their prefix. Since
formulae `keg_only` reasons are generated by the API, this can lead
to the confusing messaging that follows:
```
socket_vmnet is keg-only, which means it was not symlinked into /opt/homebrew,
because /usr/local/bin is often writable by a non-admin user.
```
- With this change, that formula as it is now will fail `brew audit`,
prompting to remove the prefix reference.
```
❯ HOMEBREW_NO_INSTALL_FROM_API=1 brew audit --strict socket_vmnet
socket_vmnet:
* `keg_only` reason should not include `HOMEBREW_PREFIX` as it provides confusing output.
Error: 1 problem in 1 formula detected
```
The `github_issue_comment` audit disallows references to closed or
merged PRs in other repositories. We should allow those, since it is a
common pattern to reference merged PRs in formulae when adding comments
that explain changes that need to be made in future versions (e.g.
`patch` blocks).
This audit is mistakenly passing for formulae where
`variations_dependencies` is an empty array. We can fix that by checking
for `nil` instead.
See Homebrew/homebrew-core#111280.
There is an audit for versioned formulae that makes sure
an unversioned formulae of the same name exists already.
This ignores that check when we exlicitly removed the
unversioned formula by checking if it was renamed.
Also, there is no need to check for formula.tap because
formula.core_formula? guarantees the presence of formula.tap.
The Git log is required only when `--strict` is not passed. This check
should still run with one of `--strict` or `--git`, but currently
passing `--strict` also requires `--git` in order to run this check.
This will still not be done during `tap_syntax` jobs after this change.
The GCC dependency check is adding a couple of minutes to our
`tap_syntax` jobs. Let's fix that by moving the check into a separate
method so we can exclude it from `tap_syntax`.