5014 Commits

Author SHA1 Message Date
Issy Long
935649abaf
Merge pull request #15263 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-rspec-2.20.0
build(deps): bump rubocop-rspec from 2.19.0 to 2.20.0 in /Library/Homebrew
2023-04-22 18:58:03 +01:00
Douglas Eichelberger
ec39fe7bb1
Merge pull request #15283 from dduugg/no-false-sigil
Remove `# typed: false` sigil in tests
2023-04-21 19:44:09 -07:00
Issy Long
4a87c624d7
Fix new RSpec/IndexedLet offenses 2023-04-22 01:02:38 +01:00
Douglas Eichelberger
9075cbae62 brew style --fix 2023-04-21 09:58:50 -07:00
Douglas Eichelberger
ac1e6ded9a git grep -l '# typed: false' | xargs gsed -i 's|# typed: false||g' 2023-04-21 09:57:47 -07:00
Mike McQuaid
f2d064b8ae
Merge pull request #15264 from vitorgalvao/patch-1
Cask audit: check binary signature and notarisation
2023-04-21 07:52:11 +01:00
apainintheneck
a2f9f89d30 cask/audit_spec: fix outdated test
We used the binary artifact as an example of an unsigned artifact
before in this test. Now that we're adding it as a signed artifact
the test has been updated with another example of an unsigned one.
2023-04-20 23:37:05 -07:00
hyuraku
b2156dc125 add casks install to cmd/install 2023-04-19 21:31:22 +09:00
hyuraku
cba118533b remove cask/cmd specs 2023-04-19 21:06:27 +09:00
Mike McQuaid
0b4c0350c2
Merge pull request #15201 from hyuraku/remove_cask/cmd/audit
remove `cask/cmd/audit`
2023-04-19 10:01:06 +01:00
Douglas Eichelberger
df5c5842cc Fix tests 2023-04-17 11:30:12 -07:00
Mike McQuaid
775cddf6d9
Merge pull request #15032 from dduugg/rm-git-extend
Refactor GitRepositoryExtension to avoid monkey-patching
2023-04-17 12:21:11 +01:00
apainintheneck
1322b9cb79 cask: remove os_versions
This was originally used by the API but was replaced months
ago by SimulateSystem. Essentially, it's only current use
was in the #to_h method but is not used internally at all
when creating cask instances from the API JSON.
2023-04-16 13:52:24 -07:00
Douglas Eichelberger
b90897e280 Create git_repo attr 2023-04-15 19:35:13 -07:00
Douglas Eichelberger
1ffb77f821 cleanup 2023-04-15 19:35:13 -07:00
Douglas Eichelberger
8307255ce8 Update call sites 2023-04-15 19:35:13 -07:00
Douglas Eichelberger
429f23dcc6 Create GitRepoPath 2023-04-15 19:35:12 -07:00
Issy Long
e51ad41434
Delete a Cask RuboCop test for an edge case that is not fixed
- This test tests nothing. And the TODO comment is wrong.
- We _could_ fix it, but it's a very edgy edge case which pertains to
  `livecheck` blocks which currently don't have stanza grouping or
  ordering cop support. If we decide in the future to add these, we can
  add this back too (provided I remember).
- Also I think I may have got confused with the stanza grouping vs.
  stanza ordering cops when writing this, rendering this test more
  useless.
2023-04-15 23:09:42 +01:00
Issy Long
4fe3436682
Merge pull request #15211 from issyl0/rubocop-cask-stanza-grouping-in-on-blocks 2023-04-14 21:57:34 +01:00
Issy Long
6de61e4994
Ensure that stanza grouping works for nested stanzas with comments
- Since moving `comments_hash` to `Stanza`, we've been using the wrong
  kind of "comments": the comments for the _stanza_, not the comments
  for the entire Cask.
- Add a test to ensure this actually works. There was previously an
  infinite loop here due to the bad `comments`, visible in a `StanzaOrder`
  cop test, which I speculatively added a failing test for. Turns out
  that supporting nested stanza _ordering_ (vs. just grouping) is a
  whole separate piece of work (there are multiple TODOs there already),
  so I've backed that out and will do that separately.
2023-04-13 15:59:18 +01:00
Ruoyu Zhong
b4dba7a42a
locale: reorder segments to match standard format
Following #14998, reorder the locale segments to `language`, `script`,
`region` to match the standard format. This does not require changes
outside the `Locale` class because `Locale` instances are always
constructed with the `parse` method.

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2023-04-13 11:31:24 +08:00
Ruoyu Zhong
1dd2e0cd7f
test/cask/dsl_spec: fix test for certain locale settings
As I mentioned in #15146, two `Cask::DSL` tests failed on my local
machine, even on `master`. `git bisect` suggested that it was #14998
that introduced those failures. It turned out that the tests here could
fail under certain locale settings, like this one below:

    $ defaults read -g AppleLanguages
    (
        "en-GB",
        "zh-Hans-SG"
    )

This is not actually a regression. With the aforementioned locale
settings, an explicit `let(:languages) { ["en"] }` setting would result
in locales being considered in the following order: `en`, `en-GB`,
`zh-Hans-SG`. For each of them, the `detect` method from `Locale` is
called, with `locale_groups` as `[["zh"], ["en-US"]]`, the list of
locales defined in the test cask.

    def detect(locale_groups)
      locale_groups.find { |locales| locales.any? { |locale| eql?(locale) } } ||
        locale_groups.find { |locales| locales.any? { |locale| include?(locale) } }
    end

Neither of `en` and `en-GB` satisfies the `detect` conditions. (Note
that `Locale.parse("en").include?("en-US")` evaluates to `false`.) But
`zh-Hans-SG` does (because `Locale.parse("zh-Hans-SG").include?("zh")`
is `true`). So, despite having `:languages` set to `en`, the Chinese
locale was still used.

This could be fixed by generalising the test cask's English locale
settings from `en-US` to `en`. This is already the case for most
existing casks:

    $ grep 'language "en.*", default: true' Casks/*.rb
    Casks/battle-net.rb:  language "en", default: true do
    Casks/cave-story.rb:  language "en", default: true do
    Casks/firefox.rb:  language "en", default: true do
    Casks/libreoffice-language-pack.rb:    language "en-GB", default: true do
    Casks/libreoffice-language-pack.rb:    language "en-GB", default: true do
    Casks/openoffice.rb:  language "en", default: true do
    Casks/seamonkey.rb:  language "en-US", default: true do
    Casks/thunderbird.rb:  language "en", default: true do
    Casks/wondershare-edrawmax.rb:  language "en", default: true do

Note that this should make the language stanza tests independent of
locale settings, because `zh` and `en` should be able to capture all the
test cases.

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2023-04-13 11:27:20 +08:00
Issy Long
233db299cd
rubocop/cask: Check for correct stanza grouping within on_* blocks
- A variant of this was an ancient TODO from 2018 (with `if/else` blocks).
- Now in 2023 we have `on_*` blocks within Casks that are very common.
- The most common stanzas present inside `on_*` blocks are `version`,
  `sha256` and `url`. So I feel like it's worth keeping a consistent
  style for these inside and outside `on_*` blocks.
2023-04-12 20:46:20 +01:00
Mike McQuaid
81b6c79d42
Merge pull request #15209 from Bo98/search-no-remote
search: remove remote searching
2023-04-12 13:29:11 +01:00
Bo Anderson
3697825784
search: remove remote searching 2023-04-12 13:16:19 +01:00
Issy Long
14ff148750
Merge pull request #15207 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-1.50.0
build(deps): bump rubocop from 1.49.0 to 1.50.0 in /Library/Homebrew
2023-04-12 12:10:34 +01:00
Markus Reiter
a085fb4ead
Fix code style.
Co-authored-by: Issy Long <issyl0@github.com>
2023-04-12 00:05:47 +02:00
Issy Long
5aa24832df
brew style --fix 2023-04-11 21:12:13 +01:00
Markus Reiter
3275b927b8
Make test not depend on macOS version. 2023-04-11 21:02:10 +02:00
hyuraku
4999639140 - remove cask/cmd/audit
- repair cmd/audit
2023-04-11 23:06:01 +09:00
Issy Long
6536b641f4
Fix ruby_source_path in Ventura systemsettings-caveats fixture JSON
- Cask source paths were added to the API in 844db75361. The main
  `everything.json` file was updated with the new data in that commit,
  but this one was missed causing local test failures.

Before:

```
Cask::Cask#to_h when loaded from cask file returns expected hash
  Failure/Error: expect(JSON.pretty_generate(hash)).to eq(expected_json_after_ventura)
    [...]

    Diff:
    @@ -93,7 +93,7 @@
        "en",
        "eo"
      ],
    -  "ruby_source_path": "Formula/everything.rb",
    +  "ruby_source_path": "Casks/everything.rb",
      "ruby_source_checksum": {
        "sha256": "b2707d1952f02c3fa566b7ad2a707a847a959d36f51d3dee642dbe5deec12f27"
      }

  # ./test/cask/cask_spec.rb:231:in `block (4 levels) in <top (required)>'
  # ./test/support/helper/spec/shared_context/homebrew_cask.rb:52:in `block (2 levels) in <top (required)>'
```
2023-04-11 00:33:11 +01:00
Carlo Cabrera
4e20760a76
Merge pull request #15131 from Homebrew/test-runners
dev-cmd/determine-test-runners: add command to set test runners
2023-04-10 22:42:34 +08:00
hyuraku
ec0d492c09 move cask/cmd/reinstall to cask/reinstall 2023-04-10 22:07:06 +09:00
Markus Reiter
c516870094
Merge pull request #15168 from reitermarkus/api-ruby-source-path
Add source paths to API.
2023-04-08 09:26:27 +02:00
Issy Long
da734a30c2
Say yes to RuboCop's DisplayCopNames; fix test expectations
- Fixing the test expected output was unbelievably tedious.
- There's been debate about this setting being `false` but in
  https://github.com/Homebrew/brew/pull/15136#issuecomment-1500063225
  we decided that it was worth using the default since RuboCop behaviour changed
  so we'd have had to do some horrible things to keep it as `false` -
  https://github.com/Homebrew/brew/pull/15136#issuecomment-1500037278 -
  and multiple maintainers specify the `--display-cop-names` option to
  `brew style` themselves since it's clearer what's gone wrong.
2023-04-07 19:14:07 +01:00
Mike McQuaid
63d8de3600
brew style --fix 2023-04-07 19:10:22 +01:00
Carlo Cabrera
a754b6d343
Merge remote-tracking branch 'origin/master' into test-runners 2023-04-07 22:26:05 +08:00
Carlo Cabrera
5b8ead7bc8
Add more tests
Also, remove most integration tests, because they're slow.
2023-04-07 22:21:46 +08:00
Issy Long
dcc44f164d
Merge pull request #15105 from issyl0/cask-audit-only-failures-default
audit: Make `--display-failures-only` the default for Casks
2023-04-07 14:43:51 +01:00
Markus Reiter
844db75361
Add source paths to API. 2023-04-07 15:20:01 +02:00
Carlo Cabrera
4c33d85172
test_runner_formula: update tests
- also test `#compatible_with?`
- check that we're not simulating a system after `#dependents` is called
2023-04-07 19:31:24 +08:00
Carlo Cabrera
f9cc563e91
test_runner_formula: add tests 2023-04-06 21:03:58 +08:00
Markus Reiter
fbf474a3fd
Add curl_head method. 2023-04-06 10:22:24 +02:00
Issy Long
d636d2de37
Apply suggestions from review comments
- Rename `strictish` to `strict_only` in `add_error` method.
- Return just `errors`, a Set, not `{ errors: errors }`, a Hash,
  from `Auditor.audit`.
2023-04-06 00:10:28 +01:00
Carlo Cabrera
87373ff12a
Move more code out of dev-cmd 2023-04-06 02:13:15 +08:00
Carlo Cabrera
ffcc4cd75f
Merge remote-tracking branch 'origin/master' into test-runners 2023-04-05 23:55:01 +08:00
Mike McQuaid
e12ca4cee6
Merge pull request #15152 from dduugg/version-compare 2023-04-05 11:40:03 +01:00
Mike McQuaid
3404767cd0
Merge pull request #15154 from apainintheneck/cop-to-prevent-bin-in-service-blocks 2023-04-05 11:35:33 +01:00
apainintheneck
70451ea7b1 Add cop to stop bin in service block
The preferred method is opt_bin because that works
with the API and is more portable (works between versions).

Also removed the last example from the docs of `bin/"name"`
from the service block section
2023-04-04 20:00:30 -07:00
Douglas Eichelberger
ba2d18db36 brew style --fix 2023-04-04 18:14:54 -07:00