28781 Commits

Author SHA1 Message Date
Issy Long
2d781d23e0
rubocops: Detect unordered stanzas in non-on_* blocks in formulae
- Previously this components order cop only checked for correct stanza
  order inside `on_*` blocks. This commit extends this cop to also check
  for correct stanza order inside `head` and `resource` blocks. This is
  a positive change since it standardizes the order of stanzas in all of
  the places, making formulae more readable.
- Fixes issue 14017.
2023-03-26 02:31:42 +01:00
Douglas Eichelberger
eaeceda31e Enable typing in Homebrew::Cleanup 2023-03-25 13:16:11 -07:00
Issy Long
0af5825dfb
rubocops/cask: on_#{os_version} is after [version & sha256] group
- This still doesn't pass `brew readall` for Casks, but it gets us a
  little closer since if `url` has a `version` interpolated in it, the
  `version` stanza has to come first.
- See https://github.com/Homebrew/homebrew-cask/pull/143201 for the
  current failures.
2023-03-25 16:02:30 +00:00
Douglas Eichelberger
7720485f40 Enable types in Formula files 2023-03-25 08:50:06 -07:00
Issy Long
48b1279b00
cask/audits: on_#{os_version} stanza order is oldest => newest
- This, ie Mojave first, is more common in real Casks than the
  alternative of newest to oldest ie Ventura first.
- Doing it this way reduces the number of offenses from ~500 to ~200.
2023-03-25 14:52:30 +00:00
Issy Long
d97ed0a7c2
rubocops/cask: Ensure ordering of all the on_#{arch,system} blocks
- Complaining about only `on_arm` and `on_intel` was too restrictive
  since casks can have many `on_system` blocks (`on_#{arch}` and
  `on_#{os}`).
- We're a bit of the way there, anyway. Still doesn't support stanza
  ordering within blocks, but that's for another time (there's a
  separate issue that's been open for a while - 14017).
2023-03-25 14:52:29 +00:00
Issy Long
b484a29006
rubocops/cask: arch stanzas come before & are separate to on_#{arch}
- https://github.com/Homebrew/brew/pull/14976#issuecomment-1469002998.
- This drops the number of offenses currently in the Cask repo down from
  111 to 46.
2023-03-25 14:52:28 +00:00
Issy Long
b6062acdbe
rubocops/cask: Enforce the order of on_#{arch} blocks
- These were previously being manually fixed which is time maintainers
  could have spent fixing more important problems.
- I don't work with Casks much at all, so I was unsure as to what the
  existing "arch" and "on_arch_conditional" parts were, if they're
  deprecated or if things were eventually going to migrate to
  `on_#{arch}` blocks?
2023-03-25 14:52:24 +00:00
Issy Long
d43ba7c306
Merge pull request #15013 from issyl0/rubocops-cask-no-overrides 2023-03-25 13:44:19 +00:00
Markus Reiter
5e52d415a9
Allow fetching for different arch. 2023-03-25 11:56:09 +01:00
Nanda H Krishna
c271a9ae75
Merge pull request #15054 from Homebrew/dependabot/bundler/Library/Homebrew/rspec-sorbet-1.9.2
build(deps): bump rspec-sorbet from 1.9.1 to 1.9.2 in /Library/Homebrew
2023-03-24 15:35:23 -04:00
BrewTestBot
70b55ffbb5
Update RBI files for connection_pool.
Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow.
2023-03-24 19:18:25 +00:00
BrewTestBot
5bd839c132
Update RBI files for rspec-sorbet.
Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow.
2023-03-24 19:16:45 +00:00
BrewTestBot
0c583a0b7d
brew vendor-gems: commit updates. 2023-03-24 19:12:37 +00:00
BrewTestBot
95bd2c002b
brew vendor-gems: commit updates. 2023-03-24 19:11:17 +00:00
dependabot[bot]
1ed5f828e4
build(deps): bump connection_pool in /Library/Homebrew
Bumps [connection_pool](https://github.com/mperham/connection_pool) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/mperham/connection_pool/releases)
- [Changelog](https://github.com/mperham/connection_pool/blob/main/Changes.md)
- [Commits](https://github.com/mperham/connection_pool/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: connection_pool
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-24 19:08:48 +00:00
dependabot[bot]
f5909de3bd
build(deps): bump rspec-sorbet from 1.9.1 to 1.9.2 in /Library/Homebrew
Bumps [rspec-sorbet](https://github.com/samuelgiles/rspec-sorbet) from 1.9.1 to 1.9.2.
- [Release notes](https://github.com/samuelgiles/rspec-sorbet/releases)
- [Changelog](https://github.com/samuelgiles/rspec-sorbet/blob/master/CHANGELOG.md)
- [Commits](https://github.com/samuelgiles/rspec-sorbet/commits/v1.9.2)

---
updated-dependencies:
- dependency-name: rspec-sorbet
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-24 19:07:41 +00:00
Mike McQuaid
a0eb5ebec7
formulary: require service.
This is used in this file.
2023-03-24 09:23:09 +00:00
Mike McQuaid
fad8deda56
Merge pull request #15046 from issyl0/rubocop-method-parameter-pr
rubocop: Remove the final `Naming/MethodParameterName` exceptions: `pr`
2023-03-24 08:51:49 +00:00
Kevin
86c518e2d7
Merge pull request #15007 from apainintheneck/add-service-block-to-formula-api
Add service block to formula api
2023-03-23 17:30:04 -07:00
Issy Long
61dc026fcc
rubocop: Remove the final Naming/MethodParameterName exceptions: pr
- Core RuboCop didn't want this shortening upstreamed, but that's OK!
2023-03-24 00:29:42 +00:00
Issy Long
e4156909d4
Only take overrideable stanzas into account
- This skips over stanza names that are not overrideable in `on_*`
  blocks, with the positive side effect that `on_*` blocks themselves
  aren't in the list so we can get rid of another conditional.
- Stanzas overrideable in blocks are defined in `Cask::DSL` by each of
  the methods calling `set_unique_stanza`.
2023-03-23 18:59:29 +00:00
Mike McQuaid
253dca568c
Revert "move cask/cmd/reinstall" 2023-03-23 17:06:42 +00:00
Mike McQuaid
8f9caa3427
Merge pull request #15040 from hyuraku/move_cask/cmd/reinstall
move `cask/cmd/reinstall`
2023-03-23 16:31:01 +00:00
hyuraku
6a5ed3497e repair the options 2023-03-24 00:42:10 +09:00
Mike McQuaid
95a8c3f638
Add brew install --skip-post-install
Will be needed by `brew test-bot`.
2023-03-23 15:22:27 +00:00
hyuraku
ca3520e379 repair Cask#Reinstall::reinstall_casks 2023-03-23 23:39:58 +09:00
Issy Long
d4d413db62
String interpolations in regexps should also be allowed
- This came up in Cask `simply-fortran`:

```
Scanning /opt/homebrew/Library/Taps/homebrew/homebrew-cask/Casks/simply-fortran.rb
send_node: s(:send, nil, :arch), send_node.parent: s(:begin,
  s(:send, nil, :arch)), send_node.parent.parent: (regexp
  (str "href=.*?simplyfortran[._-]v?(\\d+(?:\\.\\d+)+)")
  (begin
    (send nil :arch))
  (str "\\.dmg")
  (regopt :i))
Casks/simply-fortran.rb:2:3: C: Cask/NoOverrides: Do not use a top-level arch stanza as the default. Add it to an on_{system} block instead.
Use :or_older or :or_newer to specify a range of macOS versions.

  arch arm: "-arm64", intel: "-x86_64"
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected
```
2023-03-23 13:55:00 +00:00
hyuraku
75c867e296 move cask/cmd/reinstall_spec to cask/reinstall_spec 2023-03-23 22:50:28 +09:00
hyuraku
31e49d96af move cask/cmd/reinstall to cask/reinstall 2023-03-23 22:50:03 +09:00
Issy Long
c1de3dfb90
Fix string interpolation detection again to be even broader
- My approach wasn't quite good enough. Replace it with what RuboCop
  itself does to detect all forms of string interpolation.
2023-03-23 13:17:09 +00:00
Mike McQuaid
e75b983686
cmd/update-report: fix ordering.
New formulae/casks were shown as removed and vice versa.

Fixes #15036
2023-03-23 08:48:48 +00:00
apainintheneck
6ccf21c2c9 Merge branch 'master' into add-service-block-to-formula-api 2023-03-22 20:06:32 -07:00
apainintheneck
801ee5e474 Address feedback
- style nits
- better comments for tests that are not idempotent
- moved appdir placeholder constant to global.rb
2023-03-22 19:43:49 -07:00
Issy Long
0889593e2a
Another failing test for a real Cask, version.csv.first interpolated 2023-03-23 00:02:17 +00:00
Issy Long
e66226aefc
Fix skipping of livecheck block contents in on_* blocks
- This passes the previously failing test for `on_*` blocks with
  `livecheck` blocks with multiple stanzas inside them (eg `url` and
  `strategy`) that weren't being correctly skipped because we weren't
  detecting high enough up the ancestry.
2023-03-22 23:17:32 +00:00
Issy Long
991e5f2f9c
Failing test for mishandling contents of livecheck blocks in on_*
- The Cask `little-snitch4` in `Homebrew/homebrew-cask-versions` was
  failing and it took me a while to figure out _how_. Add a test for
  easier further debugging (and to prevent breakage once the bug is
  fixed).

```
❯ brew tests --only=rubocops/cask/no_overrides
Randomized with seed 29917
1 process for 1 spec, ~ 1 spec per process
F

Failures:

  1) RuboCop::Cop::Cask::NoOverrides when there are livecheck blocks within `on_*` blocks, ignore their contents does not report any offenses
     Failure/Error: DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure }
       expected `[#<RuboCop::Cop::Offense:0x000000012de636c8 @severity=#<RuboCop::Cop::Severity:0x000000012de636a0 @name=:convention>, @location=#<Parser::Source::Range (string) 244...273>, @message="Do not use a top-level `url` stanza as the default. Add it to an `on_{system}` block instead.\nUse `:or_older` or `:or_newer` to specify a range of macOS versions.\n", @cop_name="Cask/NoOverrides", @status=:unsupported, @corrector=nil>].empty?` to be truthy, got false
     Shared Example Group: "does not report any offenses" called from ./test/rubocops/cask/no_overrides_spec.rb:77
     # ./test/rubocops/cask/shared_examples/cask_cop.rb:24:in `expect_no_offenses'
     # ./test/rubocops/cask/shared_examples/cask_cop.rb:7:in `block (2 levels) in <module:CaskCop>'

Took 2 seconds
Tests Failed
```
2023-03-22 21:41:28 +00:00
Issy Long
b82c5f1d36
Fix detection of string interpolation
- This was almost there but not quite and the lack of tests lulled me into a false sense of security.
2023-03-22 19:13:47 +00:00
Douglas Eichelberger
65d858da12
Merge pull request #15025 from dduugg/enable-unpack-strategy-types
Enable UnpackStrategy types
2023-03-22 12:06:12 -07:00
Douglas Eichelberger
9ba677f6d4
Update Library/Homebrew/extend/pathname.rb
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-03-22 10:04:53 -07:00
Mike McQuaid
7ad3306e68
Merge pull request #15003 from issyl0/audit-for-keg_only-HOMEBREW_PREFIX
formula_auditor: Having `HOMEBREW_PREFIX` in `keg_only` reasons is bad
2023-03-22 14:13:33 +00:00
Issy Long
10b1af8b29
formula_auditor: Appease RuboCop with another &. 2023-03-22 13:54:43 +00:00
Issy Long
21f38ca3af
formula_auditor: Correct safe navigation positioning
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-03-22 13:43:33 +00:00
Mike McQuaid
dea9da6139
Merge pull request #15033 from dduugg/enable-types
Enable more typing
2023-03-22 13:30:08 +00:00
Adrian Ho
ff42a4e3b7 update*: check shim output
The shims _Should Not Fail_, but [when bugs happen](https://github.com/orgs/Homebrew/discussions/4331), they just cause confusing errors.
2023-03-22 18:03:47 +08:00
apainintheneck
e83a2562bb Update service and formulary specs 2023-03-22 00:01:58 -07:00
apainintheneck
bc85857e13 service: make serialization non-recursive
This helps with type annotations and makes it easier to
reason about the code as well.
2023-03-21 23:20:49 -07:00
apainintheneck
38146893c3 api_hashable: Make API path subs generic
This turns the ability to replace common paths with placeholders
into a mixin that can be used with both Casks and Formulae.

The idea here is to make formula hash generation more consistent.
2023-03-21 23:20:42 -07:00
Douglas Eichelberger
adfd12cfd0 Enable more typing 2023-03-21 21:42:51 -07:00
Douglas Eichelberger
91afda651a Update Pathname#magic_number 2023-03-21 17:37:48 -07:00