Skip to content

Commit

Permalink
Say yes to RuboCop's DisplayCopNames; fix test expectations
Browse files Browse the repository at this point in the history
- Fixing the test expected output was unbelievably tedious.
- There's been debate about this setting being `false` but in
  #15136 (comment)
  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` -
  #15136 (comment) -
  and multiple maintainers specify the `--display-cop-names` option to
  `brew style` themselves since it's clearer what's gone wrong.
  • Loading branch information
issyl0 committed Apr 7, 2023
1 parent 63d8de3 commit da734a3
Show file tree
Hide file tree
Showing 67 changed files with 457 additions and 435 deletions.
1 change: 0 additions & 1 deletion Library/.rubocop.yml
Expand Up @@ -13,7 +13,6 @@ inherit_mode:

AllCops:
TargetRubyVersion: 2.6
DisplayCopNames: false
ActiveSupportExtensionsEnabled: true
NewCops: enable
Include:
Expand Down
Expand Up @@ -75,9 +75,9 @@ class Foo < Formula
rebuild 4
sha256 arm64_big_sur: "aaaaaaaa"
sha256 big_sur: "faceb00c"
^^^^^^^^^^ Align bottle digests
^^^^^^^^^^ FormulaAudit/BottleDigestIndentation: Align bottle digests
sha256 catalina: "deadbeef"
^^^^^^^^^^ Align bottle digests
^^^^^^^^^^ FormulaAudit/BottleDigestIndentation: Align bottle digests
end
end
RUBY
Expand Down Expand Up @@ -105,9 +105,9 @@ class Foo < Formula
rebuild 4
sha256 cellar: :any, arm64_big_sur: "aaaaaaaa"
sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c"
^^^^^^^^^^ Align bottle digests
^^^^^^^^^^ FormulaAudit/BottleDigestIndentation: Align bottle digests
sha256 catalina: "deadbeef"
^^^^^^^^^^ Align bottle digests
^^^^^^^^^^ FormulaAudit/BottleDigestIndentation: Align bottle digests
end
end
RUBY
Expand Down
22 changes: 11 additions & 11 deletions Library/Homebrew/test/rubocops/bottle/bottle_format_spec.rb
Expand Up @@ -23,7 +23,7 @@ class Foo < Formula
bottle do
sha256 "faceb00c" => :big_sur
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
end
end
RUBY
Expand All @@ -45,9 +45,9 @@ class Foo < Formula
bottle do
rebuild 4
sha256 "faceb00c" => :big_sur
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
sha256 "deadbeef" => :catalina
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
end
end
RUBY
Expand All @@ -72,12 +72,12 @@ class Foo < Formula
bottle do
cellar :any
^^^^^^^^^^^ `cellar` should be a parameter to `sha256`
^^^^^^^^^^^ FormulaAudit/BottleFormat: `cellar` should be a parameter to `sha256`
rebuild 4
sha256 "faceb00c" => :big_sur
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
sha256 "deadbeef" => :catalina
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
end
end
RUBY
Expand All @@ -100,9 +100,9 @@ class Foo < Formula
bottle do
cellar :any
^^^^^^^^^^^ `cellar` should be a parameter to `sha256`
^^^^^^^^^^^ FormulaAudit/BottleFormat: `cellar` should be a parameter to `sha256`
sha256 "faceb00c" => :big_sur
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
end
end
RUBY
Expand All @@ -123,12 +123,12 @@ class Foo < Formula
bottle do
cellar "/usr/local/Cellar"
^^^^^^^^^^^^^^^^^^^^^^^^^^ `cellar` should be a parameter to `sha256`
^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `cellar` should be a parameter to `sha256`
rebuild 4
sha256 "faceb00c" => :big_sur
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
sha256 "deadbeef" => :catalina
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
end
end
RUBY
Expand Down
8 changes: 4 additions & 4 deletions Library/Homebrew/test/rubocops/bottle/bottle_order_spec.rb
Expand Up @@ -122,7 +122,7 @@ class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles
^^^^^^^^^ FormulaAudit/BottleOrder: ARM bottles should be listed before Intel bottles
rebuild 4
sha256 big_sur: "faceb00c"
sha256 catalina: "deadbeef"
Expand Down Expand Up @@ -151,7 +151,7 @@ class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles
^^^^^^^^^ FormulaAudit/BottleOrder: ARM bottles should be listed before Intel bottles
rebuild 4
sha256 big_sur: "faceb00c"
sha256 arm64_catalina: "aaaaaaaa"
Expand Down Expand Up @@ -182,7 +182,7 @@ class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles
^^^^^^^^^ FormulaAudit/BottleOrder: ARM bottles should be listed before Intel bottles
rebuild 4
sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c"
sha256 catalina: "deadbeef"
Expand Down Expand Up @@ -213,7 +213,7 @@ class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles
^^^^^^^^^ FormulaAudit/BottleOrder: ARM bottles should be listed before Intel bottles
cellar :any
sha256 "faceb00c" => :big_sur
sha256 "aaaaaaaa" => :arm64_big_sur
Expand Down
Expand Up @@ -74,10 +74,10 @@ class Foo < Formula
bottle do
rebuild 4
sha256 cellar: :any, arm64_big_sur: "aaaaaaaa"
^^^^^^^^^^^^^^^^^^^^^^^^^ Align bottle tags
^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleTagIndentation: Align bottle tags
sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c"
sha256 catalina: "deadbeef"
^^^^^^^^^^^^^^^^^^^^ Align bottle tags
^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleTagIndentation: Align bottle tags
end
end
RUBY
Expand Down
24 changes: 12 additions & 12 deletions Library/Homebrew/test/rubocops/cask/desc_spec.rb
Expand Up @@ -17,14 +17,14 @@
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo' do
desc 'A bar program'
^ Description shouldn't start with an article.
^ Cask/Desc: Description shouldn't start with an article.
end
RUBY

expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo' do
desc 'The bar program'
^^^ Description shouldn't start with an article.
^^^ Cask/Desc: Description shouldn't start with an article.
end
RUBY

Expand All @@ -39,35 +39,35 @@
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foobar' do
desc 'Foo bar program'
^^^^^^^ Description shouldn't start with the cask name.
^^^^^^^ Cask/Desc: Description shouldn't start with the cask name.
end
RUBY

expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foobar' do
desc 'Foo-Bar program'
^^^^^^^ Description shouldn't start with the cask name.
^^^^^^^ Cask/Desc: Description shouldn't start with the cask name.
end
RUBY

expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do
desc 'Foo bar program'
^^^^^^^ Description shouldn't start with the cask name.
^^^^^^^ Cask/Desc: Description shouldn't start with the cask name.
end
RUBY

expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do
desc 'Foo-Bar program'
^^^^^^^ Description shouldn't start with the cask name.
^^^^^^^ Cask/Desc: Description shouldn't start with the cask name.
end
RUBY

expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do
desc 'Foo Bar'
^^^^^^^ Description shouldn't start with the cask name.
^^^^^^^ Cask/Desc: Description shouldn't start with the cask name.
end
RUBY
end
Expand All @@ -76,28 +76,28 @@
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do
desc 'macOS status bar monitor'
^^^^^ Description shouldn't contain the platform.
^^^^^ Cask/Desc: Description shouldn't contain the platform.
end
RUBY

expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do
desc 'Toggles dark mode on Mac OS Mojave'
^^^^^^ Description shouldn't contain the platform.
^^^^^^ Cask/Desc: Description shouldn't contain the platform.
end
RUBY

expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do
desc 'Better input source switcher for OS X'
^^^^ Description shouldn't contain the platform.
^^^^ Cask/Desc: Description shouldn't contain the platform.
end
RUBY

expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do
desc 'Media Manager for Mac OS X'
^^^^^^^^ Description shouldn't contain the platform.
^^^^^^^^ Cask/Desc: Description shouldn't contain the platform.
end
RUBY

Expand All @@ -110,7 +110,7 @@
expect_offense <<~RUBY
cask 'foo' do
desc 'Application for managing macOS virtual machines on macOS'
^^^^^ Description shouldn't contain the platform.
^^^^^ Cask/Desc: Description shouldn't contain the platform.
end
RUBY

Expand Down
Expand Up @@ -50,8 +50,7 @@
end
let(:expected_offenses) do
[{
message: "'https://foo.brew.sh' must have a slash " \
"after the domain.",
message: "Cask/HomepageUrlTrailingSlash: 'https://foo.brew.sh' must have a slash after the domain.",
severity: :convention,
line: 2,
column: 11,
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/test/rubocops/cask/no_dsl_version_spec.rb
Expand Up @@ -20,7 +20,7 @@
let(:correct_source) { "cask 'foo' do; end" }
let(:expected_offenses) do
[{
message: "Use `cask 'foo'` instead of `cask :v1 => 'foo'`",
message: "Cask/NoDslVersion: Use `cask 'foo'` instead of `cask :v1 => 'foo'`",
severity: :convention,
line: 1,
column: 0,
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/test/rubocops/cask/no_overrides_spec.rb
Expand Up @@ -201,7 +201,7 @@
let(:expected_offenses) do
[{
message: <<~EOS,
Do not use a top-level `sha256` stanza as the default. Add it to an `on_{system}` block instead.
Cask/NoOverrides: Do not use a top-level `sha256` 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.
EOS
severity: :convention,
Expand All @@ -210,7 +210,7 @@
source: "sha256 \"aaa\"",
}, {
message: <<~EOS,
Do not use a top-level `url` stanza as the default. Add it to an `on_{system}` block instead.
Cask/NoOverrides: Do not use a top-level `url` 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.
EOS
severity: :convention,
Expand Down Expand Up @@ -240,7 +240,7 @@
let(:expected_offenses) do
[{
message: <<~EOS,
Do not use a top-level `version` stanza as the default. Add it to an `on_{system}` block instead.
Cask/NoOverrides: Do not use a top-level `version` 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.
EOS
severity: :convention,
Expand Down

0 comments on commit da734a3

Please sign in to comment.