180 Commits

Author SHA1 Message Date
Mike McQuaid
d661cffc1f
Switch to using main as the default branch
Homebrew/brew has moved to a `main` default branch so we can more move
references from `master` to `main`.
2025-06-24 11:14:57 +01:00
Mike McQuaid
55f65ec375
audit: ensure that official formula and cask names don't conflict.
Co-authored-by: Eric Knibbe <enk3@outlook.com>
2025-06-23 16:08:13 +01:00
Eric Knibbe
cd6777fc73
audits: quote and reword problem description text 2025-05-30 23:49:26 -04:00
Bo Anderson
7617ac135f
Merge pull request #19888 from Homebrew/remove-es-kibana-refs
formula_auditor: remove elasticsearch and kibana refs
2025-05-04 04:38:15 +00:00
Sam Ford
85684f43bd
Update eol_data for API changes
The endoflife.date API has been updated, so this modifies the URL in
`SharedAudits.eol_data` to use the up to date URL and modifies the
related logic in `FormulaAuditor.audit_eol` to work with the new
response format. Specifically, there is now an `isEol` boolean value
and the EOL date is found in `eolFrom`.

One wrinkle of the new setup is that 404 responses now return HTML
content even if the request includes an `Accept: application/json`
header. This handles these types of responses by catching
`JSON::ParserError` but ideally we would parse the response headers
and use `Utils::Curl.http_status_ok?` to check for a good response
status before trying to parse the response body as JSON.
2025-05-03 12:26:54 -04:00
Rui Chen
9c2ac58709
formula_auditor: remove elasticsearch and kibana refs
Signed-off-by: Rui Chen <rui@chenrui.dev>
2025-05-03 10:58:13 -04:00
Bevan Kay
285b5074b9
formula_auditor: remove redis version limit 2025-05-02 23:27:52 +10:00
botantony
73bdc8f615
homepage audit: fix for gnu.org and nongnu.org
Signed-off-by: botantony <antonsm21@gmail.com>
Co-authored-by: Bo Anderson <mail@boanderson.me>
2025-03-19 17:43:48 +01:00
Anton
db130b65f3
Use one regex for gnu.org homepage
Co-authored-by: Bo Anderson <mail@boanderson.me>
2025-03-16 01:55:28 +01:00
botantony
da3cb65857
Skip homepage audit for www.gnu.org on GitHub runners
Signed-off-by: botantony <antonsm21@gmail.com>
2025-03-16 00:45:09 +01:00
Michael Cho
a3ab1cba53
formula_auditor: avoid pkg-config dependency in core tap 2024-12-02 21:46:51 -05:00
Michael Cho
347e9460f4
formula_auditor: allow pkg-config alias for pkgconf migration 2024-11-01 12:42:29 -04:00
Bevan Kay
905322dc0d
formula_auditor: audit deprecate/disable reasons 2024-09-30 23:11:44 +10:00
Mike McQuaid
94416e82f0
Add new odeprecated, odisabled, remove disabled code.
Prepare the usual deprecation cycle for Homebrew 4.4.0.
2024-09-24 10:15:34 +01:00
Michael Cho
a618512d7a
formula_auditor: make deprecate license check non-strict in core
Also add some more incompatible licenses. These are all not allowed by
Fedora and have are classified as not OSI and FSF approved on SPDX.
2024-09-04 13:21:40 -04:00
Michael Cho
24a5aed485
formula_auditor: reject more SPDX licenses
Also require licenses on non-disabled formulae
2024-09-02 10:53:25 -04:00
Michael Cho
d3d3f502a7
formula_auditor: tag needs to be a String 2024-08-26 23:07:41 -04:00
Rui Chen
a4dd50f6f1
formula_auditor: ensure tag is not nil when doing online audit
Signed-off-by: Rui Chen <rui@chenrui.dev>
2024-08-24 16:03:12 -04:00
Carlo Cabrera
54f73e5ec8
formula_auditor: fix typechecking failure
Seen at Homebrew/homebrew-core#182065.

https://github.com/Homebrew/homebrew-core/actions/runs/10522724092/job/29156069899?pr=182065#step:3:44
2024-08-23 17:19:02 +08:00
Rui Chen
1270eb37b1
formula_auditor: fix eol check
Co-authored-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2024-08-13 16:36:38 +08:00
Issy Long
45978435e7
rubocop: Use Sorbet/StrictSigil as it's better than comments
- Previously I thought that comments were fine to discourage people from
  wasting their time trying to bump things that used `undef` that Sorbet
  didn't support. But RuboCop is better at this since it'll complain if
  the comments are unnecessary.

- Suggested in https://github.com/Homebrew/brew/pull/18018#issuecomment-2283369501.

- I've gone for a mixture of `rubocop:disable` for the files that can't
  be `typed: strict` (use of undef, required before everything else, etc)
  and `rubocop:todo` for everything else that should be tried to make
  strictly typed. There's no functional difference between the two as
  `rubocop:todo` is `rubocop:disable` with a different name.

- And I entirely disabled the cop for the docs/ directory since
  `typed: strict` isn't going to gain us anything for some Markdown
  linting config files.

- This means that now it's easier to track what needs to be done rather
  than relying on checklists of files in our big Sorbet issue:

```shell
$ git grep 'typed: true # rubocop:todo Sorbet/StrictSigil' | wc -l
    268
```

- And this is confirmed working for new files:

```shell
$ git status
On branch use-rubocop-for-sorbet-strict-sigils
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Library/Homebrew/bad.rb
        Library/Homebrew/good.rb

nothing added to commit but untracked files present (use "git add" to track)

$ brew style
Offenses:

bad.rb:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true.
^^^^^^^^^^^^^

1340 files inspected, 1 offense detected
```
2024-08-12 15:24:27 +01:00
Mike McQuaid
6105728c31
Merge pull request #18004 from Homebrew/more-srb-strict 2024-08-12 14:22:00 +01:00
Issy Long
7047edcbdb
Too much find and replace
Co-authored-by: Bo Anderson <mail@boanderson.me>
2024-08-12 08:29:20 +01:00
Issy Long
621ddc60d1
formula_auditor: repo should never be nil, so use T.must
https://github.com/Homebrew/brew/pull/18004#discussion_r1712680763
2024-08-11 20:32:22 +01:00
Issy Long
0355f07e0d
utils/shared_audits: Bump to Sorbet typed: strict 2024-08-10 16:43:37 +01:00
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