155 Commits

Author SHA1 Message Date
Markus Reiter
4a1643e7ad
Refactor condition. 2024-07-30 21:48:59 +02:00
Markus Reiter
40d55f8035
Change type name. 2024-07-30 21:43:30 +02:00
Markus Reiter
3b4e1cb573
Share code between cask token and formula name audits. 2024-07-30 21:41:15 +02:00
Michka Popoff
352678d933
feat: enable audit for wayback urls on all formulae
Still for core only

Follow up of #16476

With https://github.com/Homebrew/homebrew-core/pull/160050 all formuale in core have been treated
2024-07-29 23:55:17 +02:00
apainintheneck
ef56236127 formula_auditor: scope eol check to core tap
This is not relevant information for third-party taps and requires
network requests to `endoflife.date` so it's best to avoid them
in this case.

Closes https://github.com/Homebrew/brew/issues/17531
2024-06-22 12:19:09 -07:00
Carlo Cabrera
4be3f8e467
formula_auditor: add exemption for nghttp2
Needed for Homebrew/homebrew-core#171634 due to nghttp2/nghttp2#2194.
2024-05-29 16:31:59 +08:00
Issy Long
9f915a6a62
Replace FormulaTextAuditor usage
- Only two audits were using this: `audit_keg_only_reason` and `audit_text`,
  and they weren't using any of its text processing methods, so there's little
  reason to keep it around.
- The "`keg_only_reason` shouldn't contain 'HOMEBREW_PREFIX'" audit can easily
  be replaced with a RuboCop since that's "just" text parsing.
- The "tests should invoke binaries with `bin/<command>`" audit had to stay as
  a FormulaAudit because it requires accessing attributes about the Formula
  like its name, aliases, which RuboCop can't get to, but it was easy to move the
  singular "read the text in the file" line from `FormulaTextAuditor`.
2024-05-04 22:14:55 +01:00
Markus Reiter
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Sean Molenaar
5e6f90f504 feat: add audit for wayback machine URLs 2024-04-25 17:11:16 +02:00
Michael Cho
2d50ef1bc0
formula_auditor: check livecheck throttle
Signed-off-by: Michael Cho <michael@michaelcho.dev>
2024-04-01 00:54:13 -04:00
Douglas Eichelberger
471e94d1e8 Add missing require 2024-03-31 13:14:56 -07:00
Douglas Eichelberger
330d209e03 Set ivars directly 2024-03-30 13:50:39 -07:00
Patrick Linnane
df84883f12
formula_auditor: generalize relicensed formula audit
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-03-20 20:59:35 -07:00
Patrick Linnane
216c79cebd
formula_auditor: handle redis relicense
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-03-20 20:49:06 -07:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Michael Cho
00a12b72d4
formula_auditor: also use tag when checking GitHub license
Signed-off-by: Michael Cho <michael@michaelcho.dev>
2024-03-04 12:11:13 -05:00
Michael Cho
72f8399110
formula_auditor: move out synced_versions_formulae logic
* tap: take ownership of synced_versions_formulae.json
* formula: add synced_with_other_formulae? logic

Signed-off-by: Michael Cho <michael@michaelcho.dev>
2024-03-03 20:51:09 -05:00
Issy Long
c2507fdc6d
formula_audit: Check the license(s) of the specific release
- Some repositories occasionally change their licenses. For example they
  release a version of the software with one license and then decide to change
  the license later.
- Now that `?ref=` is a parameter to the GitHub Repositories License API,
  we can use that in the license audit to check if the license of the specific
  release matches the one declared in the formula.
2024-02-27 16:53:54 +00: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
e0743a1436
Reapply "Refactor Formulary::loader_for."
This reverts commit 24683525cb5abf3cc79a9e0e268fa6efd0af558b.
2024-02-22 18:24:57 +01:00
Mike McQuaid
24683525cb
Revert "Refactor Formulary::loader_for." 2024-02-16 13:41:54 +00:00
Markus Reiter
b25d4c4c02
Fix duplicate quotes in dependency audit. 2024-02-15 22:43:29 +01:00
Markus Reiter
b717f5d954
Remove unused TapFormulaWithOldnameAmbiguityError. 2024-02-14 22:56:25 +01:00
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