14 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
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
Markus Reiter
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Rylan Polster
f98b8f948c
Add rubocop to remove MacOS references 2023-11-22 21:19:01 -05:00
Markus Reiter
8274920217
Rename OS::Mac::Version to MacOSVersion. 2023-05-09 05:08:38 +02:00
Issy Long
9302090404
Revert "Allow resource blocks to include on_* blocks or conditionals"
This reverts commit b4cd90a3cc47bc2f94e4449fa99b37445b878a5f.

This should never have been merged, given its extraction into PR 15062
had a reasonably long discussion and was decided against in
https://github.com/Homebrew/homebrew-core/pull/126705#discussion_r1149545828,
but I didn't realise I hadn't backed it out of PR 15060 before it was
approved and I merged it.
2023-03-29 00:40:46 +01:00
Issy Long
b4cd90a3cc
Allow resource blocks to include on_* blocks or conditionals
- d2a58a7853 was deemed "unwiedly", but it passes the RuboCop.
- https://github.com/Homebrew/homebrew-core/pull/126705#discussion_r1148558613 is more wieldy, but needed RuboCop tweaks.
2023-03-26 18:25:33 +01:00
Douglas Eichelberger
6c93f6fe91 Enable typing in rubocops 2023-02-16 15:51:20 -08:00
Rylan Polster
d316819f0c
Add tests 2022-12-28 16:10:26 -05:00
Rylan Polster
e08d4f9f31
Check for loose MacOS.version method calls 2022-12-28 16:10:26 -05:00
Rylan Polster
a504d2c1aa
Check for loose Hardware::CPU method calls 2022-12-28 16:10:26 -05:00
Rylan Polster
af99dfba00
Refactor on_system rubocops for use in casks 2022-08-14 17:31:07 -04:00