101 Commits

Author SHA1 Message Date
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
Carlo Cabrera
c42b6e2cad
Revert "formula_auditor: skip rename audit for glib-utils"
The necessary PRs in Homebrew/homebrew-core have been merged. See:
- Homebrew/homebrew-core#108307
- Homebrew/homebrew-core#108497

This reverts commit 6ca02b22bb27a45525fa62c6fba9902039152fcc.
2022-08-24 10:43:57 +08:00
Mike McQuaid
c294dcc616
glibc related cleanup
Extracted from https://github.com/Homebrew/brew/pull/13577
2022-08-23 12:42:02 +01:00
Mike McQuaid
c09b1a09ea
Merge pull request #13648 from carlocab/gcc-linux-audit
formula_auditor: audit for Linux-only dependencies on GCC
2022-08-23 11:46:38 +01:00
Carlo Cabrera
718cf8b0df
Fix Linux-only GCC dependency check.
This is based on feedback from code review.
2022-08-22 14:54:52 +08:00
Carlo Cabrera
6ca02b22bb
formula_auditor: skip rename audit for glib-utils
I am removing `glib-utils` in (1) Homebrew/homebrew-core#108307, and all
`glib-utils` dependencies in (2) Homebrew/homebrew-core#108497.

This audit prevents me from proceeding with (1) without rebuilding all
the formulae modified in (2). I don't think that is needed, so I'd like
to exempt `glib-utils` from the rename audit instead.

To give you a clearer idea of how I plan to do this, this is the order
of events:
1. Merge this change.
2. Merge Homebrew/homebrew-core#108307.
3. Merge Homebrew/homebrew-core#108497.
4. Revert this change.

This should allow us to get rid of `glib-utils` and its accompanying
hacks without having to rebuild dozens of formulae needlessly.
2022-08-20 17:30:24 +08:00
Carlo Cabrera
18722901ee
formula_auditor: create a versioned formula dependent conflict allowlist
We have an audit that checks each formula's dependency tree for multiple
versions of the same software. We have an allowlist that allows us to
ignore this audit, but this allowlist requires each formula with a
conflict in its dependency tree to be listed there.

Here, I propose the reverse: if formula `foo` appears in the
`versioned_formula_dependent_conflicts_allowlist`, then all its
dependents will not fail the versioned dependencies conflict because of
a conflict with formula `foo`.

I'd like to do this in the case of `python`, where I think the versioned
dependencies conflict check hurts us more than helps us. Versioned
dependency conflicts are most problematic in the case of libraries with
the same install name but incompatible ABIs. This is almost never a
problem with Python: almost no formulae link with the Python framework
on macOS (in part due to one of our audits that disallows Python
framework linkage in Python modules). Moreover, the various Python
frameworks that we ship have the version in the install name.

The above _might_ be a problem on Linux, since we allow unrestricted
linkage with `libpython`. However, we don't even check versioned
conflicts on Linux, so we aren't as concerned about this in the first
place.

This is also a lot more convenient than adding the dependents of some
Python formula one by one as they acquire conflicts due to changes in
other formulae.

I've also amended `tap_auditor` to allow the use of formula aliases in
an allowlist, to allow us to add `python` to this allowlist instead of
each individual versioned Python formula.

See also discussion at Homebrew/homebrew-core#108307.
2022-08-18 15:40:54 +08:00
Rylan Polster
d4ddfb88df
Merge pull request #13616 from Rylan12/simulate-macos-on-linux
Move `HOMEBREW_SIMULATE_MACOS_ON_LINUX` handling to `SimulateSystem`
2022-08-05 10:23:13 -04:00
Carlo Cabrera
4302af67b7
formula_auditor: audit for Linux-only dependencies on GCC
As we've seen, allowing Linux-only dependencies on GCC results in its
dependency tree growing out of control to the point of being extremely
painful to maintain.

Let's stop this situation from getting worse by:
- failing a `--strict` audit when there is a Linux-only GCC dependency.
  This also prevents new formulae from having such a dependency.
- failing any audit whenever a formula that did not previously have a
  Linux-only GCC dependency picks one up

If a future formula update causes a formula to fail to build on Linux
because it needs a newer GCC when it previously did not, then we should
not bottle it. We can bottle this hypothetical formula when our bottling
distribution includes a new enough version of GCC.
2022-08-04 22:17:47 +08:00
Carlo Cabrera
e217fd35c2
Merge pull request #12770 from carlocab/deprecated-dependencies
formula_auditor: audit for deprecated dependencies
2022-07-30 13:23:57 +08:00
Shaun Jackman
7d1197e8eb audit_glibc: Permit glibc 2.27, 2.31, or 2.35 2022-07-29 14:06:51 -07:00
Shaun Jackman
1ac5fc05bd audit_glibc: Permit glibc 2.35
See https://github.com/Homebrew/brew/issues/13619
2022-07-29 10:13:09 -07:00
Shaun Jackman
291eacd482 audit_glibc: Fix the error message
"The glibc version must be 2.35" should have read
"The glibc version must be 2.23".
2022-07-29 09:30:18 -07:00
Carlo Cabrera
7c7a92e8fb
formula_auditor: clean up error wording 2022-07-29 20:10:05 +08:00
Carlo Cabrera
cbff83898e
formula_auditor: audit for deprecated dependencies
Closes #12748.
2022-07-29 15:07:16 +08:00
Rylan Polster
ea1f2098ac
Move HOMEBREW_SIMULATE_MACOS_ON_LINUX handling to SimulateSystem 2022-07-28 15:04:25 -04:00
Mike McQuaid
1bb44979ee
Disable and delete code for 3.5.0
The next planned release will be 3.5.0 so let's fix things up for there.
2022-05-30 14:59:14 +01:00
Bo Anderson
5ea092c464
formula_auditor: fix versioned alias audit
* Fix audit not being run at all due to always-false condition.
* Don't fail audit if versioned alias would clash with a versioned formula.
* Allow versioned aliases with the name of another alias.
2022-03-21 14:44:50 +00:00
Rylan Polster
12b45e85dd
Merge pull request #12854 from jsoref/audit-new-formula-should-not-define-revision
formula_auditor: new formulas should not define a revision
2022-02-11 11:09:46 -05:00
Carlo Cabrera
6c9c3c607c
formula_auditor: disallow external tap dependencies in core
Occasionally, we get PRs that attempt to add a dependency on a formula
in an external tap in homebrew/core (e.g. Homebrew/homebrew-core#94791).

We don't actually have an audit that disallows that. We should have one.
2022-02-10 06:57:46 +08:00
Josh Soref
37fd64b5a3 formula_auditor: new formulas should not define a revision
Logically new formulas should start at revision 0, but a
developer might use an existing formula as a template and
otherwise not realize they should remove this field.

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2022-02-09 13:14:10 -05:00
Bo Anderson
8ab9465ad2
formula_auditor: fix error with formulae without taps 2021-12-13 23:05:45 +00:00
Alexander Bayandin
27a76295a4
Merge pull request #12279 from bayandin/synced-versions-formulae
formula_auditor: add audit for formulae with synced versions
2021-11-19 12:24:33 +00:00