123 Commits

Author SHA1 Message Date
Bo Anderson
79441447f8
formula_auditor: handle nil tap 2023-11-05 00:59:16 +00:00
Ruoyu Zhong
1306ecc694
formula_auditor: audit all relicensed HashiCorp formulae
Apply #15975 to all affected formulae.
2023-09-08 22:45:57 +08:00
Michka Popoff
a24d15d942
terraform: add audit for relicensing
See also
https://github.com/Homebrew/homebrew-core/pull/139538
2023-09-06 21:28:01 +02:00
Mike McQuaid
b7114651ac
utils/curl: include or use explicitly.
Include or use `Utils::Curl` explicitly everywhere it is used.
2023-09-04 22:17:57 -04:00
Alexander Bayandin
b7cb8356c1
audit_file: fix condition
Co-authored-by: Bo Anderson <mail@boanderson.me>
2023-09-04 14:35:59 +01:00
Alexander Bayandin
de8eb35b73 audit_file: check formula path 2023-09-04 14:26:59 +01:00
Mike McQuaid
b594e87a7f
formula_auditor: make Linux-only GCC dep audit non-strict.
Otherwise we have to run this separately in `brew test-bot` which is
slower and more confusing.
2023-09-02 21:39:16 -04:00
Mike McQuaid
8d1064cdb1
formula_{auditor,versions}: handle sharding.
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.
2023-08-14 19:31:15 +01:00
Douglas Eichelberger
08e46c18cd Add type to Formula attrs 2023-07-24 14:12:36 -07:00
Carlo Cabrera
18b4fc4ba5
Merge pull request #15650 from Bo98/disabled-dependents-audit 2023-07-11 06:10:14 +08:00
Bo Anderson
0c9444a227
formula_auditor: check disabled formulae have disabled dependents 2023-07-07 23:48:35 +01:00
Bo Anderson
9dc459b026
formula_auditor: fix macOS system dependency false positive 2023-07-07 23:45:03 +01:00
Mike McQuaid
7da934f7e2
Deprecate/disable/delete code.
The next release after this is merged will be 4.1.0.

Co-authored-by: Markus Reiter <me@reitermark.us>
2023-07-06 16:56:20 +01:00
Bo Anderson
d1b923f314
Introduce UsesFromMacOSDependency
Add Formula#declared_deps and SoftwareSpec#declared_deps
2023-07-04 13:40:55 +01:00
Carlo Cabrera
0b57d7b04f
formula_auditor: make OpenSSL audit exception generic
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.
2023-06-27 14:44:12 +08:00
Carlo Cabrera
c5fe2a3559
formula_auditor: adjust deps audit for a staging branch
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`.
2023-06-20 22:37:06 +08:00
Carlo Cabrera
f13210801a
formula_auditor: handle head_info being nil
This happens when CI runs on an event that isn't a pull request (e.g.
push, merge_group).
2023-06-10 03:03:50 +08:00
Carlo Cabrera
8ff91a1939
formula_auditor: skip dependency conflict audit for OpenSSL migration
We can't migrate the entire OpenSSL dependency tree in one go, so we'll
have to skip this audit in the interim.

See Homebrew/homebrew-core#133144.
2023-06-10 00:53:11 +08:00
Markus Reiter
7cc1b6191e
Clean up brew audit output. 2023-05-19 19:40:37 +02:00
Markus Reiter
0d56b97b07
Add SimulateSystem::with. 2023-05-14 01:45:04 +02:00
Markus Reiter
8274920217
Rename OS::Mac::Version to MacOSVersion. 2023-05-09 05:08:38 +02:00
Douglas Eichelberger
08af78a2a5 brew style --fix 2023-04-25 09:26:24 -07:00
Carlo Cabrera
3631765a8d
formula_auditor: remove issue comment audit
See discussion at Homebrew/homebrew-core#128954.
2023-04-22 01:27:35 +08:00
Douglas Eichelberger
7720485f40 Enable types in Formula files 2023-03-25 08:50:06 -07:00
Issy Long
10b1af8b29
formula_auditor: Appease RuboCop with another &. 2023-03-22 13:54:43 +00:00
Issy Long
21f38ca3af
formula_auditor: Correct safe navigation positioning
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-03-22 13:43:33 +00:00
Issy Long
13fe1bb4b4
formula_auditor: Better keg_only reason message
Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2023-03-18 15:27:35 +00:00
Issy Long
bda88ce96e
formula_auditor: Having HOMEBREW_PREFIX in keg_only reasons is bad
- 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
```
2023-03-18 14:46:13 +00:00
Carlo Cabrera
72d8a50e7a
Disallow references to PRs that are closed but not merged 2023-02-15 16:18:48 +08:00
Carlo Cabrera
ca35e0ff11
formula_auditor: allow references to closed PRs
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).
2023-02-10 22:02:17 +08:00
Sean Molenaar
f7dda488ac
rubocop: check for closed issues in comments 2023-02-08 09:30:07 +01:00
Bo Anderson
246eabac01
formula_auditor: support non-master default branch for downgrade audit 2022-10-07 18:42:51 +01:00
Carlo Cabrera
1d7856c4f1
formula_auditor: fix false negatives in audit_gcc_dependency
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.
2022-09-23 06:00:26 +08:00
Troy McCabe
d490123d74 Second check for github repos as private homepages 2022-09-20 23:06:47 -05:00
Carlo Cabrera
c8c5dc199e
Handle :public_domain licenses. 2022-09-13 19:47:46 +08:00
Carlo Cabrera
dfd5895970
formula_auditor: disallow SSPL.
The SSPL is not an open-source license, but it is recognised by SPDX.

See Homebrew/homebrew-core#109801.
2022-09-13 19:22:11 +08:00
Carlo Cabrera
2af5a974c2
formula_auditor: fix false positive in audit_gcc_dependency.
Fixes Homebrew/homebrew-core#110178.
2022-09-11 01:41:32 +08:00
apainintheneck
bb1c783817 Ignore renamed formulae when checking for unversioned formulae
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.
2022-09-02 23:02:07 -07:00
EricFromCanada
675e80e9ae
formula_auditor: use symbols for spec iteration 2022-08-31 16:54:56 -04:00
Carlo Cabrera
1fae6062e6
Fix check for tap git directory.
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2022-08-25 23:57:04 +08:00
Carlo Cabrera
665b6ca5c5
formula_auditor: require --git only if not --strict
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.
2022-08-25 23:16:26 +08:00
Carlo Cabrera
fb2b21b298
Merge pull request #13750 from carlocab/gcc-dependency-check
formula_auditor: refactor GCC dependency check into separate method
2022-08-25 21:41:05 +08:00
Carlo Cabrera
84f544f08f
Require git log only when not strict 2022-08-25 20:54:19 +08:00
Carlo Cabrera
6175b3fe4c
Require --git. 2022-08-25 20:48:37 +08:00
Carlo Cabrera
378ff06f53
Speed up #linux_only_gcc_dep?.
`#to_hash_with_variations` is slow, let's avoid doing it unless needed.
2022-08-25 20:44:27 +08:00
Carlo Cabrera
8e09ec4bf4
Handle on_system blocks. 2022-08-24 20:34:43 +08:00
Carlo Cabrera
be4e926b15
Fix "dependencies" being nil. 2022-08-24 18:18:10 +08:00
Carlo Cabrera
69fbaf2dbf
Fix comment; reuse variations. 2022-08-24 15:12:58 +08:00
Carlo Cabrera
e68b1a4a89
Tweak #linux_only_gcc_dep?. 2022-08-24 15:09:53 +08:00
Carlo Cabrera
5f95cc388d
formula_auditor: refactor GCC dependency check into separate method
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`.
2022-08-24 13:22:00 +08:00