4948 Commits

Author SHA1 Message Date
Carlo Cabrera
5194e5c65e
Check for --eval-all before using HOMEBREW_EVAL_ALL 2023-04-05 00:03:58 +08:00
Carlo Cabrera
506f6c81a7
Support --dependents flag on macOS 2023-04-04 16:20:37 +08:00
Carlo Cabrera
c125079d0f
determine-test-runners: allow usage on macOS without --dependents 2023-04-04 13:54:35 +08:00
Carlo Cabrera
3d03d243a4
determine-test-runners: test failure modes (again) 2023-04-04 13:25:44 +08:00
Carlo Cabrera
e191dbfb9e
Improve style 2023-04-04 13:20:03 +08:00
Carlo Cabrera
7ff2382d74
determine-test-runners: fix parallel tests
Since these tests run in parallel, we want to minimise our reliance on
environment variables. Also, we need to make sure that different
examples write to different paths.
2023-04-04 12:16:54 +08:00
Carlo Cabrera
4cb50a38c7
Improve versioned macOS test 2023-04-04 02:42:14 +08:00
Carlo Cabrera
839b7d44cc
determine-test-runners: test failure modes 2023-04-04 02:30:13 +08:00
Carlo Cabrera
3d7d4c60f7
determine-test-runners_spec: hardcode fewer things 2023-04-04 02:13:35 +08:00
Carlo Cabrera
3dc66fae9f
determine-test-runners: add non-trivial tests 2023-04-04 01:46:33 +08:00
Carlo Cabrera
140e751ec6
Fix brew style 2023-04-04 01:12:05 +08:00
Carlo Cabrera
d5dc9ee5e0
determine-test-runners: test --dependents 2023-04-04 01:02:47 +08:00
Carlo Cabrera
4dc370ca24
Add some more tests 2023-04-04 00:45:54 +08:00
Carlo Cabrera
ae63b23472
determine-test-runners: add a test
I'll add more substantial tests shortly, but let's start with this one.
2023-04-03 22:42:00 +08:00
Markus Reiter
bdd6523ce8
Deprecate appcast. 2023-03-30 03:29:06 +02:00
Issy Long
039a434936
Merge pull request #14976 from issyl0/rubocop-cask-on-arch-block-order
rubocops/cask: Enforce the order of `on_#{arch}` blocks
2023-03-29 12:10:37 +01:00
Issy Long
222ef50063
Merge pull request #15060 from issyl0/formula-block-component-order 2023-03-28 22:09:15 +01:00
Mike McQuaid
91251d5739
Merge pull request #15059 from dduugg/type-cleanup
Enable typing in Homebrew::Cleanup
2023-03-27 17:45:01 +01:00
Douglas Eichelberger
a7b80532bf Code review changes 2023-03-27 09:28:27 -07:00
Markus Reiter
3da305fa80
Add keyboard_layout stanza. 2023-03-26 08:14:24 +02:00
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
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
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
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
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
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
apainintheneck
e83a2562bb Update service and formulary specs 2023-03-22 00:01:58 -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
Issy Long
bc796a3120
Add a failing test for the arch inside url inside on_* weirdness
- So that I remember what's up with this after some sleep.
2023-03-22 00:23:38 +00:00
Issy Long
8091e603df
rubocops/cask: Ignore livecheck blocks within on_* blocks
- The Cask `sip`, to give a random example, was failing this RuboCop
  because it has a `livecheck` block within an `on_*` block and the
  livecheck block and the top-level Cask both have `url` stanzas. This
  is a legitimate use of `livecheck` blocks because the cask software
  download URL and the livecheck version check URL are not the same
  thing, so let's skip over `livecheck` blocks and their contents.
2023-03-21 23:49:54 +00:00
Issy Long
ebdd408f99
test/fixtures: Put the on_system blocks in oldest => newest order 2023-03-21 22:51:23 +00:00
Issy Long
478ba9b604
rubocops/cask: Add another test case to check I've done it right?
- I wrote this because I was concerned that I'd done something wrong
  since `brew style --only=Cask/NoOverrides` in
  `$(brew --repo homebrew/cask)` didn't report any offenses. Turns out
  I'd just missed the `.` off the end of the command to target the
  current directory! But, the cost of writing the test is sunk now,
  and more tests can't hurt?
2023-03-21 22:51:22 +00:00
Issy Long
1e18e88c68
test/fixtures: Fix style for the new Cask/NoOverrides cop 2023-03-21 22:51:21 +00:00
Issy Long
35cd764261
rubocops/cask: Tweak offense message to read better 2023-03-21 22:51:20 +00:00
Issy Long
ff2fad6bcf
rubocops/cask: Don't force on_* blocks for all stanzas
- In the event that there's only one common stanza within the `on_*`
  blocks (eg, `url`) with a generic `version` that doesn't change per-OS,
  let's not force adding `version` to each `on_*` block as well.
2023-03-21 22:51:18 +00:00
Issy Long
dec1309140
rubocops/cask: Casks with zero on_* blocks are still valid 2023-03-21 22:51:17 +00:00
Issy Long
9cc046bc60
rubocops/cask: Enforce the use of on_{system} blocks
- As discussed in
  https://github.com/Homebrew/brew/pull/14976#issuecomment-1474544569
  and further comments, this is needed because in order to enforce the
  order of `on_{arch,system}` blocks we need to have everything
  consistently within one of those blocks.
- We previously allowed overrides where the top-level `version` stanza
  would be the default, unless on an OS that had an `on_system` block
  with a `version` specified. But this breaks down when we try to order
  the `on_system` blocks because if a `url` at the top-level has a
  `version` interpolated in it, then the `version` stanza needs to be
  above the `url` stanza. But it could be that `version` is OS-specific.
- Let's stop allowing overrides and require that everything be in an
  `on_system` block. This will make it easier to enforce the order of
  `on_system` blocks in a future PR (14976).
2023-03-21 22:51:12 +00:00
Mike McQuaid
8bf8393b89
Merge pull request #15021 from MikeMcQuaid/influxdb_cardinality
analytics: improve InfluxDB cardinality
2023-03-20 15:54:17 +00:00
Mike McQuaid
4d8445e29d
analytics: improve InfluxDB cardinality
- roll InfluxDB token (we need to report to a new bucket to fix implicit schema)
- adjust various parameters
- separate default tags and fields
- send more fields and fewer tags (tags should have low cardinality)
- use `--data-binary` to match InfluxDB documentation
- document second precision for greater InfluxDB performance
- pass through tap name, formula/cask name, options separately
- pass `devcmdrun` as a tag
- avoid sending very high-cardinality `OS_VERSION` values
2023-03-20 15:26:47 +00:00
Dustin Rodrigues
b776fb32de
change includecount to include_count for readability 2023-03-20 07:23:17 -04:00
Dustin Rodrigues
b68c955946
utils: add includecount argument to pluralize util 2023-03-19 23:35:40 -04:00