24 Commits

Author SHA1 Message Date
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
Douglas Eichelberger
c59d9fa833 Prefer numbered block params over proc conversion, cont'd 2024-04-08 09:47:27 -07:00
Douglas Eichelberger
90996e1997 git grep -lE '\(\&[A-Za-z._]+method\(:' | xargs gsed -i -E 's|\(\&([A-Za-z._]+)public_method\(:([a-z?_]+)\)\)| { \1\2(_1) }|g' 2024-03-03 18:55:32 -08:00
Ilya Kulakov
476d97934f sudo: change sudo_user to sudo_as_root. 2023-04-28 11:22:54 -07:00
Ilya Kulakov
d470661b37 sudo: add the sudo_user arg to SystemCommand. 2023-04-28 11:11:53 -07:00
Ilya Kulakov
563387a7b4 sudo: explicitly specify the root user where necessary
With sudoers one may override default sudo user. This mostly works
provided the admin configured the replacement appropriately. However
there are exceptions that absolutely must be run by root such as
/usr/sbin/installer and, under certain circumstances, /bin/launchctl.
2023-04-28 11:11:53 -07:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Markus Reiter
5aa0dbe1f9
Move RMDIR_SH into separate file. 2021-04-02 03:01:08 +02:00
Max Mueggler
23376bad75
Speed up cask pkg uninstallation when there's many directories to delete.
Results in an order of magnitude speedup for uninstalling large packages such as mactex.
2021-04-02 03:01:07 +02:00
Markus Reiter
571208c8ee
Only call find on directories. 2021-04-02 03:01:07 +02:00
Lucendio
aceb021254 Move existence check into helper script
This way, it'll run as `root`, too.
2021-03-17 01:42:56 +01:00
Lucendio
7a22cda8dd
Fix broken rmdir script
Unfortunately, the removal shell script introduced in #10860 does not handle paths very well that dont exist, e.g.

* `find` runs before its `-exec` test, thus throws `find: "${path}": No such file or directory`
* it seem that `/bin/rmdir` is intended to break is certain cases, thus `-f` is not desired.
  so, if `${path}` does not exist, it'll still break, which is most likely not one of those cases.

This change reintroduces a check for existence. This way, it is ensured that there is actually
a directory to be removed when invoking the script.
2021-03-17 00:35:08 +01:00
Markus Reiter
1a4874dc62 Simplify package uninstallation. 2021-03-16 03:00:14 +01:00
Markus Reiter
0b6c31fc70 Add type signatures to Cask::Pkg. 2020-11-19 16:07:50 +01: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
b484ddc842 Document Pkg. 2020-08-26 03:13:59 +02:00
Markus Reiter
7084093d45 Add missing require. 2019-09-13 19:52:43 +02:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
737b84b54b
brew style --fix fixes. 2018-11-02 17:29:23 +00:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Markus Reiter
a84a1c63db Rename Hbc module to Cask. 2018-09-06 09:30:52 +02:00
Mike McQuaid
90b3a13909
cask: move cask/lib/hbc/* to cask/*.
Fix the load path, requires and some filenames accordingly.
2018-09-04 09:56:57 +01:00