44 Commits

Author SHA1 Message Date
Eric Knibbe
cd6777fc73
audits: quote and reword problem description text 2025-05-30 23:49:26 -04:00
Issy Long
0fc1eb534b
More Sorbet typed: strict RuboCops
- Some of these I bumped to `typed: strict`, some of them I added
  intermediary type signatures to some of the methods to make my life
  easier in the (near, hopefully) future.
- Turns out that RuboCop node matchers that end in `?`
  can return `nil` if they don't match anything, not `false`.
2025-02-08 23:38:12 +00:00
Michael Cho
8e3f2cea06
rubocops/uses_from_macos: allow using Sequoia jq 2024-11-26 11:05:05 -05:00
Michael Cho
fcf05d1b21
rubocops/uses_from_macos: remove gnu-getopt and rpcgen
Also add `bc-gh` which is the version of bc provided by Ventura and
newer macOS. Other `bc` (GNU bc) was provided until Monterey
2024-09-06 09:14:22 -04: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
Sam Ford
17b0493e18
Use struct for #audit_formula args
Adding type signatures to `#audit_formula` methods in formula cops
would lead to verbose, repetitive signatures across the existing ~63
instances. This reworks `#audit_formula` to use a `T::Struct` for its
arguments, which allows us to use a one-line signature for these
methods.
2024-07-08 12:22:25 -04:00
Michael Cho
2f3f017a6e
rubocops/uses_from_macos: audit when depends_on :linux 2023-12-30 18:30:05 -05:00
Francois-Xavier Coudert
639f59473d Do not insist on using macOS texinfo 2023-07-18 08:57:11 +02:00
Douglas Eichelberger
387d2f859f Use exclude_from_registry instead 2023-02-20 18:14:47 -08:00
Douglas Eichelberger
d9db5e8825 Refactor FormulaCop as a mixin 2023-02-20 18:14:47 -08:00
razamatan
e7f723e543 uses_from_macos: add mandoc to allowed list
- see https://github.com/Homebrew/homebrew-core/pull/115411
2022-11-10 21:56:23 -08:00
Bo Anderson
6ede5d2dd5
rubocops: handle empty formula body in various cops 2022-11-05 04:40:16 +00:00
fn ⌃ ⌥
49867da232 rubocops: allow uses_from_macos "less" 2022-07-12 13:31:51 -07:00
danielnachun
ed1324c9ca
add pax to allowlist 2022-07-05 09:57:10 -07:00
Mike McQuaid
2d5eab2e1c
brew style --fix 2022-06-30 08:56:21 +01:00
Bo Anderson
1c73e25627
uses_from_macos: allow libxcrypt 2022-04-27 15:08:43 +01:00
Bo Anderson
212a9efaf5
rubocops/uses_from_macos: allow keg only berkeley-db 2022-03-30 14:24:10 +01:00
Bo Anderson
9b100cf1cc
rubocops/uses_from_macos: remove gcore
gcore has been removed from homebrew-core.
2021-12-13 22:27:06 +00:00
Mike McQuaid
6992ad0caa
rubocops/uses_from_macos: remove versioned aliases.
It makes more sense to use the unversioned formulae with `uses_from_macos`
because macOS isn't shipping multiple versions of this.

If you wish to e.g. pin to a specific version you can do that by specifying the
dependency directly in an `os_linux` block.
2021-09-14 11:01:42 +01:00
Mike McQuaid
365e554f67
Revert "rubocops: allow uses_from_macos openssl@3" 2021-09-09 09:16:59 +01:00
Jonathan Chang
b463ad0124
rubocops: allow uses_from_macos openssl@3 2021-09-07 11:20:55 -07:00
Alexander Bayandin
909a7aea9e
rubocops: allow uses_from_macos "git" 2021-06-08 13:03:25 +01:00
Carlo Cabrera
0214196b4f
rubocops/uses_from_macos: remove openlibm
This is not provided by macOS. See

    https://github.com/Homebrew/homebrew-core/pull/76528
2021-05-03 20:40:39 +01:00
Shaun Jackman
0bba3bc6f6 rubocops: Permit uses_from_macos "cyrus-sasl"
macOS provides /usr/lib/libsasl2.dylib
2021-03-10 08:16:24 -08:00
danielnachun
24af65302d add pcsc-lite to uses_from_macos 2021-03-08 23:40:29 -08:00
Michka Popoff
5329972955 uses_from_macos: add netcat 2021-01-07 22:27:15 +01:00
Michka Popoff
e0b6f4d816 gperf: add to uses_from_macos allowlist 2021-01-02 23:21:14 +01:00
Rylan Polster
01cf98e526 Remove style exceptions for ProvidedByMacos and UsesFromMacos 2020-12-03 14:30:34 -05:00
Rylan Polster
78060765b2 rubcops/provided_by_macos: fix wording for core formulae 2020-12-02 21:19:17 -05:00
Rylan Polster
f450bfbf5e style: migrate some lists back to Homebrew/brew 2020-12-02 20:56:07 -05:00
Rylan Polster
44bfbd0112 Migrate uses_from_macos style lists 2020-11-30 18:18:50 -05:00
EricFromCanada
3768b7a6e9 apidoc: update comment wording, punctuation, formatting 2020-11-06 00:21:02 -05:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Markus Reiter
b4e8bfe716 Fix RuboCop offenses. 2020-10-09 11:17:55 +02:00
Michka Popoff
9c3cc31cb4 uses_from_macos: move cpio to shadowed by macos list 2020-07-08 22:59:41 +02:00
Michka Popoff
5b82005829 uses_from_macos: allow cpio
as it is provided by macOS
2020-07-06 23:31:39 +02:00
Michka Popoff
7b25b99995 uses_from_macos: allow ed 2020-06-15 23:50:54 +02:00
Shaun Jackman
ffb405019d uses_from_macos: Add gzip rsync to the white list
/usr/bin/gzip and /usr/bin/rsync are provided by macOS.
2020-04-20 11:52:58 -07:00
Mike McQuaid
cddc67b451
rubocops/uses_from_macos: update list.
Also, provide details on how to update this in future and split it into
two.

Fixes #7396
2020-04-20 10:36:42 +01:00
Jonathan Chang
d6cf14fd1e audit: add libiconv to uses_from_macos whitelist
This lives at /usr/lib/libiconv.dylib
2020-04-18 21:39:39 +10:00
Mike McQuaid
45908d8ff2
uses_from_macos: update openssl in whitelist. 2020-04-12 14:17:05 +01:00
Alexander Bayandin
1b18a01779
Library/Homebrew/rubocops/uses_from_macos: add ssh-copy-id 2020-04-07 15:04:23 +01:00
Mike McQuaid
4dd70048d6
rubocops/uses_from_macos: tweak whitelist. 2020-04-07 12:16:17 +01:00
Issy Long
857393ccfb
Audit correct uses_from_macos usage with RuboCop
- This builds on @jonchang's work that started in #6265.
- We now use `uses_from_macos` to declare dependencies that are implicit
  on macOS because they ship with macOS, but they're needed on Linux. We
  have to be sure that the dependencies people specify as
  `uses_from_macos` are actually shipped with macOS. So, we maintain a
  safelist of those dependencies and check against it.
- Also add more legitimate `uses_from_macos` dependencies to the list.
- This is runnable with `brew audit --only-cops=FormulaAudit/UsesFromMacos`.
- It produces different number of failures on macOS vs. Linux, because
  apparently we've not synced Homebrew/linuxbrew-core upstream thoroughly
  enough yet.
- Originally this was designed as a `--strict` audit, but we flipped it
  to be a normal audit because - to quote Mike - this is "sufficiently
  robust" now.
2020-04-06 13:42:27 +01:00