294 Commits

Author SHA1 Message Date
Mike McQuaid
efc036f75a
Merge pull request #20613 from Homebrew/dug/typed-system-command
Enable strict typing in SystemCommand
2025-09-08 07:32:58 +00:00
Sam Ford
dce220e518
Cask::Audit: fix key not found: :latest error
`Cask::Audit.audit_livecheck_version` can raise a `key not found:
:latest` error when a hash from livecheck's `latest_version` method
doesn't have a `:latest` value. This error means that livecheck was
unable to identify the latest upstream version but it can only be
understood if the reader knows how this audit is implemented (and it
may also depend on knowing the structure of livecheck's
`latest_version` hash). Without that knowledge, the error doesn't
make it clear which audit is failing and why.

This addresses the issue by using `nil` as the default value for this
`fetch` call and accounting for a `nil` `latest_version` value. This
allows the audit to surface the usual "Version '1.2.3' differs from
'' retrieved by livecheck" failure, which makes it more clear that
livecheck isn't returning a version.
2025-09-03 12:34:06 -04:00
Douglas Eichelberger
fb6c51da07
Enable strict typing in SystemCommand 2025-09-02 10:26:40 -07:00
Bevan Kay
dc28719c8e
cask/audit: fix install of container deps 2025-09-02 16:33:04 +08:00
Rylan Polster
5d13ce9280
Remove unused cask url do code 2025-08-23 15:02:23 -04:00
Mike McQuaid
a1f112f3fe
Move o* output methods to Utils::Output
This reduces the surface area of our `Kernel` monkeypatch and removes
the need to `include Kernel` in a bunch of modules.

While we're here, also move `Kernel#require?` to `Homebrew` and fully
scope the calls to it.
2025-08-20 19:20:19 +01:00
Bevan Kay
ee7b71935e
Merge pull request #20488 from Homebrew/rosetta-audit-fix
cask/audit: correctly filter artifact types in audit
2025-08-18 08:27:49 +00:00
Bevan Kay
97b1683466
cask: replace unsigned deprecation reason with fails_gatekeeper_check 2025-08-18 18:04:57 +10:00
Bevan Kay
c566ba00c7
cask/audit: correctly filter artifact types in test 2025-08-18 18:02:50 +10:00
Mike McQuaid
24057cc9a5
Merge pull request #20485 from SMillerDev/feat/audit/codeberg_audit
feat: audit codeberg repos
2025-08-18 07:50:25 +00:00
Sean Molenaar
b19ad2e796 feat: audit codeberg repos 2025-08-17 17:08:33 +02:00
Eric Knibbe
e021953db4
messages/comments: formatting fixes 2025-08-16 00:54:50 -04:00
copilot-swe-agent[bot]
51565f97ae Remove unnecessary comments that duplicate debug messages
Co-authored-by: MikeMcQuaid <125011+MikeMcQuaid@users.noreply.github.com>
2025-08-14 09:30:23 +00:00
copilot-swe-agent[bot]
d0ad96a9b3
Fix audit_signing to check quarantine availability and attributes
Co-authored-by: bevanjkay <40621599+bevanjkay@users.noreply.github.com>
2025-08-14 19:09:57 +10:00
Bevan Kay
9cb2b65319
cask/dsl/rename: add new rename dsl 2025-08-12 23:24:20 +10:00
Bevan Kay
c83f77b091
cask/audit: add skiplist for signing audit 2025-08-11 22:08:05 +10:00
Bevan Kay
12f6e871c7
cask/audit: apply suggestion from code review
Co-authored-by: Carlo Cabrera <github@carlo.cab>
2025-08-11 15:26:44 +10:00
Bevan Kay
5c06d6f184
cask/audit: apply suggestion from code review
Co-authored-by: Carlo Cabrera <github@carlo.cab>
2025-08-11 15:26:36 +10:00
Bevan Kay
34f659cb64
cask/audit: iterate over artifacts in rosetta/signing audit 2025-08-11 14:12:34 +10:00
Mike McQuaid
e3c3f5a356
Deprecate/disable/remove code for Homebrew 4.6
The next minor release will be Homebrew 4.6.0 so let's do the usual
deprecation/disable/remove code cycle.
2025-07-31 12:13:01 +01:00
Douglas Eichelberger
157992be17
Enable strict typing in Cask::Audit 2025-07-30 12:43:32 -07:00
Bevan Kay
b1a74330d7
cask/audit: skip signing audit without gktool
replace `odebug` with `opoo`

Co-authored-by: Carlo Cabrera <github@carlo.cab>

cask/audit: fix style
2025-07-25 14:40:46 +10:00
Patrick Linnane
a190b1fd42
Merge pull request #20303 from Homebrew/signing-audit
cask/audit: use `gktool` for signing audit
2025-07-24 17:02:05 +00:00
Mike McQuaid
e10d4c43c2
Optionally use DownloadQueue for reinstall, upgrade.
Follow up on `DownloadQueue` for download concurrency on `brew fetch`
and `brew install` to also add support for `brew reinstall` and
`brew upgrade`.

This required a fair bit of refactoring to make this work so I've also
made `install.rb`, `reinstall.rb` and `upgrade.rb` `typed: strict` to
add some extra guardrails from Sorbet here.

Co-authored-by: Carlo Cabrera <github@carlo.cab>
2025-07-24 15:41:03 +01:00
Bevan Kay
b7247de7cd
cask/audit: use gktool for signing audit 2025-07-24 23:02:06 +10:00
Bevan Kay
68be276a11
cask/audit: refine codesign audits 2025-07-24 17:32:00 +10:00
Bevan Kay
cd8c0d88fc
cask/audit: skip signing audit for shell scripts 2025-07-23 12:21:59 +10:00
Bevan Kay
9dc5929ad8
cask/audit: always enable codesign audit 2025-07-22 00:04:54 +10:00
botantony
5450e730ed
Audit no_autobump! reason for new packages
Signed-off-by: botantony <antonsm21@gmail.com>
2025-07-17 17:12:33 +02: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
ab4acd655a
cask/audit: also check binary for minimum OS 2025-06-16 23:39:38 -04:00
Eric Knibbe
689ff373d8
cask/audit: skip caveats check for Intel-only casks 2025-06-11 15:56:07 -04:00
Eric Knibbe
5027a9d2f2
cask/audit: skip audit_rosetta on Intel-only casks & OSes 2025-05-21 10:14:08 -04:00
Bevan Kay
4852829931
cask/audit: install container deps 2025-04-02 16:34:28 +11:00
Sam Ford
1ac70579eb
Cask: skip livecheck https audit for POST requests
We recently added `POST` request support to livecheck but related cask
checks are failing the `livecheck_https_availability` audit because it
calls `validate_url_for_https_availability` which calls
`Utils::Curl.curl_check_http_content` and that checks the URL using a
`GET` request. Adding `POST` request support to all of those methods
will take some work, so this adds a guard to skip the audit if the
`livecheck` block uses `post_form` or `post_json`. This isn't ideal
but it will allow us to add these `livecheck` blocks in the interim
time.

Co-authored-by: Douglas Eichelberger <d@eic.email>
2025-03-06 12:14:42 -05:00
Douglas Eichelberger
fcf18912fe
Inline use of attr_predicate 2025-03-02 21:36:03 -08:00
Douglas Eichelberger
8763fb6d29 Resolve rubocop violations 2025-02-17 18:56:31 -08:00
Sam Ford
01cb74e525
livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.

In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.

With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
2024-12-02 10:13:03 -05:00
Bevan Kay
4a6644650a
cask/audit: audit deprecate/disable reasons 2024-09-30 23:11:44 +10:00
Bo Anderson
0ae1dbeacf
Add typing for Cask#url and fix detected issues 2024-08-23 16:39:23 +01:00
Bo Anderson
f877fc5058
livecheck: remove module_function 2024-08-23 04:57:28 +01:00
Lukas Eipert
915917f4d2 Rosetta audit: Build full executable path
The method only returned the executable name and not the full path,
leading to a swallowed error, because brew gracefully ignores a
failing lipo command.
2024-08-21 13:19:57 +02:00
Lukas Eipert
8814a492aa Use plist main binary for Rosetta audit
Currently `brew audit` only audits the first binary in a cask.
For example the cask `wiso-steuer-2024` contains multiple binaries in
`Contents/MacOS`:
- `btssysteminfo`
- `whilfe`
- `wmain24`

The first binary (some telemetry tool) is not the main binary and not
a universal binary, but the other two are. Given that `wmain24` is
defined as the main binary in the `Contents/Info.plist`, brew probably
should audit that binary rather than just checking the first one.
2024-08-21 10:01:20 +02: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
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
Klaus Hipp
d90c5c55d2
cask/audit: handle cask_min_os is nil 2024-07-16 10:35:47 -04:00