132 Commits

Author SHA1 Message Date
Issy Long
1b5fa172bb
Split audit_synced_versions_formulae checks into reusable methods
- This way we can use them in the audit and in `bump`.
2024-01-24 14:01:01 +00:00
Sean Molenaar
119e3d55ec chore: add audit to check if an EOL is known 2024-01-17 11:12:32 +01:00
Mike McQuaid
724e14ee25
formula_auditor: split audit_revision_and_version_scheme.
Separate this into two methods so we can have separate skips for each.
2024-01-12 14:18:00 +00:00
Douglas Eichelberger
3abbf4447e Some minor regexp match perf improvements 2023-12-27 13:16:36 -08:00
Michael Cho
3e428f7676
formula_auditor: split out checksum check 2023-12-20 10:22:26 -05:00
Rylan Polster
036723a668
Add deprecate! and disable! methods to the Cask DSL 2023-12-16 20:01:46 -05:00
Sam Ford
4a4f8cb2d2
FormulaAuditor: Add #committed_version_info method
The `#audit_stable_version` check was previously part of
`#audit_revision_and_version_scheme` and duplicates some of the
logic to identify previous version information. To avoid the
duplication, this extracts the logic into a `#committed_version_info`
method that can be called in both audits. The method stores the
information in instance variables, so we don't repeat the collection
process if it has already run.
2023-12-15 17:29:32 -05:00
Sam Ford
ccbde5952d
FormulaAuditor: Separate stable version audit
The "stable version should not decrease" formula audit currently
prevents us from being able to create bottles when downgrading a
formula version. We previously worked around this by bumping
`version_scheme` but this wasn't an intended use case and we now
avoid using it for this purpose.

We can handle simple formula downgrades by reverting changes in a
syntax-only PR but that isn't sufficient when we need new bottles
(i.e., if additional changes have been made to the formula in the
interim time). In the latter case, the only available solution may be
to revert all changes made after the previous version using a
syntax-only PR and then create another PR to reintroduce the other
changes and create new bottles.

To avoid the aforementioned approach, this splits the stable version
audit into a separate method, so we can use `brew audit
--except=stable_version` to selectively skip it.
2023-12-15 17:27:01 -05:00
Bo Anderson
5692c8ecbf
Fix style violations under newer RuboCop 2023-12-14 05:47:12 +00:00
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