34 Commits

Author SHA1 Message Date
Sam Ford
4a4f7a541a
Cask: Initialize yet more instance variables
I previously added some instance variables in `Cask::DSL` to its
`initialize` method but I missed some last time, so we still see
warnings like `The class Cask::DSL reached 8 shape variations,
instance variables accesses will be slower and memory usage increased.
It is recommended to define instance variables in a consistent order,
for instance by eagerly defining them all in the #initialize method.`

This initializes more instance variables in `Cask` classes to resolve
other situations where this warning may occur. I've been testing this
for a while and haven't see any warnings with these changes but
there's always a chance that there's still more work to be done.
2025-06-13 08:32:56 -04:00
Douglas Eichelberger
fcf18912fe
Inline use of attr_predicate 2025-03-02 21:36:03 -08:00
Kristján Oddsson
3b0794a884 implement fixes and comments for DisableComment rubocop 2025-01-29 09:17:11 +00:00
Douglas Eichelberger
ced4a3a91f Migrate Parlour extensions to Tapioca compilers 2024-10-14 19:50:09 -07: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
caf87c0336
Warn about undocumented non-private APIs. 2024-05-01 11:35:20 +02:00
Markus Reiter
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Markus Reiter
c76170a456
Hide #to_s in docs. 2024-04-26 14:04:55 +02:00
Douglas Eichelberger
f99d39faf9 Vendor CompactBlank cop 2024-01-26 15:03:59 -08:00
Douglas Eichelberger
8efe73b32c Add Object#deep_dup to extend/ 2024-01-22 10:52:43 -08:00
Douglas Eichelberger
ffd761d2e9 Create dedicated Attrable mixin for attr_ methods 2023-12-28 11:46:27 -08:00
Douglas Eichelberger
3abbf4447e Some minor regexp match perf improvements 2023-12-27 13:16:36 -08:00
Bo Anderson
5692c8ecbf
Fix style violations under newer RuboCop 2023-12-14 05:47:12 +00:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
EricFromCanada
b9dab243b5
cask/artifact: fix up some definitions
And expand the list of artifacts that target: works with.
2023-04-14 15:47:33 -04:00
Douglas Eichelberger
29c6baeed1 Enable typing in Cask::Artifact 2023-02-22 09:11:29 -08:00
Luca Ongaro
1fc1c82aed Fix code style and add tests 2023-01-25 00:08:15 +01:00
Luca Ongaro
f5765a73da Avoid mutating the script argument in place
Mutating the argument in place, and in particular deleting the
`:executable` entry, leads to a bug when the same code path leading to
read_script_arguments is invoked twice, like in
https://github.com/Homebrew/homebrew-cask/pull/139749

This commit makes a shallow copy of the argument, so that it can be
safely mutated in the rest of the method.
2023-01-24 23:34:47 +01:00
Rylan Polster
90d22bc7b1
Include dsl key in cask artifact hash 2022-08-25 03:04:48 -04:00
Michael Cho
a0261c4b39 cask uninstall script: allow tilde expansion to '$HOME' 2021-03-28 09:52:49 -07:00
Markus Reiter
da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01: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
Markus Reiter
5426e47579 Document Artifact. 2020-08-26 03:13:59 +02:00
Jonathan Chang
76709d82c5 Fix brew style. 2020-07-13 23:24:14 +10:00
Dario Vladovic
3a21ca8956
Implement mdimporter cask stanza 2020-04-06 15:24:14 +02:00
Markus Reiter
54ab3dd7c4 Install pkg before app. 2019-10-24 15:04:01 +02:00
Tim Masliuchenko
6d1fafae13 Final tweaks 2019-10-24 09:43:59 +03:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
EricFromCanada
15c38a2d8b formatting fixes 2019-04-13 21:29:32 -04:00
Markus Reiter
42d90f8bd9 Use same logic for installer script: and uninstall script:. 2019-03-03 06:21:11 +01:00
Markus Reiter
190ff7558a Use saved cask config for reinstall/upgrade/uninstall. 2019-02-15 10:09:14 +01: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