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.
This commit is contained in:
Issy Long 2023-04-07 17:16:48 +01:00
parent 63d8de3600
commit da734a30c2
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4
67 changed files with 457 additions and 435 deletions

View File

@ -13,7 +13,6 @@ inherit_mode:
AllCops: AllCops:
TargetRubyVersion: 2.6 TargetRubyVersion: 2.6
DisplayCopNames: false
ActiveSupportExtensionsEnabled: true ActiveSupportExtensionsEnabled: true
NewCops: enable NewCops: enable
Include: Include:

View File

@ -75,9 +75,9 @@ describe RuboCop::Cop::FormulaAudit::BottleDigestIndentation do
rebuild 4 rebuild 4
sha256 arm64_big_sur: "aaaaaaaa" sha256 arm64_big_sur: "aaaaaaaa"
sha256 big_sur: "faceb00c" sha256 big_sur: "faceb00c"
^^^^^^^^^^ Align bottle digests ^^^^^^^^^^ FormulaAudit/BottleDigestIndentation: Align bottle digests
sha256 catalina: "deadbeef" sha256 catalina: "deadbeef"
^^^^^^^^^^ Align bottle digests ^^^^^^^^^^ FormulaAudit/BottleDigestIndentation: Align bottle digests
end end
end end
RUBY RUBY
@ -105,9 +105,9 @@ describe RuboCop::Cop::FormulaAudit::BottleDigestIndentation do
rebuild 4 rebuild 4
sha256 cellar: :any, arm64_big_sur: "aaaaaaaa" sha256 cellar: :any, arm64_big_sur: "aaaaaaaa"
sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c" sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c"
^^^^^^^^^^ Align bottle digests ^^^^^^^^^^ FormulaAudit/BottleDigestIndentation: Align bottle digests
sha256 catalina: "deadbeef" sha256 catalina: "deadbeef"
^^^^^^^^^^ Align bottle digests ^^^^^^^^^^ FormulaAudit/BottleDigestIndentation: Align bottle digests
end end
end end
RUBY RUBY

View File

@ -23,7 +23,7 @@ describe RuboCop::Cop::FormulaAudit::BottleFormat do
bottle do bottle do
sha256 "faceb00c" => :big_sur sha256 "faceb00c" => :big_sur
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
end end
end end
RUBY RUBY
@ -45,9 +45,9 @@ describe RuboCop::Cop::FormulaAudit::BottleFormat do
bottle do bottle do
rebuild 4 rebuild 4
sha256 "faceb00c" => :big_sur sha256 "faceb00c" => :big_sur
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
sha256 "deadbeef" => :catalina sha256 "deadbeef" => :catalina
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
end end
end end
RUBY RUBY
@ -72,12 +72,12 @@ describe RuboCop::Cop::FormulaAudit::BottleFormat do
bottle do bottle do
cellar :any cellar :any
^^^^^^^^^^^ `cellar` should be a parameter to `sha256` ^^^^^^^^^^^ FormulaAudit/BottleFormat: `cellar` should be a parameter to `sha256`
rebuild 4 rebuild 4
sha256 "faceb00c" => :big_sur sha256 "faceb00c" => :big_sur
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
sha256 "deadbeef" => :catalina sha256 "deadbeef" => :catalina
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
end end
end end
RUBY RUBY
@ -100,9 +100,9 @@ describe RuboCop::Cop::FormulaAudit::BottleFormat do
bottle do bottle do
cellar :any cellar :any
^^^^^^^^^^^ `cellar` should be a parameter to `sha256` ^^^^^^^^^^^ FormulaAudit/BottleFormat: `cellar` should be a parameter to `sha256`
sha256 "faceb00c" => :big_sur sha256 "faceb00c" => :big_sur
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
end end
end end
RUBY RUBY
@ -123,12 +123,12 @@ describe RuboCop::Cop::FormulaAudit::BottleFormat do
bottle do bottle do
cellar "/usr/local/Cellar" cellar "/usr/local/Cellar"
^^^^^^^^^^^^^^^^^^^^^^^^^^ `cellar` should be a parameter to `sha256` ^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `cellar` should be a parameter to `sha256`
rebuild 4 rebuild 4
sha256 "faceb00c" => :big_sur sha256 "faceb00c" => :big_sur
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
sha256 "deadbeef" => :catalina sha256 "deadbeef" => :catalina
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax
end end
end end
RUBY RUBY

View File

@ -122,7 +122,7 @@ describe RuboCop::Cop::FormulaAudit::BottleOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
bottle do bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles ^^^^^^^^^ FormulaAudit/BottleOrder: ARM bottles should be listed before Intel bottles
rebuild 4 rebuild 4
sha256 big_sur: "faceb00c" sha256 big_sur: "faceb00c"
sha256 catalina: "deadbeef" sha256 catalina: "deadbeef"
@ -151,7 +151,7 @@ describe RuboCop::Cop::FormulaAudit::BottleOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
bottle do bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles ^^^^^^^^^ FormulaAudit/BottleOrder: ARM bottles should be listed before Intel bottles
rebuild 4 rebuild 4
sha256 big_sur: "faceb00c" sha256 big_sur: "faceb00c"
sha256 arm64_catalina: "aaaaaaaa" sha256 arm64_catalina: "aaaaaaaa"
@ -182,7 +182,7 @@ describe RuboCop::Cop::FormulaAudit::BottleOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
bottle do bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles ^^^^^^^^^ FormulaAudit/BottleOrder: ARM bottles should be listed before Intel bottles
rebuild 4 rebuild 4
sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c" sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c"
sha256 catalina: "deadbeef" sha256 catalina: "deadbeef"
@ -213,7 +213,7 @@ describe RuboCop::Cop::FormulaAudit::BottleOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
bottle do bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles ^^^^^^^^^ FormulaAudit/BottleOrder: ARM bottles should be listed before Intel bottles
cellar :any cellar :any
sha256 "faceb00c" => :big_sur sha256 "faceb00c" => :big_sur
sha256 "aaaaaaaa" => :arm64_big_sur sha256 "aaaaaaaa" => :arm64_big_sur

View File

@ -74,10 +74,10 @@ describe RuboCop::Cop::FormulaAudit::BottleTagIndentation do
bottle do bottle do
rebuild 4 rebuild 4
sha256 cellar: :any, arm64_big_sur: "aaaaaaaa" sha256 cellar: :any, arm64_big_sur: "aaaaaaaa"
^^^^^^^^^^^^^^^^^^^^^^^^^ Align bottle tags ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleTagIndentation: Align bottle tags
sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c" sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c"
sha256 catalina: "deadbeef" sha256 catalina: "deadbeef"
^^^^^^^^^^^^^^^^^^^^ Align bottle tags ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleTagIndentation: Align bottle tags
end end
end end
RUBY RUBY

View File

@ -17,14 +17,14 @@ describe RuboCop::Cop::Cask::Desc do
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo' do cask 'foo' do
desc 'A bar program' desc 'A bar program'
^ Description shouldn't start with an article. ^ Cask/Desc: Description shouldn't start with an article.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo' do cask 'foo' do
desc 'The bar program' desc 'The bar program'
^^^ Description shouldn't start with an article. ^^^ Cask/Desc: Description shouldn't start with an article.
end end
RUBY RUBY
@ -39,35 +39,35 @@ describe RuboCop::Cop::Cask::Desc do
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foobar' do cask 'foobar' do
desc 'Foo bar program' desc 'Foo bar program'
^^^^^^^ Description shouldn't start with the cask name. ^^^^^^^ Cask/Desc: Description shouldn't start with the cask name.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foobar' do cask 'foobar' do
desc 'Foo-Bar program' desc 'Foo-Bar program'
^^^^^^^ Description shouldn't start with the cask name. ^^^^^^^ Cask/Desc: Description shouldn't start with the cask name.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do cask 'foo-bar' do
desc 'Foo bar program' desc 'Foo bar program'
^^^^^^^ Description shouldn't start with the cask name. ^^^^^^^ Cask/Desc: Description shouldn't start with the cask name.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do cask 'foo-bar' do
desc 'Foo-Bar program' desc 'Foo-Bar program'
^^^^^^^ Description shouldn't start with the cask name. ^^^^^^^ Cask/Desc: Description shouldn't start with the cask name.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do cask 'foo-bar' do
desc 'Foo Bar' desc 'Foo Bar'
^^^^^^^ Description shouldn't start with the cask name. ^^^^^^^ Cask/Desc: Description shouldn't start with the cask name.
end end
RUBY RUBY
end end
@ -76,28 +76,28 @@ describe RuboCop::Cop::Cask::Desc do
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do cask 'foo-bar' do
desc 'macOS status bar monitor' desc 'macOS status bar monitor'
^^^^^ Description shouldn't contain the platform. ^^^^^ Cask/Desc: Description shouldn't contain the platform.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do cask 'foo-bar' do
desc 'Toggles dark mode on Mac OS Mojave' desc 'Toggles dark mode on Mac OS Mojave'
^^^^^^ Description shouldn't contain the platform. ^^^^^^ Cask/Desc: Description shouldn't contain the platform.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do cask 'foo-bar' do
desc 'Better input source switcher for OS X' desc 'Better input source switcher for OS X'
^^^^ Description shouldn't contain the platform. ^^^^ Cask/Desc: Description shouldn't contain the platform.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do cask 'foo-bar' do
desc 'Media Manager for Mac OS X' desc 'Media Manager for Mac OS X'
^^^^^^^^ Description shouldn't contain the platform. ^^^^^^^^ Cask/Desc: Description shouldn't contain the platform.
end end
RUBY RUBY
@ -110,7 +110,7 @@ describe RuboCop::Cop::Cask::Desc do
expect_offense <<~RUBY expect_offense <<~RUBY
cask 'foo' do cask 'foo' do
desc 'Application for managing macOS virtual machines on macOS' desc 'Application for managing macOS virtual machines on macOS'
^^^^^ Description shouldn't contain the platform. ^^^^^ Cask/Desc: Description shouldn't contain the platform.
end end
RUBY RUBY

View File

@ -50,8 +50,7 @@ describe RuboCop::Cop::Cask::HomepageUrlTrailingSlash do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "'https://foo.brew.sh' must have a slash " \ message: "Cask/HomepageUrlTrailingSlash: 'https://foo.brew.sh' must have a slash after the domain.",
"after the domain.",
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 11, column: 11,

View File

@ -20,7 +20,7 @@ describe RuboCop::Cop::Cask::NoDslVersion do
let(:correct_source) { "cask 'foo' do; end" } let(:correct_source) { "cask 'foo' do; end" }
let(:expected_offenses) do 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, severity: :convention,
line: 1, line: 1,
column: 0, column: 0,

View File

@ -201,7 +201,7 @@ describe RuboCop::Cop::Cask::NoOverrides do
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: <<~EOS, 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. Use `:or_older` or `:or_newer` to specify a range of macOS versions.
EOS EOS
severity: :convention, severity: :convention,
@ -210,7 +210,7 @@ describe RuboCop::Cop::Cask::NoOverrides do
source: "sha256 \"aaa\"", source: "sha256 \"aaa\"",
}, { }, {
message: <<~EOS, 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. Use `:or_older` or `:or_newer` to specify a range of macOS versions.
EOS EOS
severity: :convention, severity: :convention,
@ -240,7 +240,7 @@ describe RuboCop::Cop::Cask::NoOverrides do
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: <<~EOS, 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. Use `:or_older` or `:or_newer` to specify a range of macOS versions.
EOS EOS
severity: :convention, severity: :convention,

View File

@ -49,7 +49,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Don't use `on_intel` in `postflight do`, use `if Hardware::CPU.intel?` instead.", message: <<~EOS.chomp,
Cask/OnSystemConditionals: Don't use `on_intel` in `postflight do`, use `if Hardware::CPU.intel?` instead.
EOS
severity: :convention, severity: :convention,
line: 3, line: 3,
column: 4, column: 4,
@ -87,7 +89,8 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Don't use `on_monterey` in `postflight do`, use `if MacOS.version == :monterey` instead.", message: "Cask/OnSystemConditionals: Don't use `on_monterey` in `postflight do`, use " \
"`if MacOS.version == :monterey` instead.",
severity: :convention, severity: :convention,
line: 3, line: 3,
column: 4, column: 4,
@ -125,7 +128,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Don't use `on_monterey :or_older` in `postflight do`, " \ message: "Cask/OnSystemConditionals: Don't use `on_monterey :or_older` in `postflight do`, " \
"use `if MacOS.version <= :monterey` instead.", "use `if MacOS.version <= :monterey` instead.",
severity: :convention, severity: :convention,
line: 3, line: 3,
@ -196,9 +199,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: 'Use `sha256 arm: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b", ' \ message: <<~EOS.chomp,
'intel: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"` instead of ' \ Cask/OnSystemConditionals: Use `sha256 arm: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b", intel: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"` instead of nesting the `sha256` stanzas in `on_intel` and `on_arm` blocks
"nesting the `sha256` stanzas in `on_intel` and `on_arm` blocks", EOS
severity: :convention, severity: :convention,
line: 5, line: 5,
column: 2, column: 2,
@ -278,7 +281,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Don't use `Hardware::CPU.arm?`, use `on_arm` and `on_intel` blocks instead.", message: <<~EOS.chomp,
Cask/OnSystemConditionals: Don't use `Hardware::CPU.arm?`, use `on_arm` and `on_intel` blocks instead.
EOS
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 5, column: 5,
@ -303,7 +308,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Don't use `Hardware::CPU.intel?`, use `on_arm` and `on_intel` blocks instead.", message: <<~EOS.chomp,
Cask/OnSystemConditionals: Don't use `Hardware::CPU.intel?`, use `on_arm` and `on_intel` blocks instead.
EOS
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 5, column: 5,
@ -327,7 +334,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Don't use `Hardware::CPU.arch`, use `on_arm` and `on_intel` blocks instead.", message: <<~EOS.chomp,
Cask/OnSystemConditionals: Don't use `Hardware::CPU.arch`, use `on_arm` and `on_intel` blocks instead.
EOS
severity: :convention, severity: :convention,
line: 5, line: 5,
column: 44, column: 44,
@ -354,7 +363,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Don't use `if MacOS.version == :catalina`, use `on_catalina do` instead.", message: <<~EOS.chomp,
Cask/OnSystemConditionals: Don't use `if MacOS.version == :catalina`, use `on_catalina do` instead.
EOS
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 2, column: 2,
@ -379,7 +390,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Don't use `if MacOS.version <= :catalina`, use `on_catalina :or_older do` instead.", message: <<~EOS.chomp,
Cask/OnSystemConditionals: Don't use `if MacOS.version <= :catalina`, use `on_catalina :or_older do` instead.
EOS
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 2, column: 2,
@ -404,7 +417,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Don't use `if MacOS.version >= :catalina`, use `on_catalina :or_newer do` instead.", message: <<~EOS.chomp,
Cask/OnSystemConditionals: Don't use `if MacOS.version >= :catalina`, use `on_catalina :or_newer do` instead.
EOS
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 2, column: 2,
@ -428,7 +443,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Don't use `MacOS.version == :monterey`, use `on_{macos_version}` blocks instead.", message: <<~EOS.chomp,
Cask/OnSystemConditionals: Don't use `MacOS.version == :monterey`, use `on_{macos_version}` blocks instead.
EOS
severity: :convention, severity: :convention,
line: 5, line: 5,
column: 44, column: 44,

View File

@ -10,10 +10,10 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
let(:missing_line_msg) do let(:missing_line_msg) do
"stanza groups should be separated by a single empty line" "Cask/StanzaGrouping: stanza groups should be separated by a single empty line"
end end
let(:extra_line_msg) do let(:extra_line_msg) do
"stanzas within the same group should have no lines between them" "Cask/StanzaGrouping: stanzas within the same group should have no lines between them"
end end
context "when there is only one stanza" do context "when there is only one stanza" do

View File

@ -56,13 +56,13 @@ describe RuboCop::Cop::Cask::StanzaOrder do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "`sha256` stanza out of order", message: "Cask/StanzaOrder: `sha256` stanza out of order",
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 2, column: 2,
source: "sha256 :no_check", source: "sha256 :no_check",
}, { }, {
message: "`version` stanza out of order", message: "Cask/StanzaOrder: `version` stanza out of order",
severity: :convention, severity: :convention,
line: 3, line: 3,
column: 2, column: 2,
@ -96,19 +96,19 @@ describe RuboCop::Cop::Cask::StanzaOrder do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "`version` stanza out of order", message: "Cask/StanzaOrder: `version` stanza out of order",
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 2, column: 2,
source: "version :latest", source: "version :latest",
}, { }, {
message: "`sha256` stanza out of order", message: "Cask/StanzaOrder: `sha256` stanza out of order",
severity: :convention, severity: :convention,
line: 3, line: 3,
column: 2, column: 2,
source: "sha256 :no_check", source: "sha256 :no_check",
}, { }, {
message: "`arch` stanza out of order", message: "Cask/StanzaOrder: `arch` stanza out of order",
severity: :convention, severity: :convention,
line: 4, line: 4,
column: 2, column: 2,
@ -144,13 +144,13 @@ describe RuboCop::Cop::Cask::StanzaOrder do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "`sha256` stanza out of order", message: "Cask/StanzaOrder: `sha256` stanza out of order",
severity: :convention, severity: :convention,
line: 3, line: 3,
column: 2, column: 2,
source: "sha256 :no_check", source: "sha256 :no_check",
}, { }, {
message: "`on_arch_conditional` stanza out of order", message: "Cask/StanzaOrder: `on_arch_conditional` stanza out of order",
severity: :convention, severity: :convention,
line: 5, line: 5,
column: 2, column: 2,
@ -186,13 +186,13 @@ describe RuboCop::Cop::Cask::StanzaOrder do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "`on_arch_conditional` stanza out of order", message: "Cask/StanzaOrder: `on_arch_conditional` stanza out of order",
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 2, column: 2,
source: 'folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"', source: 'folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"',
}, { }, {
message: "`arch` stanza out of order", message: "Cask/StanzaOrder: `arch` stanza out of order",
severity: :convention, severity: :convention,
line: 3, line: 3,
column: 2, column: 2,
@ -232,26 +232,26 @@ describe RuboCop::Cop::Cask::StanzaOrder do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "`url` stanza out of order", message: "Cask/StanzaOrder: `url` stanza out of order",
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 2, column: 2,
source: "url 'https://foo.brew.sh/foo.zip'", source: "url 'https://foo.brew.sh/foo.zip'",
}, { }, {
message: "`uninstall` stanza out of order", message: "Cask/StanzaOrder: `uninstall` stanza out of order",
severity: :convention, severity: :convention,
line: 3, line: 3,
column: 2, column: 2,
source: "uninstall :quit => 'com.example.foo'," \ source: "uninstall :quit => 'com.example.foo'," \
"\n :kext => 'com.example.foo.kext'", "\n :kext => 'com.example.foo.kext'",
}, { }, {
message: "`version` stanza out of order", message: "Cask/StanzaOrder: `version` stanza out of order",
severity: :convention, severity: :convention,
line: 5, line: 5,
column: 2, column: 2,
source: "version :latest", source: "version :latest",
}, { }, {
message: "`sha256` stanza out of order", message: "Cask/StanzaOrder: `sha256` stanza out of order",
severity: :convention, severity: :convention,
line: 7, line: 7,
column: 2, column: 2,
@ -498,13 +498,13 @@ describe RuboCop::Cop::Cask::StanzaOrder do
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "`on_intel` stanza out of order", message: "Cask/StanzaOrder: `on_intel` stanza out of order",
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 2, column: 2,
source: "on_intel do\n url \"https://foo.brew.sh/foo-intel.zip\"\n sha256 :no_check\n version :latest\n end", # rubocop:disable Layout/LineLength source: "on_intel do\n url \"https://foo.brew.sh/foo-intel.zip\"\n sha256 :no_check\n version :latest\n end", # rubocop:disable Layout/LineLength
}, { }, {
message: "`on_arm` stanza out of order", message: "Cask/StanzaOrder: `on_arm` stanza out of order",
severity: :convention, severity: :convention,
line: 8, line: 8,
column: 2, column: 2,
@ -604,19 +604,19 @@ describe RuboCop::Cop::Cask::StanzaOrder do
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "`on_ventura` stanza out of order", message: "Cask/StanzaOrder: `on_ventura` stanza out of order",
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 2, column: 2,
source: "on_ventura do\n url \"https://foo.brew.sh/foo-ventura.zip\"\n sha256 :no_check\n end", source: "on_ventura do\n url \"https://foo.brew.sh/foo-ventura.zip\"\n sha256 :no_check\n end",
}, { }, {
message: "`on_mojave` stanza out of order", message: "Cask/StanzaOrder: `on_mojave` stanza out of order",
severity: :convention, severity: :convention,
line: 10, line: 10,
column: 2, column: 2,
source: "on_mojave do\n url \"https://foo.brew.sh/foo-mojave.zip\"\n sha256 :no_check\n end", source: "on_mojave do\n url \"https://foo.brew.sh/foo-mojave.zip\"\n sha256 :no_check\n end",
}, { }, {
message: "`on_big_sur` stanza out of order", message: "Cask/StanzaOrder: `on_big_sur` stanza out of order",
severity: :convention, severity: :convention,
line: 14, line: 14,
column: 2, column: 2,

View File

@ -54,7 +54,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Use 'version.csv.first' instead of 'version.before_comma' " \ message: "Cask/UrlLegacyCommaSeparators: Use 'version.csv.first' instead of 'version.before_comma' " \
"and 'version.csv.second' instead of 'version.after_comma'", "and 'version.csv.second' instead of 'version.after_comma'",
severity: :convention, severity: :convention,
line: 3, line: 3,
@ -87,7 +87,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Use 'version.csv.first' instead of 'version.before_comma' " \ message: "Cask/UrlLegacyCommaSeparators: Use 'version.csv.first' instead of 'version.before_comma' " \
"and 'version.csv.second' instead of 'version.after_comma'", "and 'version.csv.second' instead of 'version.after_comma'",
severity: :convention, severity: :convention,
line: 3, line: 3,

View File

@ -34,7 +34,7 @@ describe RuboCop::Cop::Cask::Url do
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Verified URL parameter value should not contain a URL scheme.", message: "Cask/Url: Verified URL parameter value should not contain a URL scheme.",
severity: :convention, severity: :convention,
line: 3, line: 3,
column: 16, column: 16,
@ -81,7 +81,7 @@ describe RuboCop::Cop::Cask::Url do
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Verified URL parameter value should end with a /.", message: "Cask/Url: Verified URL parameter value should end with a /.",
severity: :convention, severity: :convention,
line: 3, line: 3,
column: 16, column: 16,
@ -156,7 +156,7 @@ describe RuboCop::Cop::Cask::Url do
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Verified URL parameter value should end with a /.", message: "Cask/Url: Verified URL parameter value should end with a /.",
severity: :convention, severity: :convention,
line: 3, line: 3,
column: 16, column: 16,
@ -195,7 +195,7 @@ describe RuboCop::Cop::Cask::Url do
<<~CASK <<~CASK
cask "foo" do cask "foo" do
version "1.2.3" version "1.2.3"
url "https://example.com/download/foo-v\#{version}.dmg", url "Cask/Url: https://example.com/download/foo-v\#{version}.dmg",
verified: "example.com/download/" verified: "example.com/download/"
end end
CASK CASK
@ -216,7 +216,7 @@ describe RuboCop::Cop::Cask::Url do
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Verified URL parameter value should end with a /.", message: "Cask/Url: Verified URL parameter value should end with a /.",
severity: :convention, severity: :convention,
line: 3, line: 3,
column: 16, column: 16,

View File

@ -62,7 +62,7 @@ describe RuboCop::Cop::Cask::Variables do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: 'Use `arch arm: "darwin-arm64", intel: "darwin"` instead of ' \ message: 'Cask/Variables: Use `arch arm: "darwin-arm64", intel: "darwin"` instead of ' \
'`arch = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"`', '`arch = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"`',
severity: :convention, severity: :convention,
line: 2, line: 2,
@ -93,7 +93,7 @@ describe RuboCop::Cop::Cask::Variables do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: "Use `arch arm: :darwin_arm64, intel: :darwin` instead of " \ message: "Cask/Variables: Use `arch arm: :darwin_arm64, intel: :darwin` instead of " \
"`arch = Hardware::CPU.intel? ? :darwin : :darwin_arm64`", "`arch = Hardware::CPU.intel? ? :darwin : :darwin_arm64`",
severity: :convention, severity: :convention,
line: 2, line: 2,
@ -124,7 +124,7 @@ describe RuboCop::Cop::Cask::Variables do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: 'Use `arch arm: "arm64"` instead of ' \ message: 'Cask/Variables: Use `arch arm: "arm64"` instead of ' \
'`arch = Hardware::CPU.intel? ? "" : "arm64"`', '`arch = Hardware::CPU.intel? ? "" : "arm64"`',
severity: :convention, severity: :convention,
line: 2, line: 2,
@ -155,8 +155,8 @@ describe RuboCop::Cop::Cask::Variables do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: 'Use `folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` instead of ' \ message: 'Cask/Variables: Use `folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` ' \
'`folder = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"`', 'instead of `folder = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"`',
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 2, column: 2,
@ -186,7 +186,7 @@ describe RuboCop::Cop::Cask::Variables do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: 'Use `folder = on_arch_conditional intel: "amd64"` instead of ' \ message: 'Cask/Variables: Use `folder = on_arch_conditional intel: "amd64"` instead of ' \
'`folder = Hardware::CPU.intel? ? "amd64" : ""`', '`folder = Hardware::CPU.intel? ? "amd64" : ""`',
severity: :convention, severity: :convention,
line: 2, line: 2,
@ -219,15 +219,15 @@ describe RuboCop::Cop::Cask::Variables do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: 'Use `arch arm: "darwin-arm64", intel: "darwin"` instead of ' \ message: 'Cask/Variables: Use `arch arm: "darwin-arm64", intel: "darwin"` instead of ' \
'`arch = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"`', '`arch = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"`',
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 2, column: 2,
source: 'arch = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"', source: 'arch = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"',
}, { }, {
message: 'Use `folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` instead of ' \ message: 'Cask/Variables: Use `folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` ' \
'`folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"`', 'instead of `folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"`',
severity: :convention, severity: :convention,
line: 3, line: 3,
column: 2, column: 2,
@ -259,15 +259,15 @@ describe RuboCop::Cop::Cask::Variables do
end end
let(:expected_offenses) do let(:expected_offenses) do
[{ [{
message: 'Use `folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` instead of ' \ message: 'Cask/Variables: Use `folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` instead ' \
'`folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"`', 'of `folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"`',
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 2, column: 2,
source: 'folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"', source: 'folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"',
}, { }, {
message: 'Use `platform = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` instead of ' \ message: 'Cask/Variables: Use `platform = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` ' \
'`platform = Hardware::CPU.intel? ? "darwin": "darwin-arm64"`', 'instead of `platform = Hardware::CPU.intel? ? "darwin": "darwin-arm64"`',
severity: :convention, severity: :convention,
line: 3, line: 3,
column: 2, column: 2,

View File

@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::Caveats do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
def caveats def caveats
"setuid" "setuid"
^^^^^^^^ Don't recommend setuid in the caveats, suggest sudo instead. ^^^^^^^^ FormulaAudit/Caveats: Don't recommend setuid in the caveats, suggest sudo instead.
end end
end end
RUBY RUBY
@ -27,7 +27,7 @@ describe RuboCop::Cop::FormulaAudit::Caveats do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
def caveats def caveats
"\\x1B" "\\x1B"
^^^^^^ Don't use ANSI escape codes in the caveats. ^^^^^^ FormulaAudit/Caveats: Don't use ANSI escape codes in the caveats.
end end
end end
RUBY RUBY
@ -38,7 +38,7 @@ describe RuboCop::Cop::FormulaAudit::Caveats do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
def caveats def caveats
"\\u001b" "\\u001b"
^^^^^^^^ Don't use ANSI escape codes in the caveats. ^^^^^^^^ FormulaAudit/Caveats: Don't use ANSI escape codes in the caveats.
end end
end end
RUBY RUBY

View File

@ -14,12 +14,12 @@ describe RuboCop::Cop::FormulaAudit::ChecksumCase do
stable do stable do
url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz" url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz"
sha256 "5cf6e1ae0A645b426c0a7cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9a" sha256 "5cf6e1ae0A645b426c0a7cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9a"
^ sha256 should be lowercase ^ FormulaAudit/ChecksumCase: sha256 should be lowercase
resource "foo-package" do resource "foo-package" do
url "https://github.com/foo-lang/foo-package/archive/0.18.0.tar.gz" url "https://github.com/foo-lang/foo-package/archive/0.18.0.tar.gz"
sha256 "5cf6e1Ae0a645b426b047aa4cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea9" sha256 "5cf6e1Ae0a645b426b047aa4cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea9"
^ sha256 should be lowercase ^ FormulaAudit/ChecksumCase: sha256 should be lowercase
end end
end end
end end
@ -33,7 +33,7 @@ describe RuboCop::Cop::FormulaAudit::ChecksumCase do
resource "foo-outside" do resource "foo-outside" do
url "https://github.com/foo-lang/foo-outside/archive/0.18.0.tar.gz" url "https://github.com/foo-lang/foo-outside/archive/0.18.0.tar.gz"
sha256 "A4cc7cd3f7d1605ffa1ac5755cf6e1ae0a645b426b047a6a39a8b2268ddc7ea9" sha256 "A4cc7cd3f7d1605ffa1ac5755cf6e1ae0a645b426b047a6a39a8b2268ddc7ea9"
^ sha256 should be lowercase ^ FormulaAudit/ChecksumCase: sha256 should be lowercase
end end
stable do stable do
url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz" url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz"

View File

@ -14,12 +14,12 @@ describe RuboCop::Cop::FormulaAudit::Checksum do
stable do stable do
url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz" url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz"
sha256 "" sha256 ""
^^ sha256 is empty ^^ FormulaAudit/Checksum: sha256 is empty
resource "foo-package" do resource "foo-package" do
url "https://github.com/foo-lang/foo-package/archive/0.18.0.tar.gz" url "https://github.com/foo-lang/foo-package/archive/0.18.0.tar.gz"
sha256 "" sha256 ""
^^ sha256 is empty ^^ FormulaAudit/Checksum: sha256 is empty
end end
end end
end end
@ -33,12 +33,12 @@ describe RuboCop::Cop::FormulaAudit::Checksum do
stable do stable do
url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz" url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz"
sha256 "5cf6e1ae0a645b426c0474cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9ad" sha256 "5cf6e1ae0a645b426c0474cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9ad"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sha256 should be 64 characters ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Checksum: sha256 should be 64 characters
resource "foo-package" do resource "foo-package" do
url "https://github.com/foo-lang/foo-package/archive/0.18.0.tar.gz" url "https://github.com/foo-lang/foo-package/archive/0.18.0.tar.gz"
sha256 "5cf6e1ae0a645b426c047aaa4cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9" sha256 "5cf6e1ae0a645b426c047aaa4cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sha256 should be 64 characters ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Checksum: sha256 should be 64 characters
end end
end end
end end
@ -52,12 +52,12 @@ describe RuboCop::Cop::FormulaAudit::Checksum do
stable do stable do
url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz" url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz"
sha256 "5cf6e1ae0a645b426c0k7cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9a" sha256 "5cf6e1ae0a645b426c0k7cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9a"
^ sha256 contains invalid characters ^ FormulaAudit/Checksum: sha256 contains invalid characters
resource "foo-package" do resource "foo-package" do
url "https://github.com/foo-lang/foo-package/archive/0.18.0.tar.gz" url "https://github.com/foo-lang/foo-package/archive/0.18.0.tar.gz"
sha256 "5cf6e1ae0a645b426x047aa4cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea9" sha256 "5cf6e1ae0a645b426x047aa4cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea9"
^ sha256 contains invalid characters ^ FormulaAudit/Checksum: sha256 contains invalid characters
end end
end end
end end
@ -71,7 +71,7 @@ describe RuboCop::Cop::FormulaAudit::Checksum do
bottle do bottle do
sha256 catalina: "5cf6e1ae0a645b426c0474cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9ad" sha256 catalina: "5cf6e1ae0a645b426c0474cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9ad"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sha256 should be 64 characters ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Checksum: sha256 should be 64 characters
end end
end end
RUBY RUBY
@ -84,7 +84,7 @@ describe RuboCop::Cop::FormulaAudit::Checksum do
bottle do bottle do
sha256 cellar: :any, catalina: "5cf6e1ae0a645b426c0474cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9ad" sha256 cellar: :any, catalina: "5cf6e1ae0a645b426c0474cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9ad"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sha256 should be 64 characters ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Checksum: sha256 should be 64 characters
end end
end end
RUBY RUBY

View File

@ -15,7 +15,7 @@ describe RuboCop::Cop::FormulaAudit::ClassName do
it "reports and corrects an offense when using ScriptFileFormula" do it "reports and corrects an offense when using ScriptFileFormula" do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < ScriptFileFormula class Foo < ScriptFileFormula
^^^^^^^^^^^^^^^^^ ScriptFileFormula is deprecated, use Formula instead ^^^^^^^^^^^^^^^^^ FormulaAudit/ClassName: ScriptFileFormula is deprecated, use Formula instead
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
end end
RUBY RUBY
@ -25,7 +25,7 @@ describe RuboCop::Cop::FormulaAudit::ClassName do
it "reports and corrects an offense when using GithubGistFormula" do it "reports and corrects an offense when using GithubGistFormula" do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < GithubGistFormula class Foo < GithubGistFormula
^^^^^^^^^^^^^^^^^ GithubGistFormula is deprecated, use Formula instead ^^^^^^^^^^^^^^^^^ FormulaAudit/ClassName: GithubGistFormula is deprecated, use Formula instead
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
end end
RUBY RUBY
@ -35,7 +35,7 @@ describe RuboCop::Cop::FormulaAudit::ClassName do
it "reports and corrects an offense when using AmazonWebServicesFormula" do it "reports and corrects an offense when using AmazonWebServicesFormula" do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < AmazonWebServicesFormula class Foo < AmazonWebServicesFormula
^^^^^^^^^^^^^^^^^^^^^^^^ AmazonWebServicesFormula is deprecated, use Formula instead ^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ClassName: AmazonWebServicesFormula is deprecated, use Formula instead
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
end end
RUBY RUBY

View File

@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::Test do
test do test do
system "/usr/local/bin/test" system "/usr/local/bin/test"
^^^^^^^^^^^^^^^^^^^^^ use \#{bin} instead of /usr/local/bin in system ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Test: use \#{bin} instead of /usr/local/bin in system
end end
end end
RUBY RUBY
@ -36,7 +36,7 @@ describe RuboCop::Cop::FormulaAudit::Test do
test do test do
shell_output("\#{bin}/test", 0) shell_output("\#{bin}/test", 0)
^ Passing 0 to shell_output() is redundant ^ FormulaAudit/Test: Passing 0 to shell_output() is redundant
end end
end end
RUBY RUBY
@ -58,7 +58,7 @@ describe RuboCop::Cop::FormulaAudit::Test do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
test do test do
^^^^^^^ `test do` should not be empty ^^^^^^^ FormulaAudit/Test: `test do` should not be empty
end end
end end
RUBY RUBY
@ -70,7 +70,7 @@ describe RuboCop::Cop::FormulaAudit::Test do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
test do test do
^^^^^^^ `test do` should contain a real test ^^^^^^^ FormulaAudit/Test: `test do` should contain a real test
true true
end end
end end

View File

@ -15,7 +15,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
uses_from_macos "apple" uses_from_macos "apple"
depends_on "foo" depends_on "foo"
^^^^^^^^^^^^^^^^ `depends_on` (line 6) should be put before `uses_from_macos` (line 5) ^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `depends_on` (line 6) should be put before `uses_from_macos` (line 5)
end end
RUBY RUBY
@ -38,7 +38,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
license "0BSD" license "0BSD"
sha256 "samplesha256" sha256 "samplesha256"
^^^^^^^^^^^^^^^^^^^^^ `sha256` (line 5) should be put before `license` (line 4) ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `sha256` (line 5) should be put before `license` (line 4)
end end
RUBY RUBY
@ -61,7 +61,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
bottle :unneeded bottle :unneeded
livecheck do livecheck do
^^^^^^^^^^^^ `livecheck` (line 7) should be put before `bottle` (line 5) ^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `livecheck` (line 7) should be put before `bottle` (line 5)
url "https://brew.sh/foo/versions/" url "https://brew.sh/foo/versions/"
regex(/href=.+?foo-(\d+(?:.\d+)+).t/) regex(/href=.+?foo-(\d+(?:.\d+)+).t/)
end end
@ -88,7 +88,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
class Foo < Formula class Foo < Formula
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
homepage "https://brew.sh" homepage "https://brew.sh"
^^^^^^^^^^^^^^^^^^^^^^^^^^ `homepage` (line 3) should be put before `url` (line 2) ^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `homepage` (line 3) should be put before `url` (line 2)
end end
RUBY RUBY
@ -110,7 +110,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
end end
depends_on "openssl" depends_on "openssl"
^^^^^^^^^^^^^^^^^^^^ `depends_on` (line 8) should be put before `resource` (line 4) ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `depends_on` (line 8) should be put before `resource` (line 4)
end end
RUBY RUBY
@ -137,7 +137,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
end end
def plist def plist
^^^^^^^^^ `plist` (line 8) should be put before `test` (line 4) ^^^^^^^^^ FormulaAudit/ComponentsOrder: `plist` (line 8) should be put before `test` (line 4)
end end
end end
RUBY RUBY
@ -165,7 +165,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
end end
depends_on "openssl" depends_on "openssl"
^^^^^^^^^^^^^^^^^^^^ `depends_on` (line 7) should be put before `install` (line 4) ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `depends_on` (line 7) should be put before `install` (line 4)
end end
RUBY RUBY
@ -193,7 +193,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
end end
depends_on "openssl" depends_on "openssl"
^^^^^^^^^^^^^^^^^^^^ `depends_on` (line 10) should be put before `install` (line 4) ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `depends_on` (line 10) should be put before `install` (line 4)
end end
RUBY RUBY
@ -218,7 +218,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
depends_on "autoconf" => :build depends_on "autoconf" => :build
conflicts_with "visionmedia-watch" conflicts_with "visionmedia-watch"
depends_on "automake" => :build depends_on "automake" => :build
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `depends_on` (line 4) should be put before `conflicts_with` (line 3) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `depends_on` (line 4) should be put before `conflicts_with` (line 3)
depends_on "libtool" => :build depends_on "libtool" => :build
depends_on "pkg-config" => :build depends_on "pkg-config" => :build
depends_on "gettext" depends_on "gettext"
@ -245,7 +245,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
depends_on "readline" depends_on "readline"
end end
uses_from_macos "bar" uses_from_macos "bar"
^^^^^^^^^^^^^^^^^^^^^ `uses_from_macos` (line 6) should be put before `on_macos` (line 3) ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `uses_from_macos` (line 6) should be put before `on_macos` (line 3)
end end
RUBY RUBY
@ -269,7 +269,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
depends_on "readline" depends_on "readline"
end end
uses_from_macos "bar" uses_from_macos "bar"
^^^^^^^^^^^^^^^^^^^^^ `uses_from_macos` (line 6) should be put before `on_linux` (line 3) ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `uses_from_macos` (line 6) should be put before `on_linux` (line 3)
end end
RUBY RUBY
@ -293,7 +293,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
depends_on "vim" depends_on "vim"
end end
on_macos do on_macos do
^^^^^^^^^^^ `on_macos` (line 6) should be put before `on_linux` (line 3) ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_macos` (line 6) should be put before `on_linux` (line 3)
depends_on "readline" depends_on "readline"
end end
end end
@ -322,7 +322,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
depends_on "openssl" depends_on "openssl"
deprecate! because: "has been replaced by bar" deprecate! because: "has been replaced by bar"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `deprecate!` (line 6) should be put before `depends_on` (line 4) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `deprecate!` (line 6) should be put before `depends_on` (line 4)
end end
RUBY RUBY
@ -512,7 +512,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
end end
on_macos do on_macos do
^^^^^^^^^^^ there can only be one `on_macos` block in a formula. ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_macos` block in a formula.
depends_on "foo" depends_on "foo"
end end
end end
@ -528,7 +528,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
end end
on_linux do on_linux do
^^^^^^^^^^^ there can only be one `on_linux` block in a formula. ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_linux` block in a formula.
depends_on "foo" depends_on "foo"
end end
end end
@ -544,7 +544,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
end end
on_intel do on_intel do
^^^^^^^^^^^ there can only be one `on_intel` block in a formula. ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_intel` block in a formula.
depends_on "foo" depends_on "foo"
end end
end end
@ -560,7 +560,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
end end
on_arm do on_arm do
^^^^^^^^^ there can only be one `on_arm` block in a formula. ^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_arm` block in a formula.
depends_on "foo" depends_on "foo"
end end
end end
@ -576,7 +576,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
end end
on_monterey do on_monterey do
^^^^^^^^^^^^^^ there can only be one `on_monterey` block in a formula. ^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_monterey` block in a formula.
depends_on "foo" depends_on "foo"
end end
end end
@ -592,7 +592,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
end end
on_monterey :or_older do on_monterey :or_older do
^^^^^^^^^^^^^^^^^^^^^^^^ there can only be one `on_monterey` block in a formula. ^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_monterey` block in a formula.
depends_on "foo" depends_on "foo"
end end
end end
@ -606,7 +606,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
on_macos do on_macos do
depends_on "readline" depends_on "readline"
uses_from_macos "ncurses" uses_from_macos "ncurses"
^^^^^^^^^^^^^^^^^^^^^^^^^ `on_macos` cannot include `uses_from_macos`. [...] ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_macos` cannot include `uses_from_macos`. [...]
end end
end end
RUBY RUBY
@ -619,7 +619,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
on_linux do on_linux do
depends_on "readline" depends_on "readline"
uses_from_macos "ncurses" uses_from_macos "ncurses"
^^^^^^^^^^^^^^^^^^^^^^^^^ `on_linux` cannot include `uses_from_macos`. [...] ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_linux` cannot include `uses_from_macos`. [...]
end end
end end
RUBY RUBY
@ -632,7 +632,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
on_intel do on_intel do
depends_on "readline" depends_on "readline"
uses_from_macos "ncurses" uses_from_macos "ncurses"
^^^^^^^^^^^^^^^^^^^^^^^^^ `on_intel` cannot include `uses_from_macos`. [...] ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_intel` cannot include `uses_from_macos`. [...]
end end
end end
RUBY RUBY
@ -645,7 +645,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
on_arm do on_arm do
depends_on "readline" depends_on "readline"
uses_from_macos "ncurses" uses_from_macos "ncurses"
^^^^^^^^^^^^^^^^^^^^^^^^^ `on_arm` cannot include `uses_from_macos`. [...] ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_arm` cannot include `uses_from_macos`. [...]
end end
end end
RUBY RUBY
@ -659,7 +659,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
on_monterey do on_monterey do
depends_on "readline" depends_on "readline"
uses_from_macos "ncurses" uses_from_macos "ncurses"
^^^^^^^^^^^^^^^^^^^^^^^^^ `on_monterey` cannot include `uses_from_macos`. [...] ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_monterey` cannot include `uses_from_macos`. [...]
end end
end end
RUBY RUBY
@ -673,7 +673,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
on_monterey :or_older do on_monterey :or_older do
depends_on "readline" depends_on "readline"
uses_from_macos "ncurses" uses_from_macos "ncurses"
^^^^^^^^^^^^^^^^^^^^^^^^^ `on_monterey` cannot include `uses_from_macos`. [...] ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_monterey` cannot include `uses_from_macos`. [...]
end end
end end
RUBY RUBY
@ -684,7 +684,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
class Foo < Formula class Foo < Formula
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
on_arm do on_arm do
^^^^^^^^^ Nest `on_arm` blocks inside `patch` blocks when there is only one inner block. ^^^^^^^^^ FormulaAudit/ComponentsOrder: Nest `on_arm` blocks inside `patch` blocks when there is only one inner block.
patch do patch do
url "https://brew.sh/patch1.tar.gz" url "https://brew.sh/patch1.tar.gz"
sha256 "2c39089f64d9d4c3e632f120894b36b68dcc8ae8c6f5130c0c2e6f5bb7aebf2f" sha256 "2c39089f64d9d4c3e632f120894b36b68dcc8ae8c6f5130c0c2e6f5bb7aebf2f"
@ -711,7 +711,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
class Foo < Formula class Foo < Formula
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
on_linux do on_linux do
^^^^^^^^^^^ Nest `on_linux` blocks inside `resource` blocks when there is only one inner block. ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: Nest `on_linux` blocks inside `resource` blocks when there is only one inner block.
resource do resource do
url "https://brew.sh/resource1.tar.gz" url "https://brew.sh/resource1.tar.gz"
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
@ -738,7 +738,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
class Foo < Formula class Foo < Formula
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
on_monterey :or_newer do on_monterey :or_newer do
^^^^^^^^^^^^^^^^^^^^^^^^ Nest `on_monterey` blocks inside `patch` blocks when there is only one inner block. ^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: Nest `on_monterey` blocks inside `patch` blocks when there is only one inner block.
patch do patch do
url "https://brew.sh/patch1.tar.gz" url "https://brew.sh/patch1.tar.gz"
sha256 "2c39089f64d9d4c3e632f120894b36b68dcc8ae8c6f5130c0c2e6f5bb7aebf2f" sha256 "2c39089f64d9d4c3e632f120894b36b68dcc8ae8c6f5130c0c2e6f5bb7aebf2f"
@ -765,7 +765,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
class Foo < Formula class Foo < Formula
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
on_system :linux, macos: :monterey_or_older do on_system :linux, macos: :monterey_or_older do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Nest `on_system` blocks inside `resource` blocks when there is only one inner block. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: Nest `on_system` blocks inside `resource` blocks when there is only one inner block.
resource do resource do
url "https://brew.sh/resource1.tar.gz" url "https://brew.sh/resource1.tar.gz"
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
@ -812,7 +812,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
head do head do
depends_on "bar" depends_on "bar"
url "https://github.com/foo/foo.git", branch: "main" url "https://github.com/foo/foo.git", branch: "main"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `url` (line 6) should be put before `depends_on` (line 5) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `url` (line 6) should be put before `depends_on` (line 5)
end end
end end
RUBY RUBY
@ -828,7 +828,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
resource do resource do
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
url "https://brew.sh/resource1.tar.gz" url "https://brew.sh/resource1.tar.gz"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `url` (line 6) should be put before `sha256` (line 5) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `url` (line 6) should be put before `sha256` (line 5)
end end
end end
RUBY RUBY
@ -882,7 +882,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
resource do resource do
^^^^^^^^^^^ there can only be one `on_macos` block in a resource block. ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_macos` block in a resource block.
on_macos do on_macos do
url "https://brew.sh/resource1.tar.gz" url "https://brew.sh/resource1.tar.gz"
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
@ -903,7 +903,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
resource do resource do
^^^^^^^^^^^ there can only be one `on_linux` block in a resource block. ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_linux` block in a resource block.
on_linux do on_linux do
url "https://brew.sh/resource1.tar.gz" url "https://brew.sh/resource1.tar.gz"
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
@ -924,7 +924,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
resource do resource do
^^^^^^^^^^^ there can only be one `on_intel` block in a resource block. ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_intel` block in a resource block.
on_intel do on_intel do
url "https://brew.sh/resource1.tar.gz" url "https://brew.sh/resource1.tar.gz"
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
@ -945,7 +945,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
resource do resource do
^^^^^^^^^^^ there can only be one `on_arm` block in a resource block. ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_arm` block in a resource block.
on_arm do on_arm do
url "https://brew.sh/resource1.tar.gz" url "https://brew.sh/resource1.tar.gz"
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
@ -966,7 +966,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
resource do resource do
^^^^^^^^^^^ there can only be one `on_monterey` block in a resource block. ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_monterey` block in a resource block.
on_monterey do on_monterey do
url "https://brew.sh/resource1.tar.gz" url "https://brew.sh/resource1.tar.gz"
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
@ -1044,7 +1044,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
resource do resource do
on_macos do on_macos do
^^^^^^^^^^^ `on_macos` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order). ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_macos` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order).
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
url "https://brew.sh/resource2.tar.gz" url "https://brew.sh/resource2.tar.gz"
end end
@ -1111,7 +1111,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
resource do resource do
on_macos do on_macos do
^^^^^^^^^^^ `on_macos` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order). ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_macos` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order).
if foo == :bar if foo == :bar
url "https://brew.sh/resource2.tar.gz" url "https://brew.sh/resource2.tar.gz"
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
@ -1137,7 +1137,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
resource do resource do
on_arm do on_arm do
^^^^^^^^^ `on_arm` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order). ^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_arm` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order).
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
url "https://brew.sh/resource2.tar.gz" url "https://brew.sh/resource2.tar.gz"
end end
@ -1181,7 +1181,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
resource do resource do
on_arm do on_arm do
^^^^^^^^^ `on_arm` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order). ^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_arm` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order).
if foo == :bar if foo == :bar
url "https://brew.sh/resource2.tar.gz" url "https://brew.sh/resource2.tar.gz"
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"

View File

@ -11,7 +11,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsRedundancy do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `url` should be put inside `stable` block ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsRedundancy: `url` should be put inside `stable` block
stable do stable do
# stuff # stuff
end end
@ -28,7 +28,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsRedundancy do
class Foo < Formula class Foo < Formula
head "https://brew.sh/foo.git" head "https://brew.sh/foo.git"
head do head do
^^^^^^^ `head` and `head do` should not be simultaneously present ^^^^^^^ FormulaAudit/ComponentsRedundancy: `head` and `head do` should not be simultaneously present
# stuff # stuff
end end
end end
@ -40,7 +40,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsRedundancy do
class Foo < Formula class Foo < Formula
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
bottle do bottle do
^^^^^^^^^ `bottle :modifier` and `bottle do` should not be simultaneously present ^^^^^^^^^ FormulaAudit/ComponentsRedundancy: `bottle :modifier` and `bottle do` should not be simultaneously present
# bottles go here # bottles go here
end end
bottle :unneeded bottle :unneeded

View File

@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::Conflicts do
class Foo < Formula class Foo < Formula
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
conflicts_with "bar", :because => "Reason" conflicts_with "bar", :because => "Reason"
^^^^^^^^ 'Reason' from the `conflicts_with` reason should be 'reason'. ^^^^^^^^ FormulaAudit/Conflicts: 'Reason' from the `conflicts_with` reason should be 'reason'.
conflicts_with "baz", :because => "Foo is the formula name which does not require downcasing" conflicts_with "baz", :because => "Foo is the formula name which does not require downcasing"
end end
RUBY RUBY
@ -31,7 +31,7 @@ describe RuboCop::Cop::FormulaAudit::Conflicts do
class Foo < Formula class Foo < Formula
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
conflicts_with "bar", "baz", :because => "reason." conflicts_with "bar", "baz", :because => "reason."
^^^^^^^^^ `conflicts_with` reason should not end with a period. ^^^^^^^^^ FormulaAudit/Conflicts: `conflicts_with` reason should not end with a period.
end end
RUBY RUBY
@ -48,7 +48,7 @@ describe RuboCop::Cop::FormulaAudit::Conflicts do
class FooAT20 < Formula class FooAT20 < Formula
url 'https://brew.sh/foo-2.0.tgz' url 'https://brew.sh/foo-2.0.tgz'
conflicts_with "mysql", "mariadb" conflicts_with "mysql", "mariadb"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Versioned formulae should not use `conflicts_with`. Use `keg_only :versioned_formula` instead. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Conflicts: Versioned formulae should not use `conflicts_with`. Use `keg_only :versioned_formula` instead.
end end
RUBY RUBY
end end

View File

@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
uses_from_macos "apple" if build.with? "foo" uses_from_macos "apple" if build.with? "foo"
uses_from_macos "foo" => :optional uses_from_macos "foo" => :optional
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 5) should be put before dependency "apple" (line 4) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 5) should be put before dependency "apple" (line 4)
end end
RUBY RUBY
@ -35,7 +35,7 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
uses_from_macos "foo" uses_from_macos "foo"
uses_from_macos "bar" uses_from_macos "bar"
^^^^^^^^^^^^^^^^^^^^^ dependency "bar" (line 5) should be put before dependency "foo" (line 4) ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 5) should be put before dependency "foo" (line 4)
end end
RUBY RUBY
@ -56,7 +56,7 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
uses_from_macos FooRequirement uses_from_macos FooRequirement
uses_from_macos "bar" uses_from_macos "bar"
^^^^^^^^^^^^^^^^^^^^^ dependency "bar" (line 5) should be put before dependency "FooRequirement" (line 4) ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 5) should be put before dependency "FooRequirement" (line 4)
end end
RUBY RUBY
@ -78,13 +78,13 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do
head do head do
uses_from_macos "apple" if build.with? "foo" uses_from_macos "apple" if build.with? "foo"
uses_from_macos "bar" uses_from_macos "bar"
^^^^^^^^^^^^^^^^^^^^^ dependency "bar" (line 6) should be put before dependency "apple" (line 5) ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 6) should be put before dependency "apple" (line 5)
uses_from_macos "foo" => :optional uses_from_macos "foo" => :optional
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 7) should be put before dependency "apple" (line 5) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 7) should be put before dependency "apple" (line 5)
end end
uses_from_macos "apple" if build.with? "foo" uses_from_macos "apple" if build.with? "foo"
uses_from_macos "foo" => :optional uses_from_macos "foo" => :optional
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 10) should be put before dependency "apple" (line 9) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 10) should be put before dependency "apple" (line 9)
end end
RUBY RUBY
@ -123,9 +123,9 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do
on_arm do on_arm do
uses_from_macos "apple" if build.with? "foo" uses_from_macos "apple" if build.with? "foo"
uses_from_macos "bar" uses_from_macos "bar"
^^^^^^^^^^^^^^^^^^^^^ dependency "bar" (line 6) should be put before dependency "apple" (line 5) ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 6) should be put before dependency "apple" (line 5)
uses_from_macos "foo" => :optional uses_from_macos "foo" => :optional
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 7) should be put before dependency "apple" (line 5) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 7) should be put before dependency "apple" (line 5)
end end
end end
RUBY RUBY
@ -152,7 +152,7 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
depends_on "apple" if build.with? "foo" depends_on "apple" if build.with? "foo"
depends_on "foo" => :optional depends_on "foo" => :optional
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 5) should be put before dependency "apple" (line 4) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 5) should be put before dependency "apple" (line 4)
end end
RUBY RUBY
@ -173,7 +173,7 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
depends_on "foo" depends_on "foo"
depends_on "bar" depends_on "bar"
^^^^^^^^^^^^^^^^ dependency "bar" (line 5) should be put before dependency "foo" (line 4) ^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 5) should be put before dependency "foo" (line 4)
end end
RUBY RUBY
@ -194,7 +194,7 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
depends_on FooRequirement depends_on FooRequirement
depends_on "bar" depends_on "bar"
^^^^^^^^^^^^^^^^ dependency "bar" (line 5) should be put before dependency "FooRequirement" (line 4) ^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 5) should be put before dependency "FooRequirement" (line 4)
end end
RUBY RUBY
@ -216,13 +216,13 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do
head do head do
depends_on "apple" if build.with? "foo" depends_on "apple" if build.with? "foo"
depends_on "bar" depends_on "bar"
^^^^^^^^^^^^^^^^ dependency "bar" (line 6) should be put before dependency "apple" (line 5) ^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 6) should be put before dependency "apple" (line 5)
depends_on "foo" => :optional depends_on "foo" => :optional
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 7) should be put before dependency "apple" (line 5) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 7) should be put before dependency "apple" (line 5)
end end
depends_on "apple" if build.with? "foo" depends_on "apple" if build.with? "foo"
depends_on "foo" => :optional depends_on "foo" => :optional
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 10) should be put before dependency "apple" (line 9) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 10) should be put before dependency "apple" (line 9)
end end
RUBY RUBY
@ -261,9 +261,9 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do
on_linux do on_linux do
depends_on "apple" if build.with? "foo" depends_on "apple" if build.with? "foo"
depends_on "bar" depends_on "bar"
^^^^^^^^^^^^^^^^ dependency "bar" (line 6) should be put before dependency "apple" (line 5) ^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 6) should be put before dependency "apple" (line 5)
depends_on "foo" => :optional depends_on "foo" => :optional
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 7) should be put before dependency "apple" (line 5) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 7) should be put before dependency "apple" (line 5)
end end
end end
RUBY RUBY

View File

@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableDate do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
deprecate! date: "June 25, 2020" deprecate! date: "June 25, 2020"
^^^^^^^^^^^^^^^ Use `2020-06-25` to comply with ISO 8601 ^^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableDate: Use `2020-06-25` to comply with ISO 8601
end end
RUBY RUBY
@ -29,7 +29,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableDate do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
deprecate! because: "is broken", date: "June 25, 2020" deprecate! because: "is broken", date: "June 25, 2020"
^^^^^^^^^^^^^^^ Use `2020-06-25` to comply with ISO 8601 ^^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableDate: Use `2020-06-25` to comply with ISO 8601
end end
RUBY RUBY
@ -84,7 +84,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableDate do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
disable! date: "June 25, 2020" disable! date: "June 25, 2020"
^^^^^^^^^^^^^^^ Use `2020-06-25` to comply with ISO 8601 ^^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableDate: Use `2020-06-25` to comply with ISO 8601
end end
RUBY RUBY
@ -101,7 +101,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableDate do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
disable! because: "is broken", date: "June 25, 2020" disable! because: "is broken", date: "June 25, 2020"
^^^^^^^^^^^^^^^ Use `2020-06-25` to comply with ISO 8601 ^^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableDate: Use `2020-06-25` to comply with ISO 8601
end end
RUBY RUBY

View File

@ -48,7 +48,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
deprecate! deprecate!
^^^^^^^^^^ Add a reason for deprecation: `deprecate! because: "..."` ^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Add a reason for deprecation: `deprecate! because: "..."`
end end
RUBY RUBY
end end
@ -58,7 +58,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
deprecate! date: "2020-08-28" deprecate! date: "2020-08-28"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Add a reason for deprecation: `deprecate! because: "..."` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Add a reason for deprecation: `deprecate! because: "..."`
end end
RUBY RUBY
end end
@ -68,7 +68,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
deprecate! because: "it is broken" deprecate! because: "it is broken"
^^^^^^^^^^^^^^ Do not start the reason with `it` ^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not start the reason with `it`
end end
RUBY RUBY
@ -85,7 +85,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
deprecate! date: "2020-08-28", because: "it is broken" deprecate! date: "2020-08-28", because: "it is broken"
^^^^^^^^^^^^^^ Do not start the reason with `it` ^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not start the reason with `it`
end end
RUBY RUBY
@ -102,7 +102,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
deprecate! because: "is broken." deprecate! because: "is broken."
^^^^^^^^^^^^ Do not end the reason with a punctuation mark ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark
end end
RUBY RUBY
@ -119,7 +119,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
deprecate! because: "is broken!" deprecate! because: "is broken!"
^^^^^^^^^^^^ Do not end the reason with a punctuation mark ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark
end end
RUBY RUBY
@ -136,7 +136,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
deprecate! because: "is broken?" deprecate! because: "is broken?"
^^^^^^^^^^^^ Do not end the reason with a punctuation mark ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark
end end
RUBY RUBY
@ -153,7 +153,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
deprecate! date: "2020-08-28", because: "is broken." deprecate! date: "2020-08-28", because: "is broken."
^^^^^^^^^^^^ Do not end the reason with a punctuation mark ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark
end end
RUBY RUBY
@ -208,7 +208,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
disable! disable!
^^^^^^^^ Add a reason for disabling: `disable! because: "..."` ^^^^^^^^ FormulaAudit/DeprecateDisableReason: Add a reason for disabling: `disable! because: "..."`
end end
RUBY RUBY
end end
@ -218,7 +218,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
disable! date: "2020-08-28" disable! date: "2020-08-28"
^^^^^^^^^^^^^^^^^^^^^^^^^^^ Add a reason for disabling: `disable! because: "..."` ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Add a reason for disabling: `disable! because: "..."`
end end
RUBY RUBY
end end
@ -228,7 +228,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
disable! because: "it is broken" disable! because: "it is broken"
^^^^^^^^^^^^^^ Do not start the reason with `it` ^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not start the reason with `it`
end end
RUBY RUBY
@ -245,7 +245,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
disable! date: "2020-08-28", because: "it is broken" disable! date: "2020-08-28", because: "it is broken"
^^^^^^^^^^^^^^ Do not start the reason with `it` ^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not start the reason with `it`
end end
RUBY RUBY
@ -262,7 +262,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
disable! because: "is broken." disable! because: "is broken."
^^^^^^^^^^^^ Do not end the reason with a punctuation mark ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark
end end
RUBY RUBY
@ -279,7 +279,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
disable! because: "is broken!" disable! because: "is broken!"
^^^^^^^^^^^^ Do not end the reason with a punctuation mark ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark
end end
RUBY RUBY
@ -296,7 +296,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
disable! because: "is broken?" disable! because: "is broken?"
^^^^^^^^^^^^ Do not end the reason with a punctuation mark ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark
end end
RUBY RUBY
@ -313,7 +313,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
disable! date: "2020-08-28", because: "is broken." disable! date: "2020-08-28", because: "is broken."
^^^^^^^^^^^^ Do not end the reason with a punctuation mark ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark
end end
RUBY RUBY

View File

@ -10,7 +10,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
it "reports an offense when there is no `desc`" do it "reports an offense when there is no `desc`" do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
^^^^^^^^^^^^^^^^^^^ Formula should have a desc (Description). ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Desc: Formula should have a desc (Description).
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
end end
RUBY RUBY
@ -21,7 +21,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc '' desc ''
^^^^^^^ The desc (description) should not be an empty string. ^^^^^^^ FormulaAudit/Desc: The desc (description) should not be an empty string.
end end
RUBY RUBY
end end
@ -31,7 +31,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc 'Bar#{"bar" * 29}' desc 'Bar#{"bar" * 29}'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Description is too long. It should be less than 80 characters. The current length is 90. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Desc: Description is too long. It should be less than 80 characters. The current length is 90.
end end
RUBY RUBY
end end
@ -42,7 +42,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc 'Bar#{"bar" * 9}'\ desc 'Bar#{"bar" * 9}'\
'#{"foo" * 21}' '#{"foo" * 21}'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Description is too long. It should be less than 80 characters. The current length is 93. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Desc: Description is too long. It should be less than 80 characters. The current length is 93.
end end
RUBY RUBY
end end
@ -54,7 +54,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc ' Description with a leading space' desc ' Description with a leading space'
^ Description shouldn't have leading spaces. ^ FormulaAudit/Desc: Description shouldn't have leading spaces.
end end
RUBY RUBY
end end
@ -64,7 +64,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc 'Description with a trailing space ' desc 'Description with a trailing space '
^ Description shouldn't have trailing spaces. ^ FormulaAudit/Desc: Description shouldn't have trailing spaces.
end end
RUBY RUBY
end end
@ -74,8 +74,8 @@ describe RuboCop::Cop::FormulaAudit::Desc do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc 'command line' desc 'command line'
^ Description should start with a capital letter. ^ FormulaAudit/Desc: Description should start with a capital letter.
^^^^^^^^^^^^ Description should use "command-line" instead of "command line". ^^^^^^^^^^^^ FormulaAudit/Desc: Description should use "command-line" instead of "command line".
end end
RUBY RUBY
end end
@ -85,7 +85,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc 'An aardvark' desc 'An aardvark'
^^ Description shouldn't start with an article. ^^ FormulaAudit/Desc: Description shouldn't start with an article.
end end
RUBY RUBY
@ -93,7 +93,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc 'The aardvark' desc 'The aardvark'
^^^ Description shouldn't start with an article. ^^^ FormulaAudit/Desc: Description shouldn't start with an article.
end end
RUBY RUBY
end end
@ -103,7 +103,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc 'bar' desc 'bar'
^ Description should start with a capital letter. ^ FormulaAudit/Desc: Description should start with a capital letter.
end end
RUBY RUBY
end end
@ -113,7 +113,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc 'Foo is a foobar' desc 'Foo is a foobar'
^^^ Description shouldn't start with the formula name. ^^^ FormulaAudit/Desc: Description shouldn't start with the formula name.
end end
RUBY RUBY
end end
@ -123,7 +123,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc 'Description with a full stop at the end.' desc 'Description with a full stop at the end.'
^ Description shouldn't end with a full stop. ^ FormulaAudit/Desc: Description shouldn't end with a full stop.
end end
RUBY RUBY
@ -149,9 +149,9 @@ describe RuboCop::Cop::FormulaAudit::Desc do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc ' an bar: commandline foo ' desc ' an bar: commandline foo '
^ Description shouldn't have trailing spaces. ^ FormulaAudit/Desc: Description shouldn't have trailing spaces.
^^^^^^^^^^^ Description should use "command-line" instead of "commandline". ^^^^^^^^^^^ FormulaAudit/Desc: Description should use "command-line" instead of "commandline".
^ Description shouldn't have leading spaces. ^ FormulaAudit/Desc: Description shouldn't have leading spaces.
end end
RUBY RUBY

View File

@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::Files do
expect_offense(<<~RUBY, file) expect_offense(<<~RUBY, file)
class Foo < Formula class Foo < Formula
^^^^^^^^^^^^^^^^^^^ Incorrect file permissions (000): chmod +r #{filename} ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Files: Incorrect file permissions (000): chmod +r #{filename}
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
end end
RUBY RUBY

View File

@ -10,7 +10,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
it "reports an offense when there is no homepage" do it "reports an offense when there is no homepage" do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
^^^^^^^^^^^^^^^^^^^ Formula should have a homepage. ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Formula should have a homepage.
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
end end
RUBY RUBY
@ -20,7 +20,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
homepage "ftp://brew.sh/foo" homepage "ftp://brew.sh/foo"
^^^^^^^^^^^^^^^^^^^ The homepage should start with http or https. ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: The homepage should start with http or https.
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
end end
RUBY RUBY
@ -30,7 +30,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
homepage "http://www.freedesktop.org/wiki/bar" homepage "http://www.freedesktop.org/wiki/bar"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Freedesktop homepages should be styled `https://wiki.freedesktop.org/project_name` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Freedesktop homepages should be styled `https://wiki.freedesktop.org/project_name`
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
end end
RUBY RUBY
@ -40,7 +40,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
homepage "http://www.freedesktop.org/wiki/Software/baz" homepage "http://www.freedesktop.org/wiki/Software/baz"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Freedesktop homepages should be styled `https://wiki.freedesktop.org/www/Software/project_name` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Freedesktop homepages should be styled `https://wiki.freedesktop.org/www/Software/project_name`
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
end end
RUBY RUBY
@ -50,7 +50,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
homepage "https://code.google.com/p/qux" homepage "https://code.google.com/p/qux"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Google Code homepages should end with a slash ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Google Code homepages should end with a slash
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
end end
RUBY RUBY
@ -67,7 +67,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
homepage "https://github.com/foo/bar.git" homepage "https://github.com/foo/bar.git"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ GitHub homepages should not end with .git ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: GitHub homepages should not end with .git
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
end end
RUBY RUBY
@ -92,7 +92,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
homepage "http://foo.sourceforge.net/" homepage "http://foo.sourceforge.net/"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sourceforge homepages should be `https://foo.sourceforge.io/` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Sourceforge homepages should be `https://foo.sourceforge.io/`
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
end end
RUBY RUBY
@ -104,7 +104,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
homepage "http://foo.sourceforge.net" homepage "http://foo.sourceforge.net"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sourceforge homepages should be `https://foo.sourceforge.io/` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Sourceforge homepages should be `https://foo.sourceforge.io/`
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
end end
RUBY RUBY
@ -116,7 +116,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
homepage "http://foo.sf.net/" homepage "http://foo.sf.net/"
^^^^^^^^^^^^^^^^^^^^ Sourceforge homepages should be `https://foo.sourceforge.io/` ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Sourceforge homepages should be `https://foo.sourceforge.io/`
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
end end
RUBY RUBY
@ -129,7 +129,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
homepage "https://foo.readthedocs.org" homepage "https://foo.readthedocs.org"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Readthedocs homepages should be `https://foo.readthedocs.io` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Readthedocs homepages should be `https://foo.readthedocs.io`
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
end end
RUBY RUBY
@ -160,7 +160,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
end end
RUBY RUBY
expected_offenses = [{ message: "Please use https:// for #{homepage}", expected_offenses = [{ message: "FormulaAudit/Homepage: Please use https:// for #{homepage}",
severity: :convention, severity: :convention,
line: 2, line: 2,
column: 11, column: 11,

View File

@ -9,7 +9,7 @@ describe RuboCop::Cop::Homebrew::IORead do
it "reports an offense when `IO.read` is used with a pipe character" do it "reports an offense when `IO.read` is used with a pipe character" do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
IO.read("|echo test") IO.read("|echo test")
^^^^^^^^^^^^^^^^^^^^^ The use of `IO.read` is a security risk. ^^^^^^^^^^^^^^^^^^^^^ Homebrew/IORead: The use of `IO.read` is a security risk.
RUBY RUBY
end end
@ -23,7 +23,7 @@ describe RuboCop::Cop::Homebrew::IORead do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
input = "input value from an unknown source" input = "input value from an unknown source"
IO.read(input) IO.read(input)
^^^^^^^^^^^^^^ The use of `IO.read` is a security risk. ^^^^^^^^^^^^^^ Homebrew/IORead: The use of `IO.read` is a security risk.
RUBY RUBY
end end
@ -31,7 +31,7 @@ describe RuboCop::Cop::Homebrew::IORead do
expect_offense(<<~'RUBY') expect_offense(<<~'RUBY')
input = "test" input = "test"
IO.read("|echo #{input}") IO.read("|echo #{input}")
^^^^^^^^^^^^^^^^^^^^^^^^^ The use of `IO.read` is a security risk. ^^^^^^^^^^^^^^^^^^^^^^^^^ Homebrew/IORead: The use of `IO.read` is a security risk.
RUBY RUBY
end end
@ -39,7 +39,7 @@ describe RuboCop::Cop::Homebrew::IORead do
expect_offense(<<~'RUBY') expect_offense(<<~'RUBY')
input = "|echo test" input = "|echo test"
IO.read("#{input}.txt") IO.read("#{input}.txt")
^^^^^^^^^^^^^^^^^^^^^^^ The use of `IO.read` is a security risk. ^^^^^^^^^^^^^^^^^^^^^^^ Homebrew/IORead: The use of `IO.read` is a security risk.
RUBY RUBY
end end
@ -54,7 +54,7 @@ describe RuboCop::Cop::Homebrew::IORead do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
input = "|echo test" input = "|echo test"
IO.read("|echo " + input) IO.read("|echo " + input)
^^^^^^^^^^^^^^^^^^^^^^^^^ The use of `IO.read` is a security risk. ^^^^^^^^^^^^^^^^^^^^^^^^^ Homebrew/IORead: The use of `IO.read` is a security risk.
RUBY RUBY
end end
@ -62,7 +62,7 @@ describe RuboCop::Cop::Homebrew::IORead do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
input = "|echo test" input = "|echo test"
IO.read(input + ".txt") IO.read(input + ".txt")
^^^^^^^^^^^^^^^^^^^^^^^ The use of `IO.read` is a security risk. ^^^^^^^^^^^^^^^^^^^^^^^ Homebrew/IORead: The use of `IO.read` is a security risk.
RUBY RUBY
end end

View File

@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::KegOnly do
homepage "https://brew.sh" homepage "https://brew.sh"
keg_only "Because why not" keg_only "Because why not"
^^^^^^^^^^^^^^^^^ 'Because' from the `keg_only` reason should be 'because'. ^^^^^^^^^^^^^^^^^ FormulaAudit/KegOnly: 'Because' from the `keg_only` reason should be 'because'.
end end
RUBY RUBY
@ -36,7 +36,7 @@ describe RuboCop::Cop::FormulaAudit::KegOnly do
homepage "https://brew.sh" homepage "https://brew.sh"
keg_only "ending with a period." keg_only "ending with a period."
^^^^^^^^^^^^^^^^^^^^^^^ `keg_only` reason should not end with a period. ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/KegOnly: `keg_only` reason should not end with a period.
end end
RUBY RUBY

View File

@ -10,7 +10,7 @@ describe RuboCop::Cop::FormulaAudit::ClassInheritance do
it "reports an offense when not using spaces for class inheritance" do it "reports an offense when not using spaces for class inheritance" do
expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb") expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
class Foo<Formula class Foo<Formula
^^^^^^^ Use a space in class inheritance: class Foo < Formula ^^^^^^^ FormulaAudit/ClassInheritance: Use a space in class inheritance: class Foo < Formula
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
end end

View File

@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit do
def install def install
(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "bash") (bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "bash")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `generate_completions_from_executable(bin/"foo", "completions", shells: [:bash])` instead of `(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "bash")`. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/GenerateCompletionsDSL: Use `generate_completions_from_executable(bin/"foo", "completions", shells: [:bash])` instead of `(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "bash")`.
end end
end end
RUBY RUBY
@ -37,7 +37,7 @@ describe RuboCop::Cop::FormulaAudit do
def install def install
(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "bash") (bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "bash")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `generate_completions_from_executable(bin/"foo", "completions", base_name: "foo", shells: [:bash])` instead of `(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "bash")`. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/GenerateCompletionsDSL: Use `generate_completions_from_executable(bin/"foo", "completions", base_name: "foo", shells: [:bash])` instead of `(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "bash")`.
end end
end end
RUBY RUBY
@ -60,7 +60,7 @@ describe RuboCop::Cop::FormulaAudit do
def install def install
(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "--shell=bash") (bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "--shell=bash")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `generate_completions_from_executable(bin/"foo", "completions", shells: [:bash], shell_parameter_format: :arg)` instead of `(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "--shell=bash")`. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/GenerateCompletionsDSL: Use `generate_completions_from_executable(bin/"foo", "completions", shells: [:bash], shell_parameter_format: :arg)` instead of `(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "--shell=bash")`.
end end
end end
RUBY RUBY
@ -83,7 +83,7 @@ describe RuboCop::Cop::FormulaAudit do
def install def install
(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "--completion-script-bash") (bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "--completion-script-bash")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `generate_completions_from_executable(bin/"foo", "completions", shells: [:bash], shell_parameter_format: "--completion-script-")` instead of `(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "--completion-script-bash")`. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/GenerateCompletionsDSL: Use `generate_completions_from_executable(bin/"foo", "completions", shells: [:bash], shell_parameter_format: "--completion-script-")` instead of `(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "--completion-script-bash")`.
end end
end end
RUBY RUBY
@ -107,7 +107,7 @@ describe RuboCop::Cop::FormulaAudit do
def install def install
output = Utils.safe_popen_read(bin/"foo", "completions", "bash") output = Utils.safe_popen_read(bin/"foo", "completions", "bash")
(bash_completion/"foo").write output (bash_completion/"foo").write output
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `generate_completions_from_executable` DSL instead of `(bash_completion/"foo").write output`. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/GenerateCompletionsDSL: Use `generate_completions_from_executable` DSL instead of `(bash_completion/"foo").write output`.
end end
end end
RUBY RUBY
@ -124,11 +124,11 @@ describe RuboCop::Cop::FormulaAudit do
def install def install
generate_completions_from_executable(bin/"foo", "completions", shells: [:bash]) generate_completions_from_executable(bin/"foo", "completions", shells: [:bash])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use a single `generate_completions_from_executable` call combining all specified shells. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/SingleGenerateCompletionsDSLCall: Use a single `generate_completions_from_executable` call combining all specified shells.
generate_completions_from_executable(bin/"foo", "completions", shells: [:zsh]) generate_completions_from_executable(bin/"foo", "completions", shells: [:zsh])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use a single `generate_completions_from_executable` call combining all specified shells. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/SingleGenerateCompletionsDSLCall: Use a single `generate_completions_from_executable` call combining all specified shells.
generate_completions_from_executable(bin/"foo", "completions", shells: [:fish]) generate_completions_from_executable(bin/"foo", "completions", shells: [:fish])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `generate_completions_from_executable(bin/"foo", "completions")` instead of `generate_completions_from_executable(bin/"foo", "completions", shells: [:fish])`. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/SingleGenerateCompletionsDSLCall: Use `generate_completions_from_executable(bin/"foo", "completions")` instead of `generate_completions_from_executable(bin/"foo", "completions", shells: [:fish])`.
end end
end end
RUBY RUBY

View File

@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on :automake depends_on :automake
^^^^^^^^^^^^^^^^^^^^ :automake is deprecated. Usage should be "automake". ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Lines: :automake is deprecated. Usage should be "automake".
end end
RUBY RUBY
end end
@ -22,7 +22,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on :autoconf depends_on :autoconf
^^^^^^^^^^^^^^^^^^^^ :autoconf is deprecated. Usage should be "autoconf". ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Lines: :autoconf is deprecated. Usage should be "autoconf".
end end
RUBY RUBY
end end
@ -32,7 +32,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on :libtool depends_on :libtool
^^^^^^^^^^^^^^^^^^^ :libtool is deprecated. Usage should be "libtool". ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Lines: :libtool is deprecated. Usage should be "libtool".
end end
RUBY RUBY
end end
@ -42,7 +42,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on :apr depends_on :apr
^^^^^^^^^^^^^^^ :apr is deprecated. Usage should be "apr-util". ^^^^^^^^^^^^^^^ FormulaAudit/Lines: :apr is deprecated. Usage should be "apr-util".
end end
RUBY RUBY
end end
@ -52,7 +52,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on :tex depends_on :tex
^^^^^^^^^^^^^^^ :tex is deprecated. ^^^^^^^^^^^^^^^ FormulaAudit/Lines: :tex is deprecated.
end end
RUBY RUBY
end end

View File

@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::LivecheckRegexCaseInsensitive do
livecheck do livecheck do
url :stable url :stable
regex(%r{href=.*?/formula[._-]v?(\\d+(?:\\.\\d+)+)\\.t}) regex(%r{href=.*?/formula[._-]v?(\\d+(?:\\.\\d+)+)\\.t})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Regexes should be case-insensitive unless sensitivity is explicitly required for proper matching. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/LivecheckRegexCaseInsensitive: Regexes should be case-insensitive unless sensitivity is explicitly required for proper matching.
end end
end end
RUBY RUBY

View File

@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::LivecheckRegexExtension do
livecheck do livecheck do
url :stable url :stable
regex(%r{href=.*?/formula[._-]v?(\\d+(?:\\.\\d+)+)\\.tgz}i) regex(%r{href=.*?/formula[._-]v?(\\d+(?:\\.\\d+)+)\\.tgz}i)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `\\.t` instead of `\\.tgz` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/LivecheckRegexExtension: Use `\\.t` instead of `\\.tgz`
end end
end end
RUBY RUBY

View File

@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::LivecheckRegexIfPageMatch do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
livecheck do livecheck do
^^^^^^^^^^^^ A `regex` is required if `strategy :page_match` is present. ^^^^^^^^^^^^ FormulaAudit/LivecheckRegexIfPageMatch: A `regex` is required if `strategy :page_match` is present.
url :stable url :stable
strategy :page_match strategy :page_match
end end

View File

@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::LivecheckRegexParentheses do
livecheck do livecheck do
url :stable url :stable
regex %r{href=.*?/formula[._-]v?(\\d+(?:\\.\\d+)+)\\.t}i regex %r{href=.*?/formula[._-]v?(\\d+(?:\\.\\d+)+)\\.t}i
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The `regex` call should always use parentheses. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/LivecheckRegexParentheses: The `regex` call should always use parentheses.
end end
end end
RUBY RUBY

View File

@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::LivecheckSkip do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
livecheck do livecheck do
^^^^^^^^^^^^ Skipped formulae must not contain other livecheck information. ^^^^^^^^^^^^ FormulaAudit/LivecheckSkip: Skipped formulae must not contain other livecheck information.
skip "Not maintained" skip "Not maintained"
url :stable url :stable
end end

View File

@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::LivecheckUrlProvided do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
livecheck do livecheck do
^^^^^^^^^^^^ A `url` must be provided to livecheck. ^^^^^^^^^^^^ FormulaAudit/LivecheckUrlProvided: A `url` must be provided to livecheck.
regex(%r{href=.*?/formula[._-]v?(\\d+(?:\\.\\d+)+)\\.t}i) regex(%r{href=.*?/formula[._-]v?(\\d+(?:\\.\\d+)+)\\.t}i)
end end
end end

View File

@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::LivecheckUrlSymbol do
livecheck do livecheck do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `url :stable` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/LivecheckUrlSymbol: Use `url :stable`
end end
end end
RUBY RUBY

View File

@ -9,14 +9,14 @@ describe RuboCop::Cop::Homebrew::MoveToExtendOS do
it "registers an offense when using `OS.linux?`" do it "registers an offense when using `OS.linux?`" do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
OS.linux? OS.linux?
^^^^^^^^^ Move `OS.linux?` and `OS.mac?` calls to `extend/os`. ^^^^^^^^^ Homebrew/MoveToExtendOS: Move `OS.linux?` and `OS.mac?` calls to `extend/os`.
RUBY RUBY
end end
it "registers an offense when using `OS.mac?`" do it "registers an offense when using `OS.mac?`" do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
OS.mac? OS.mac?
^^^^^^^ Move `OS.linux?` and `OS.mac?` calls to `extend/os`. ^^^^^^^ Homebrew/MoveToExtendOS: Move `OS.linux?` and `OS.mac?` calls to `extend/os`.
RUBY RUBY
end end
end end

View File

@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::Options do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
option "with-32-bit" option "with-32-bit"
^^^^^^^^^^^^^ macOS has been 64-bit only since 10.6 so 32-bit options are deprecated. ^^^^^^^^^^^^^ FormulaAudit/Options: macOS has been 64-bit only since 10.6 so 32-bit options are deprecated.
end end
RUBY RUBY
end end
@ -22,7 +22,7 @@ describe RuboCop::Cop::FormulaAudit::Options do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
option :universal option :universal
^^^^^^^^^^^^^^^^^ macOS has been 64-bit only since 10.6 so universal options are deprecated. ^^^^^^^^^^^^^^^^^ FormulaAudit/Options: macOS has been 64-bit only since 10.6 so universal options are deprecated.
end end
RUBY RUBY
end end
@ -33,7 +33,7 @@ describe RuboCop::Cop::FormulaAudit::Options do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
option :cxx11 option :cxx11
option "examples", "with-examples" option "examples", "with-examples"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Options should begin with with/without. Migrate '--examples' with `deprecated_option`. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Options: Options should begin with with/without. Migrate '--examples' with `deprecated_option`.
end end
RUBY RUBY
end end
@ -43,7 +43,7 @@ describe RuboCop::Cop::FormulaAudit::Options do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
option "without-check" option "without-check"
^^^^^^^^^^^^^^^^^^^^^^ Use '--without-test' instead of '--without-check'. Migrate '--without-check' with `deprecated_option`. ^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Options: Use '--without-test' instead of '--without-check'. Migrate '--without-check' with `deprecated_option`.
end end
RUBY RUBY
end end
@ -53,7 +53,7 @@ describe RuboCop::Cop::FormulaAudit::Options do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
deprecated_option "examples" => "with-examples" deprecated_option "examples" => "with-examples"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `deprecated_option`. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Options: Formulae in homebrew/core should not use `deprecated_option`.
end end
RUBY RUBY
end end
@ -63,7 +63,7 @@ describe RuboCop::Cop::FormulaAudit::Options do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
option "with-examples" option "with-examples"
^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `option`. ^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Options: Formulae in homebrew/core should not use `option`.
end end
RUBY RUBY
end end

View File

@ -25,7 +25,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do
homepage "ftp://brew.sh/foo" homepage "ftp://brew.sh/foo"
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
def patches def patches
^^^^^^^^^^^ Use the patch DSL instead of defining a 'patches' method ^^^^^^^^^^^ FormulaAudit/Patches: Use the patch DSL instead of defining a 'patches' method
DATA DATA
end end
end end
@ -54,28 +54,29 @@ describe RuboCop::Cop::FormulaAudit::Patches do
expected_offense = if patch_url.include?("/raw.github.com/") expected_offense = if patch_url.include?("/raw.github.com/")
expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source
GitHub/Gist patches should specify a revision: #{patch_url} FormulaAudit/Patches: GitHub/Gist patches should specify a revision: #{patch_url}
EOS EOS
elsif patch_url.include?("macports/trunk") elsif patch_url.include?("macports/trunk")
expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source
MacPorts patches should specify a revision instead of trunk: #{patch_url} FormulaAudit/Patches: MacPorts patches should specify a revision instead of trunk: #{patch_url}
EOS EOS
elsif patch_url.start_with?("http://trac.macports.org/") elsif patch_url.start_with?("http://trac.macports.org/")
expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source
Patches from MacPorts Trac should be https://, not http: #{patch_url} FormulaAudit/Patches: Patches from MacPorts Trac should be https://, not http: #{patch_url}
EOS EOS
elsif patch_url.start_with?("http://bugs.debian.org/") elsif patch_url.start_with?("http://bugs.debian.org/")
expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source
Patches from Debian should be https://, not http: #{patch_url} FormulaAudit/Patches: Patches from Debian should be https://, not http: #{patch_url}
EOS EOS
# rubocop:disable Layout/LineLength # rubocop:disable Layout/LineLength
elsif patch_url.match?(%r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)}) elsif patch_url.match?(%r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)})
# rubocop:enable Layout/LineLength # rubocop:enable Layout/LineLength
expect_offense_hash message: "Use a commit hash URL rather than patch-diff: #{patch_url}", expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source
severity: :convention, line: 5, column: 4, source: source FormulaAudit/Patches: Use a commit hash URL rather than patch-diff: #{patch_url}
EOS
elsif patch_url.match?(%r{https?://github\.com/.+/.+/(?:commit|pull)/[a-fA-F0-9]*.(?:patch|diff)}) elsif patch_url.match?(%r{https?://github\.com/.+/.+/(?:commit|pull)/[a-fA-F0-9]*.(?:patch|diff)})
expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source
GitHub patches should use the full_index parameter: #{patch_url}?full_index=1 FormulaAudit/Patches: GitHub patches should use the full_index parameter: #{patch_url}?full_index=1
EOS EOS
end end
expected_offense.zip([inspect_source(source).last]).each do |expected, actual| expected_offense.zip([inspect_source(source).last]).each do |expected, actual|
@ -102,17 +103,22 @@ describe RuboCop::Cop::FormulaAudit::Patches do
end end
RUBY RUBY
expected_offenses = [{ message: "Use the patch DSL instead of defining a 'patches' method", expected_offenses = [
severity: :convention, {
line: 4, message: "FormulaAudit/Patches: Use the patch DSL instead of defining a 'patches' method",
column: 2, severity: :convention,
source: source }, line: 4,
{ message: "Patches from MacPorts Trac should be https://, not http: " \ column: 2,
"http://trac.macports.org/export/68507/trunk/dports/net/trafshow/files/", source: source,
severity: :convention, }, {
line: 8, message: "FormulaAudit/Patches: Patches from MacPorts Trac should be https://, not http: " \
column: 25, "http://trac.macports.org/export/68507/trunk/dports/net/trafshow/files/",
source: source }] severity: :convention,
line: 8,
column: 25,
source: source,
}
]
expected_offenses.zip(inspect_source(source)).each do |expected, actual| expected_offenses.zip(inspect_source(source)).each do |expected, actual|
expect(actual.message).to eq(expected[:message]) expect(actual.message).to eq(expected[:message])
@ -153,7 +159,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
patch :DATA patch :DATA
^^^^^^^^^^^ patch is missing '__END__' ^^^^^^^^^^^ FormulaAudit/Patches: patch is missing '__END__'
end end
RUBY RUBY
end end
@ -164,7 +170,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
end end
__END__ __END__
^^^^^^^ patch is missing 'DATA' ^^^^^^^ FormulaAudit/Patches: patch is missing 'DATA'
patch content here patch content here
RUBY RUBY
end end
@ -197,41 +203,42 @@ describe RuboCop::Cop::FormulaAudit::Patches do
expected_offense = if patch_url.include?("/raw.github.com/") expected_offense = if patch_url.include?("/raw.github.com/")
expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
GitHub/Gist patches should specify a revision: #{patch_url} FormulaAudit/Patches: GitHub/Gist patches should specify a revision: #{patch_url}
EOS EOS
elsif patch_url.include?("macports/trunk") elsif patch_url.include?("macports/trunk")
expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
MacPorts patches should specify a revision instead of trunk: #{patch_url} FormulaAudit/Patches: MacPorts patches should specify a revision instead of trunk: #{patch_url}
EOS EOS
elsif patch_url.start_with?("http://trac.macports.org/") elsif patch_url.start_with?("http://trac.macports.org/")
expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
Patches from MacPorts Trac should be https://, not http: #{patch_url} FormulaAudit/Patches: Patches from MacPorts Trac should be https://, not http: #{patch_url}
EOS EOS
elsif patch_url.start_with?("http://bugs.debian.org/") elsif patch_url.start_with?("http://bugs.debian.org/")
expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
Patches from Debian should be https://, not http: #{patch_url} FormulaAudit/Patches: Patches from Debian should be https://, not http: #{patch_url}
EOS EOS
elsif patch_url.match?(%r{https://github.com/[^/]*/[^/]*/pull}) elsif patch_url.match?(%r{https://github.com/[^/]*/[^/]*/pull})
expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
Use a commit hash URL rather than an unstable pull request URL: #{patch_url} FormulaAudit/Patches: Use a commit hash URL rather than an unstable pull request URL: #{patch_url}
EOS EOS
elsif patch_url.match?(%r{.*gitlab.*/merge_request.*}) elsif patch_url.match?(%r{.*gitlab.*/merge_request.*})
expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
Use a commit hash URL rather than an unstable merge request URL: #{patch_url} FormulaAudit/Patches: Use a commit hash URL rather than an unstable merge request URL: #{patch_url}
EOS EOS
elsif patch_url.match?(%r{https://github.com/[^/]*/[^/]*/commit/}) elsif patch_url.match?(%r{https://github.com/[^/]*/[^/]*/commit/})
expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
GitHub patches should end with .patch, not .diff: #{patch_url} FormulaAudit/Patches: GitHub patches should end with .patch, not .diff: #{patch_url}
EOS EOS
elsif patch_url.match?(%r{.*gitlab.*/commit/}) elsif patch_url.match?(%r{.*gitlab.*/commit/})
expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
GitLab patches should end with .diff, not .patch: #{patch_url} FormulaAudit/Patches: GitLab patches should end with .diff, not .patch: #{patch_url}
EOS EOS
# rubocop:disable Layout/LineLength # rubocop:disable Layout/LineLength
elsif patch_url.match?(%r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)}) elsif patch_url.match?(%r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)})
# rubocop:enable Layout/LineLength # rubocop:enable Layout/LineLength
expect_offense_hash message: "Use a commit hash URL rather than patch-diff: #{patch_url}", expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source
severity: :convention, line: 5, column: 8, source: source FormulaAudit/Patches: Use a commit hash URL rather than patch-diff: #{patch_url}
EOS
end end
expected_offense.zip([inspect_source(source).last]).each do |expected, actual| expected_offense.zip([inspect_source(source).last]).each do |expected, actual|
expect(actual.message).to eq(expected[:message]) expect(actual.message).to eq(expected[:message])

View File

@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::ProvidedByMacos do
homepage "https://brew.sh" homepage "https://brew.sh"
keg_only :provided_by_macos keg_only :provided_by_macos
^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae that are `keg_only :provided_by_macos` should be added to the `PROVIDED_BY_MACOS_FORMULAE` list (in the Homebrew/brew repo) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ProvidedByMacos: Formulae that are `keg_only :provided_by_macos` should be added to the `PROVIDED_BY_MACOS_FORMULAE` list (in the Homebrew/brew repo)
end end
RUBY RUBY
end end

View File

@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::Service do
service do service do
run [bin/"foo", "run", "-config", etc/"foo/config.json"] run [bin/"foo", "run", "-config", etc/"foo/config.json"]
^^^ Use `opt_bin` instead of `bin` in service blocks. ^^^ FormulaAudit/Service: Use `opt_bin` instead of `bin` in service blocks.
end end
end end
RUBY RUBY

View File

@ -15,7 +15,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
system "foo bar" system "foo bar"
^^^^^^^^^ Separate `system` commands into `"foo", "bar"` ^^^^^^^^^ Homebrew/ShellCommands: Separate `system` commands into `"foo", "bar"`
end end
end end
RUBY RUBY
@ -34,7 +34,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
system "\#{bin}/foo bar" system "\#{bin}/foo bar"
^^^^^^^^^^^^^^^^ Separate `system` commands into `"\#{bin}/foo", "bar"` ^^^^^^^^^^^^^^^^ Homebrew/ShellCommands: Separate `system` commands into `"\#{bin}/foo", "bar"`
end end
end end
RUBY RUBY
@ -83,7 +83,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
Utils.popen_read("foo bar") Utils.popen_read("foo bar")
^^^^^^^^^ Separate `Utils.popen_read` commands into `"foo", "bar"` ^^^^^^^^^ Homebrew/ShellCommands: Separate `Utils.popen_read` commands into `"foo", "bar"`
end end
end end
RUBY RUBY
@ -102,7 +102,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
Utils.safe_popen_read("foo bar") Utils.safe_popen_read("foo bar")
^^^^^^^^^ Separate `Utils.safe_popen_read` commands into `"foo", "bar"` ^^^^^^^^^ Homebrew/ShellCommands: Separate `Utils.safe_popen_read` commands into `"foo", "bar"`
end end
end end
RUBY RUBY
@ -121,7 +121,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
Utils.popen_write("foo bar") Utils.popen_write("foo bar")
^^^^^^^^^ Separate `Utils.popen_write` commands into `"foo", "bar"` ^^^^^^^^^ Homebrew/ShellCommands: Separate `Utils.popen_write` commands into `"foo", "bar"`
end end
end end
RUBY RUBY
@ -140,7 +140,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
Utils.safe_popen_write("foo bar") Utils.safe_popen_write("foo bar")
^^^^^^^^^ Separate `Utils.safe_popen_write` commands into `"foo", "bar"` ^^^^^^^^^ Homebrew/ShellCommands: Separate `Utils.safe_popen_write` commands into `"foo", "bar"`
end end
end end
RUBY RUBY
@ -159,7 +159,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
Utils.popen_read("\#{bin}/foo bar") Utils.popen_read("\#{bin}/foo bar")
^^^^^^^^^^^^^^^^ Separate `Utils.popen_read` commands into `"\#{bin}/foo", "bar"` ^^^^^^^^^^^^^^^^ Homebrew/ShellCommands: Separate `Utils.popen_read` commands into `"\#{bin}/foo", "bar"`
end end
end end
RUBY RUBY
@ -198,7 +198,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
Utils.popen_read({ "SHELL" => "bash"}, "foo bar") Utils.popen_read({ "SHELL" => "bash"}, "foo bar")
^^^^^^^^^ Separate `Utils.popen_read` commands into `"foo", "bar"` ^^^^^^^^^ Homebrew/ShellCommands: Separate `Utils.popen_read` commands into `"foo", "bar"`
end end
end end
RUBY RUBY
@ -222,7 +222,7 @@ module RuboCop
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
fork do fork do
exec "foo bar > output" exec "foo bar > output"
^^^^^^^^^^^^^^^^^^ Don't use shell metacharacters in `exec`. Implement the logic in Ruby instead, using methods like `$stdout.reopen`. ^^^^^^^^^^^^^^^^^^ Homebrew/ExecShellMetacharacters: Don't use shell metacharacters in `exec`. Implement the logic in Ruby instead, using methods like `$stdout.reopen`.
end end
RUBY RUBY
end end

View File

@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::AssertStatements do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
assert File.read("inbox").include?("Sample message 1") assert File.read("inbox").include?("Sample message 1")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `assert_match` instead of `assert ...include?` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/AssertStatements: Use `assert_match` instead of `assert ...include?`
end end
RUBY RUBY
end end
@ -24,7 +24,7 @@ describe RuboCop::Cop::FormulaAudit::AssertStatements do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
assert File.exist? "default.ini" assert File.exist? "default.ini"
^^^^^^^^^^^^^^^^^^^^^^^^^ Use `assert_predicate <path_to_file>, :exist?` instead of `assert File.exist? "default.ini"` ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/AssertStatements: Use `assert_predicate <path_to_file>, :exist?` instead of `assert File.exist? "default.ini"`
end end
RUBY RUBY
end end
@ -35,7 +35,7 @@ describe RuboCop::Cop::FormulaAudit::AssertStatements do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
assert !File.exist?("default.ini") assert !File.exist?("default.ini")
^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `refute_predicate <path_to_file>, :exist?` instead of `assert !File.exist?("default.ini")` ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/AssertStatements: Use `refute_predicate <path_to_file>, :exist?` instead of `assert !File.exist?("default.ini")`
end end
RUBY RUBY
end end
@ -46,7 +46,7 @@ describe RuboCop::Cop::FormulaAudit::AssertStatements do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
assert File.executable? f assert File.executable? f
^^^^^^^^^^^^^^^^^^ Use `assert_predicate <path_to_file>, :executable?` instead of `assert File.executable? f` ^^^^^^^^^^^^^^^^^^ FormulaAudit/AssertStatements: Use `assert_predicate <path_to_file>, :executable?` instead of `assert File.executable? f`
end end
RUBY RUBY
end end

View File

@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::Comments do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
# system "cmake", ".", *std_cmake_args # system "cmake", ".", *std_cmake_args
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Please remove default template comments ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Comments: Please remove default template comments
end end
RUBY RUBY
end end
@ -22,7 +22,7 @@ describe RuboCop::Cop::FormulaAudit::Comments do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
# PLEASE REMOVE # PLEASE REMOVE
^^^^^^^^^^^^^^^ Please remove default template comments ^^^^^^^^^^^^^^^ FormulaAudit/Comments: Please remove default template comments
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
end end
@ -35,7 +35,7 @@ describe RuboCop::Cop::FormulaAudit::Comments do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
# depends_on "foo" # depends_on "foo"
^^^^^^^^^^^^^^^^^^ Commented-out dependency "foo" ^^^^^^^^^^^^^^^^^^ FormulaAudit/Comments: Commented-out dependency "foo"
end end
RUBY RUBY
end end
@ -46,11 +46,11 @@ describe RuboCop::Cop::FormulaAudit::Comments do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
# cite Howell_2009: # cite Howell_2009:
^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `cite` comments ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Comments: Formulae in homebrew/core should not use `cite` comments
# doi "10.111/222.x" # doi "10.111/222.x"
^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `doi` comments ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Comments: Formulae in homebrew/core should not use `doi` comments
# tag "software" # tag "software"
^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `tag` comments ^^^^^^^^^^^^^^^^ FormulaAudit/Comments: Formulae in homebrew/core should not use `tag` comments
end end
RUBY RUBY
end end

View File

@ -43,7 +43,7 @@ describe RuboCop::Cop::FormulaAudit::LicenseArrays do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
license ["MIT", "0BSD"] license ["MIT", "0BSD"]
^^^^^^^^^^^^^^^^^^^^^^^ Use `license any_of: ["MIT", "0BSD"]` instead of `license ["MIT", "0BSD"]` ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/LicenseArrays: Use `license any_of: ["MIT", "0BSD"]` instead of `license ["MIT", "0BSD"]`
end end
RUBY RUBY

View File

@ -80,7 +80,7 @@ describe RuboCop::Cop::FormulaAudit::Licenses do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
license any_of: ["MIT", all_of: ["0BSD", "Zlib"]] license any_of: ["MIT", all_of: ["0BSD", "Zlib"]]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Split nested license declarations onto multiple lines ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Licenses: Split nested license declarations onto multiple lines
end end
RUBY RUBY
end end

View File

@ -27,7 +27,7 @@ describe RuboCop::Cop::FormulaAuditStrict::MakeCheck do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
system "make", "-j1", "test" system "make", "-j1", "test"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core (except e.g. cryptography, libraries) should not run build-time checks ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAuditStrict/MakeCheck: Formulae in homebrew/core (except e.g. cryptography, libraries) should not run build-time checks
end end
RUBY RUBY
end end

View File

@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
FileUtils.mv "hello" FileUtils.mv "hello"
^^^^^^^^^^^^^^^^^^^^ Don't need 'FileUtils.' before mv ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Don't need 'FileUtils.' before mv
end end
RUBY RUBY
end end
@ -24,7 +24,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
inreplace "foo" do |longvar| inreplace "foo" do |longvar|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "inreplace <filenames> do |s|" is preferred over "|longvar|". ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: "inreplace <filenames> do |s|" is preferred over "|longvar|".
somerandomCall(longvar) somerandomCall(longvar)
end end
end end
@ -38,7 +38,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
bottle do bottle do
rebuild 0 rebuild 0
^^^^^^^^^ 'rebuild 0' should be removed ^^^^^^^^^ FormulaAudit/Miscellaneous: 'rebuild 0' should be removed
sha256 "fe0679b932dd43a87fd415b609a7fbac7a069d117642ae8ebaac46ae1fb9f0b3" => :sierra sha256 "fe0679b932dd43a87fd415b609a7fbac7a069d117642ae8ebaac46ae1fb9f0b3" => :sierra
end end
end end
@ -54,7 +54,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
sha256 "fe0679b932dd43a87fd415b609a7fbac7a069d117642ae8ebaac46ae1fb9f0b3" => :sierra sha256 "fe0679b932dd43a87fd415b609a7fbac7a069d117642ae8ebaac46ae1fb9f0b3" => :sierra
end end
fails_with :llvm do fails_with :llvm do
^^^^^^^^^^^^^^^^ 'fails_with :llvm' is now a no-op so should be removed ^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: 'fails_with :llvm' is now a no-op so should be removed
build 2335 build 2335
cause "foo" cause "foo"
end end
@ -69,7 +69,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def test def test
^^^^^^^^ Use new-style test definitions (test do) ^^^^^^^^ FormulaAudit/Miscellaneous: Use new-style test definitions (test do)
assert_equals "1", "1" assert_equals "1", "1"
end end
end end
@ -82,7 +82,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
skip_clean :all skip_clean :all
^^^^^^^^^^^^^^^ `skip_clean :all` is deprecated; brew no longer strips symbols. Pass explicit paths to prevent Homebrew from removing empty folders. ^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: `skip_clean :all` is deprecated; brew no longer strips symbols. Pass explicit paths to prevent Homebrew from removing empty folders.
end end
RUBY RUBY
end end
@ -93,7 +93,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
if build.universal? if build.universal?
^^^^^^^^^^^^^^^^ macOS has been 64-bit only since 10.6 so build.universal? is deprecated. ^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: macOS has been 64-bit only since 10.6 so build.universal? is deprecated.
"foo" "foo"
end end
end end
@ -119,7 +119,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
if build? if build?
ENV.universal_binary ENV.universal_binary
^^^^^^^^^^^^^^^^^^^^ macOS has been 64-bit only since 10.6 so ENV.universal_binary is deprecated. ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: macOS has been 64-bit only since 10.6 so ENV.universal_binary is deprecated.
end end
end end
RUBY RUBY
@ -143,7 +143,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
system "install_name_tool", "-id" system "install_name_tool", "-id"
^^^^^^^^^^^^^^^^^^^ Use ruby-macho instead of calling "install_name_tool" ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use ruby-macho instead of calling "install_name_tool"
end end
RUBY RUBY
end end
@ -154,7 +154,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
system "npm", "install" system "npm", "install"
^^^^^^^^^^^^^^^^^^^^^^^ Use Language::Node for npm install args ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use Language::Node for npm install args
end end
RUBY RUBY
end end
@ -175,7 +175,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on FOO::BAR.new depends_on FOO::BAR.new
^^^^^^^^^^^^ `depends_on` can take requirement classes instead of instances ^^^^^^^^^^^^ FormulaAudit/Miscellaneous: `depends_on` can take requirement classes instead of instances
end end
RUBY RUBY
end end
@ -187,7 +187,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
rm_rf Dir["src/{llvm,test,librustdoc,etc/snapshot.pyc}"] rm_rf Dir["src/{llvm,test,librustdoc,etc/snapshot.pyc}"]
rm_rf Dir["src/snapshot.pyc"] rm_rf Dir["src/snapshot.pyc"]
^^^^^^^^^^^^^^^^^^ Dir(["src/snapshot.pyc"]) is unnecessary; just use "src/snapshot.pyc" ^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Dir(["src/snapshot.pyc"]) is unnecessary; just use "src/snapshot.pyc"
end end
RUBY RUBY
end end
@ -198,7 +198,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
system "mkdir", "foo" system "mkdir", "foo"
^^^^^^^ Use the `mkdir` Ruby method instead of `system "mkdir", "foo"` ^^^^^^^ FormulaAudit/Miscellaneous: Use the `mkdir` Ruby method instead of `system "mkdir", "foo"`
end end
RUBY RUBY
end end
@ -206,7 +206,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
it "reports an offense when top-level functions are defined outside of a class body" do it "reports an offense when top-level functions are defined outside of a class body" do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
def test def test
^^^^^^^^ Define method test in the class body, not at the top-level ^^^^^^^^ FormulaAudit/Miscellaneous: Define method test in the class body, not at the top-level
nil nil
end end
class Foo < Formula class Foo < Formula
@ -223,7 +223,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def install def install
man1.install man+"man8" => "faad.1" man1.install man+"man8" => "faad.1"
^^^^^^ "man+"man8"" should be "man8" ^^^^^^ FormulaAudit/Miscellaneous: "man+"man8"" should be "man8"
end end
end end
RUBY RUBY
@ -236,7 +236,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def install def install
system "/usr/bin/gcc", "foo" system "/usr/bin/gcc", "foo"
^^^^^^^^^^^^^^ Use "#{ENV.cc}" instead of hard-coding "gcc" ^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use "#{ENV.cc}" instead of hard-coding "gcc"
end end
end end
RUBY RUBY
@ -249,7 +249,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def install def install
system "/usr/bin/g++", "-o", "foo", "foo.cc" system "/usr/bin/g++", "-o", "foo", "foo.cc"
^^^^^^^^^^^^^^ Use "#{ENV.cxx}" instead of hard-coding "g++" ^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use "#{ENV.cxx}" instead of hard-coding "g++"
end end
end end
RUBY RUBY
@ -262,7 +262,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def install def install
ENV["COMPILER_PATH"] = "/usr/bin/c++" ENV["COMPILER_PATH"] = "/usr/bin/c++"
^^^^^^^^^^^^^^ Use "#{ENV.cxx}" instead of hard-coding "c++" ^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use "#{ENV.cxx}" instead of hard-coding "c++"
end end
end end
RUBY RUBY
@ -275,7 +275,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def install def install
ENV["COMPILER_PATH"] = "/usr/bin/gcc" ENV["COMPILER_PATH"] = "/usr/bin/gcc"
^^^^^^^^^^^^^^ Use "\#{ENV.cc}" instead of hard-coding "gcc" ^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use "\#{ENV.cc}" instead of hard-coding "gcc"
end end
end end
RUBY RUBY
@ -288,7 +288,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def install def install
mv "#{share}/man", share mv "#{share}/man", share
^^^^ "#{share}/man" should be "#{man}" ^^^^ FormulaAudit/Miscellaneous: "#{share}/man" should be "#{man}"
end end
end end
RUBY RUBY
@ -301,7 +301,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def install def install
mv "#{prefix}/libexec", share mv "#{prefix}/libexec", share
^^^^^^^^ "#{prefix}/libexec" should be "#{libexec}" ^^^^^^^^ FormulaAudit/Miscellaneous: "#{prefix}/libexec" should be "#{libexec}"
end end
end end
RUBY RUBY
@ -314,7 +314,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def install def install
system "./configure", "--INFODIR=#{prefix}/share/info" system "./configure", "--INFODIR=#{prefix}/share/info"
^^^^^^^^^^^ "#{prefix}/share/info" should be "#{info}" ^^^^^^^^^^^ FormulaAudit/Miscellaneous: "#{prefix}/share/info" should be "#{info}"
end end
end end
RUBY RUBY
@ -327,7 +327,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def install def install
system "./configure", "--MANDIR=#{prefix}/share/man/man8" system "./configure", "--MANDIR=#{prefix}/share/man/man8"
^^^^^^^^^^^^^^^ "#{prefix}/share/man/man8" should be "#{man8}" ^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: "#{prefix}/share/man/man8" should be "#{man8}"
end end
end end
RUBY RUBY
@ -339,7 +339,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on "lpeg" => :lua51 depends_on "lpeg" => :lua51
^^^^^^ lua modules should be vendored rather than use deprecated `depends_on "lpeg" => :lua51` ^^^^^^ FormulaAudit/Miscellaneous: lua modules should be vendored rather than use deprecated `depends_on "lpeg" => :lua51`
end end
RUBY RUBY
end end
@ -350,7 +350,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
system "export", "var=value" system "export", "var=value"
^^^^^^^^ Use ENV instead of invoking 'export' to modify the environment ^^^^^^^^ FormulaAudit/Miscellaneous: Use ENV instead of invoking 'export' to modify the environment
end end
RUBY RUBY
end end
@ -361,7 +361,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on "foo" => "with-bar" depends_on "foo" => "with-bar"
^^^^^^^^^^ Dependency foo should not use option with-bar ^^^^^^^^^^ FormulaAudit/Miscellaneous: Dependency foo should not use option with-bar
end end
RUBY RUBY
end end
@ -373,9 +373,9 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on "httpd" => [:build, :test] depends_on "httpd" => [:build, :test]
depends_on "foo" => [:optional, "with-bar"] depends_on "foo" => [:optional, "with-bar"]
^^^^^^^^^^ Dependency foo should not use option with-bar ^^^^^^^^^^ FormulaAudit/Miscellaneous: Dependency foo should not use option with-bar
depends_on "icu4c" => [:optional, "c++11"] depends_on "icu4c" => [:optional, "c++11"]
^^^^^^^ Dependency icu4c should not use option c++11 ^^^^^^^ FormulaAudit/Miscellaneous: Dependency icu4c should not use option c++11
end end
RUBY RUBY
end end
@ -386,7 +386,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
if version == "HEAD" if version == "HEAD"
^^^^^^^^^^^^^^^^^ Use 'build.head?' instead of inspecting 'version' ^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use 'build.head?' instead of inspecting 'version'
foo() foo()
end end
end end
@ -400,8 +400,8 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
test do test do
head = ARGV.include? "--HEAD" head = ARGV.include? "--HEAD"
^^^^ Use build instead of ARGV to check options ^^^^ FormulaAudit/Miscellaneous: Use build instead of ARGV to check options
^^^^^^^^^^^^^^^^^^^^^^ Use "if build.head?" instead ^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use "if build.head?" instead
end end
end end
RUBY RUBY
@ -413,7 +413,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
needs :openmp needs :openmp
^^^^^^^^^^^^^ 'needs :openmp' should be replaced with 'depends_on "gcc"' ^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: 'needs :openmp' should be replaced with 'depends_on "gcc"'
end end
RUBY RUBY
end end
@ -425,7 +425,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
test do test do
version = MACOS_VERSION version = MACOS_VERSION
^^^^^^^^^^^^^ Use MacOS.version instead of MACOS_VERSION ^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use MacOS.version instead of MACOS_VERSION
end end
end end
RUBY RUBY
@ -437,7 +437,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on "foo" if build.with? "foo" depends_on "foo" if build.with? "foo"
^^^^^^^^^^^^^^^^ Replace depends_on "foo" if build.with? "foo" with depends_on "foo" => :optional ^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Replace depends_on "foo" if build.with? "foo" with depends_on "foo" => :optional
end end
RUBY RUBY
end end
@ -448,7 +448,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on :foo unless build.without? "foo" depends_on :foo unless build.without? "foo"
^^^^^^^^^^^^^^^ Replace depends_on :foo unless build.without? "foo" with depends_on :foo => :recommended ^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Replace depends_on :foo unless build.without? "foo" with depends_on :foo => :recommended
end end
RUBY RUBY
end end
@ -459,7 +459,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on :foo unless build.include? "without-foo" depends_on :foo unless build.include? "without-foo"
^^^^^^^^^^^^^^^ Replace depends_on :foo unless build.include? "without-foo" with depends_on :foo => :recommended ^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Replace depends_on :foo unless build.include? "without-foo" with depends_on :foo => :recommended
end end
RUBY RUBY
end end

View File

@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::MpiCheck do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on "mpich" depends_on "mpich"
^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should use 'depends_on "open-mpi"' instead of 'depends_on "mpich"'. ^^^^^^^^^^^^^^^^^^ FormulaAudit/MpiCheck: Formulae in homebrew/core should use 'depends_on "open-mpi"' instead of 'depends_on "mpich"'.
end end
RUBY RUBY

View File

@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
if OS.linux? if OS.linux?
^^^^^^^^^^^^ Don't use `if OS.linux?`, use `on_linux do` instead. ^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if OS.linux?`, use `on_linux do` instead.
url 'https://brew.sh/linux-1.0.tgz' url 'https://brew.sh/linux-1.0.tgz'
else else
url 'https://brew.sh/linux-1.0.tgz' url 'https://brew.sh/linux-1.0.tgz'
@ -38,7 +38,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
if OS.mac? if OS.mac?
^^^^^^^^^^ Don't use `if OS.mac?`, use `on_macos do` instead. ^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if OS.mac?`, use `on_macos do` instead.
url 'https://brew.sh/mac-1.0.tgz' url 'https://brew.sh/mac-1.0.tgz'
else else
url 'https://brew.sh/linux-1.0.tgz' url 'https://brew.sh/linux-1.0.tgz'
@ -67,7 +67,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
def install def install
on_macos do on_macos do
^^^^^^^^ Don't use `on_macos` in `def install`, use `if OS.mac?` instead. ^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_macos` in `def install`, use `if OS.mac?` instead.
true true
end end
end end
@ -96,7 +96,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
def install def install
on_linux do on_linux do
^^^^^^^^ Don't use `on_linux` in `def install`, use `if OS.linux?` instead. ^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_linux` in `def install`, use `if OS.linux?` instead.
true true
end end
end end
@ -125,7 +125,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
test do test do
on_macos do on_macos do
^^^^^^^^ Don't use `on_macos` in `test do`, use `if OS.mac?` instead. ^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_macos` in `test do`, use `if OS.mac?` instead.
true true
end end
end end
@ -153,7 +153,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
if Hardware::CPU.arm? if Hardware::CPU.arm?
^^^^^^^^^^^^^^^^^^^^^ Don't use `if Hardware::CPU.arm?`, use `on_arm do` instead. ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if Hardware::CPU.arm?`, use `on_arm do` instead.
url 'https://brew.sh/linux-1.0.tgz' url 'https://brew.sh/linux-1.0.tgz'
else else
url 'https://brew.sh/linux-1.0.tgz' url 'https://brew.sh/linux-1.0.tgz'
@ -179,7 +179,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
if Hardware::CPU.intel? if Hardware::CPU.intel?
^^^^^^^^^^^^^^^^^^^^^^^ Don't use `if Hardware::CPU.intel?`, use `on_intel do` instead. ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if Hardware::CPU.intel?`, use `on_intel do` instead.
url 'https://brew.sh/mac-1.0.tgz' url 'https://brew.sh/mac-1.0.tgz'
else else
url 'https://brew.sh/linux-1.0.tgz' url 'https://brew.sh/linux-1.0.tgz'
@ -208,7 +208,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
def install def install
on_intel do on_intel do
^^^^^^^^ Don't use `on_intel` in `def install`, use `if Hardware::CPU.intel?` instead. ^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_intel` in `def install`, use `if Hardware::CPU.intel?` instead.
true true
end end
end end
@ -237,7 +237,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
def install def install
on_arm do on_arm do
^^^^^^ Don't use `on_arm` in `def install`, use `if Hardware::CPU.arm?` instead. ^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_arm` in `def install`, use `if Hardware::CPU.arm?` instead.
true true
end end
end end
@ -266,7 +266,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
test do test do
on_intel do on_intel do
^^^^^^^^ Don't use `on_intel` in `test do`, use `if Hardware::CPU.intel?` instead. ^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_intel` in `test do`, use `if Hardware::CPU.intel?` instead.
true true
end end
end end
@ -294,7 +294,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
if MacOS.version == :monterey if MacOS.version == :monterey
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't use `if MacOS.version == :monterey`, use `on_monterey do` instead. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if MacOS.version == :monterey`, use `on_monterey do` instead.
url 'https://brew.sh/linux-1.0.tgz' url 'https://brew.sh/linux-1.0.tgz'
end end
end end
@ -315,7 +315,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
if MacOS.version <= :monterey if MacOS.version <= :monterey
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't use `if MacOS.version <= :monterey`, use `on_system :linux, macos: :monterey_or_older do` instead. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if MacOS.version <= :monterey`, use `on_system :linux, macos: :monterey_or_older do` instead.
url 'https://brew.sh/mac-1.0.tgz' url 'https://brew.sh/mac-1.0.tgz'
end end
end end
@ -336,7 +336,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
if MacOS.version < :monterey if MacOS.version < :monterey
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't use `if MacOS.version < :monterey`, use `on_system do` instead. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if MacOS.version < :monterey`, use `on_system do` instead.
url 'https://brew.sh/mac-1.0.tgz' url 'https://brew.sh/mac-1.0.tgz'
end end
end end
@ -348,7 +348,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
if MacOS.version >= :monterey if MacOS.version >= :monterey
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't use `if MacOS.version >= :monterey`, use `on_monterey :or_newer do` instead. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if MacOS.version >= :monterey`, use `on_monterey :or_newer do` instead.
url 'https://brew.sh/mac-1.0.tgz' url 'https://brew.sh/mac-1.0.tgz'
else else
url 'https://brew.sh/linux-1.0.tgz' url 'https://brew.sh/linux-1.0.tgz'
@ -362,7 +362,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
if MacOS.version > :monterey if MacOS.version > :monterey
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't use `if MacOS.version > :monterey`, use `on_monterey do` instead. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if MacOS.version > :monterey`, use `on_monterey do` instead.
url 'https://brew.sh/mac-1.0.tgz' url 'https://brew.sh/mac-1.0.tgz'
end end
end end
@ -377,7 +377,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
def install def install
on_monterey do on_monterey do
^^^^^^^^^^^ Don't use `on_monterey` in `def install`, use `if MacOS.version == :monterey` instead. ^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_monterey` in `def install`, use `if MacOS.version == :monterey` instead.
true true
end end
end end
@ -406,7 +406,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
def install def install
on_monterey :or_older do on_monterey :or_older do
^^^^^^^^^^^^^^^^^^^^^ Don't use `on_monterey :or_older` in `def install`, use `if MacOS.version <= :monterey` instead. ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_monterey :or_older` in `def install`, use `if MacOS.version <= :monterey` instead.
true true
end end
end end
@ -435,7 +435,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
def install def install
on_monterey :or_newer do on_monterey :or_newer do
^^^^^^^^^^^^^^^^^^^^^ Don't use `on_monterey :or_newer` in `def install`, use `if MacOS.version >= :monterey` instead. ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_monterey :or_newer` in `def install`, use `if MacOS.version >= :monterey` instead.
true true
end end
end end
@ -464,7 +464,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
def install def install
on_system :linux, macos: :monterey_or_newer do on_system :linux, macos: :monterey_or_newer do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't use `on_system :linux, macos: :monterey_or_newer` in `def install`, use `if OS.linux? || MacOS.version >= :monterey` instead. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_system :linux, macos: :monterey_or_newer` in `def install`, use `if OS.linux? || MacOS.version >= :monterey` instead.
true true
end end
end end
@ -493,7 +493,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
test do test do
on_monterey do on_monterey do
^^^^^^^^^^^ Don't use `on_monterey` in `test do`, use `if MacOS.version == :monterey` instead. ^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_monterey` in `test do`, use `if MacOS.version == :monterey` instead.
true true
end end
end end
@ -522,7 +522,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
test do test do
on_system :linux, macos: :monterey do on_system :linux, macos: :monterey do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't use `on_system :linux, macos: :monterey` in `test do`, use `if OS.linux? || MacOS.version == :monterey` instead. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_system :linux, macos: :monterey` in `test do`, use `if OS.linux? || MacOS.version == :monterey` instead.
true true
end end
end end

View File

@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def install def install
build.without? "bar" build.without? "bar"
^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `build.without?`. ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Formulae in homebrew/core should not use `build.without?`.
end end
end end
RUBY RUBY
@ -27,7 +27,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def install def install
build.with? "bar" build.with? "bar"
^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `build.with?`. ^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Formulae in homebrew/core should not use `build.with?`.
end end
end end
RUBY RUBY
@ -37,7 +37,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
depends_on "bar" if build.without?("baz") depends_on "bar" if build.without?("baz")
^^^^^^^^^^^^^^^^^^^^^ Use `:optional` or `:recommended` instead of `if build.without?("baz")` ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Use `:optional` or `:recommended` instead of `if build.without?("baz")`
end end
RUBY RUBY
end end
@ -46,7 +46,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula
depends_on "bar" if build.with?("baz") depends_on "bar" if build.with?("baz")
^^^^^^^^^^^^^^^^^^ Use `:optional` or `:recommended` instead of `if build.with?("baz")` ^^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Use `:optional` or `:recommended` instead of `if build.with?("baz")`
end end
RUBY RUBY
end end
@ -58,7 +58,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def post_install def post_install
return unless build.without? "bar" return unless build.without? "bar"
^^^^^^^^^^^^^^^^^^^^ Use if build.with? "bar" instead of unless build.without? "bar" ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Use if build.with? "bar" instead of unless build.without? "bar"
end end
end end
RUBY RUBY
@ -71,7 +71,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def post_install def post_install
return unless build.with? "bar" return unless build.with? "bar"
^^^^^^^^^^^^^^^^^ Use if build.without? "bar" instead of unless build.with? "bar" ^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Use if build.without? "bar" instead of unless build.with? "bar"
end end
end end
RUBY RUBY
@ -84,7 +84,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def post_install def post_install
return if !build.with? "bar" return if !build.with? "bar"
^^^^^^^^^^^^^^^^^^ Don't negate 'build.with?': use 'build.without?' ^^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Don't negate 'build.with?': use 'build.without?'
end end
end end
RUBY RUBY
@ -97,7 +97,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def post_install def post_install
return if !build.without? "bar" return if !build.without? "bar"
^^^^^^^^^^^^^^^^^^^^^ Don't negate 'build.without?': use 'build.with?' ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Don't negate 'build.without?': use 'build.with?'
end end
end end
RUBY RUBY
@ -110,7 +110,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def post_install def post_install
return if build.without? "--without-bar" return if build.without? "--without-bar"
^^^^^^^^^^^^^^^ Don't duplicate 'without': Use `build.without? "bar"` to check for "--without-bar" ^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Don't duplicate 'without': Use `build.without? "bar"` to check for "--without-bar"
end end
end end
RUBY RUBY
@ -123,7 +123,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def post_install def post_install
return if build.with? "--with-bar" return if build.with? "--with-bar"
^^^^^^^^^^^^ Don't duplicate 'with': Use `build.with? "bar"` to check for "--with-bar" ^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Don't duplicate 'with': Use `build.with? "bar"` to check for "--with-bar"
end end
end end
RUBY RUBY
@ -136,7 +136,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def post_install def post_install
return if build.include? "foo" return if build.include? "foo"
^^^^^^^^^^^^^^^^^^^^ `build.include?` is deprecated ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: `build.include?` is deprecated
end end
end end
RUBY RUBY
@ -149,7 +149,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def options def options
^^^^^^^^^^^ Use new-style option definitions ^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Use new-style option definitions
[["--bar", "desc"]] [["--bar", "desc"]]
end end
end end

View File

@ -96,7 +96,7 @@ describe RuboCop::Cop::FormulaAudit::PythonVersions do
def install def install
puts "python@3.8" puts "python@3.8"
^^^^^^^^^^^^ References to `python@3.8` should match the specified python dependency (`python@3.9`) ^^^^^^^^^^^^ FormulaAudit/PythonVersions: References to `python@3.8` should match the specified python dependency (`python@3.9`)
end end
end end
RUBY RUBY
@ -119,7 +119,7 @@ describe RuboCop::Cop::FormulaAudit::PythonVersions do
def install def install
puts "python3.8" puts "python3.8"
^^^^^^^^^^^ References to `python3.8` should match the specified python dependency (`python3.9`) ^^^^^^^^^^^ FormulaAudit/PythonVersions: References to `python3.8` should match the specified python dependency (`python3.9`)
end end
end end
RUBY RUBY
@ -142,7 +142,7 @@ describe RuboCop::Cop::FormulaAudit::PythonVersions do
def install def install
puts "python@3.10" puts "python@3.10"
^^^^^^^^^^^^^ References to `python@3.10` should match the specified python dependency (`python@3.11`) ^^^^^^^^^^^^^ FormulaAudit/PythonVersions: References to `python@3.10` should match the specified python dependency (`python@3.11`)
end end
end end
RUBY RUBY
@ -165,7 +165,7 @@ describe RuboCop::Cop::FormulaAudit::PythonVersions do
def install def install
puts "python3.10" puts "python3.10"
^^^^^^^^^^^^ References to `python3.10` should match the specified python dependency (`python3.11`) ^^^^^^^^^^^^ FormulaAudit/PythonVersions: References to `python3.10` should match the specified python dependency (`python3.11`)
end end
end end
RUBY RUBY

View File

@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::SafePopenCommands do
class Foo < Formula class Foo < Formula
def install def install
Utils.popen_read "foo" Utils.popen_read "foo"
^^^^^^^^^^^^^^^^^^^^^^ Use `Utils.safe_popen_read` instead of `Utils.popen_read` ^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/SafePopenCommands: Use `Utils.safe_popen_read` instead of `Utils.popen_read`
end end
end end
RUBY RUBY
@ -31,7 +31,7 @@ describe RuboCop::Cop::FormulaAudit::SafePopenCommands do
class Foo < Formula class Foo < Formula
def install def install
Utils.popen_write "foo" Utils.popen_write "foo"
^^^^^^^^^^^^^^^^^^^^^^^ Use `Utils.safe_popen_write` instead of `Utils.popen_write` ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/SafePopenCommands: Use `Utils.safe_popen_write` instead of `Utils.popen_write`
end end
end end
RUBY RUBY

View File

@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::ShellVariables do
class Foo < Formula class Foo < Formula
def install def install
Utils.popen "SHELL=bash foo" Utils.popen "SHELL=bash foo"
^^^^^^^^^^^^^^^^ Use `Utils.popen({ "SHELL" => "bash" }, "foo")` instead of `Utils.popen "SHELL=bash foo"` ^^^^^^^^^^^^^^^^ FormulaAudit/ShellVariables: Use `Utils.popen({ "SHELL" => "bash" }, "foo")` instead of `Utils.popen "SHELL=bash foo"`
end end
end end
RUBY RUBY
@ -31,7 +31,7 @@ describe RuboCop::Cop::FormulaAudit::ShellVariables do
class Foo < Formula class Foo < Formula
def install def install
Utils.safe_popen_read "SHELL=bash foo" Utils.safe_popen_read "SHELL=bash foo"
^^^^^^^^^^^^^^^^ Use `Utils.safe_popen_read({ "SHELL" => "bash" }, "foo")` instead of `Utils.safe_popen_read "SHELL=bash foo"` ^^^^^^^^^^^^^^^^ FormulaAudit/ShellVariables: Use `Utils.safe_popen_read({ "SHELL" => "bash" }, "foo")` instead of `Utils.safe_popen_read "SHELL=bash foo"`
end end
end end
RUBY RUBY
@ -50,7 +50,7 @@ describe RuboCop::Cop::FormulaAudit::ShellVariables do
class Foo < Formula class Foo < Formula
def install def install
Utils.safe_popen_write "SHELL=bash foo" Utils.safe_popen_write "SHELL=bash foo"
^^^^^^^^^^^^^^^^ Use `Utils.safe_popen_write({ "SHELL" => "bash" }, "foo")` instead of `Utils.safe_popen_write "SHELL=bash foo"` ^^^^^^^^^^^^^^^^ FormulaAudit/ShellVariables: Use `Utils.safe_popen_write({ "SHELL" => "bash" }, "foo")` instead of `Utils.safe_popen_write "SHELL=bash foo"`
end end
end end
RUBY RUBY
@ -69,7 +69,7 @@ describe RuboCop::Cop::FormulaAudit::ShellVariables do
class Foo < Formula class Foo < Formula
def install def install
Utils.popen "SHELL=bash \#{bin}/foo" Utils.popen "SHELL=bash \#{bin}/foo"
^^^^^^^^^^^^^^^^^^^^^^^ Use `Utils.popen({ "SHELL" => "bash" }, "\#{bin}/foo")` instead of `Utils.popen "SHELL=bash \#{bin}/foo"` ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ShellVariables: Use `Utils.popen({ "SHELL" => "bash" }, "\#{bin}/foo")` instead of `Utils.popen "SHELL=bash \#{bin}/foo"`
end end
end end
RUBY RUBY

View File

@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
env :userpaths env :userpaths
^^^^^^^^^^^^^^ `env :userpaths` in homebrew/core formulae is deprecated ^^^^^^^^^^^^^^ FormulaAuditStrict/Text: `env :userpaths` in homebrew/core formulae is deprecated
end end
RUBY RUBY
end end
@ -24,7 +24,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
env :std env :std
^^^^^^^^ `env :std` in homebrew/core formulae is deprecated ^^^^^^^^ FormulaAuditStrict/Text: `env :std` in homebrew/core formulae is deprecated
end end
RUBY RUBY
end end
@ -34,7 +34,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do
class Foo < Formula class Foo < Formula
def install def install
ohai "\#{share}/foo" ohai "\#{share}/foo"
^^^^^^^^^^^^^^ Use `\#{pkgshare}` instead of `\#{share}/foo` ^^^^^^^^^^^^^^ FormulaAuditStrict/Text: Use `\#{pkgshare}` instead of `\#{share}/foo`
end end
end end
RUBY RUBY
@ -43,7 +43,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do
class Foo < Formula class Foo < Formula
def install def install
ohai "\#{share}/foo/bar" ohai "\#{share}/foo/bar"
^^^^^^^^^^^^^^^^^^ Use `\#{pkgshare}` instead of `\#{share}/foo` ^^^^^^^^^^^^^^^^^^ FormulaAuditStrict/Text: Use `\#{pkgshare}` instead of `\#{share}/foo`
end end
end end
RUBY RUBY
@ -52,7 +52,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do
class Foolibcxx < Formula class Foolibcxx < Formula
def install def install
ohai "\#{share}/foolibc++" ohai "\#{share}/foolibc++"
^^^^^^^^^^^^^^^^^^^^ Use `\#{pkgshare}` instead of `\#{share}/foolibc++` ^^^^^^^^^^^^^^^^^^^^ FormulaAuditStrict/Text: Use `\#{pkgshare}` instead of `\#{share}/foolibc++`
end end
end end
RUBY RUBY
@ -63,7 +63,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do
class Foo < Formula class Foo < Formula
def install def install
ohai share/"foo" ohai share/"foo"
^^^^^^^^^^^ Use `pkgshare` instead of `share/"foo"` ^^^^^^^^^^^ FormulaAuditStrict/Text: Use `pkgshare` instead of `share/"foo"`
end end
end end
RUBY RUBY
@ -72,7 +72,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do
class Foo < Formula class Foo < Formula
def install def install
ohai share/"foo/bar" ohai share/"foo/bar"
^^^^^^^^^^^^^^^ Use `pkgshare` instead of `share/"foo"` ^^^^^^^^^^^^^^^ FormulaAuditStrict/Text: Use `pkgshare` instead of `share/"foo"`
end end
end end
RUBY RUBY
@ -81,7 +81,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do
class Foolibcxx < Formula class Foolibcxx < Formula
def install def install
ohai share/"foolibc++" ohai share/"foolibc++"
^^^^^^^^^^^^^^^^^ Use `pkgshare` instead of `share/"foolibc++"` ^^^^^^^^^^^^^^^^^ FormulaAuditStrict/Text: Use `pkgshare` instead of `share/"foolibc++"`
end end
end end
RUBY RUBY

View File

@ -10,7 +10,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
it 'reports an offense if `require "formula"` is present' do it 'reports an offense if `require "formula"` is present' do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
require "formula" require "formula"
^^^^^^^^^^^^^^^^^ `require "formula"` is now unnecessary ^^^^^^^^^^^^^^^^^ FormulaAudit/Text: `require "formula"` is now unnecessary
class Foo < Formula class Foo < Formula
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
homepage "https://brew.sh" homepage "https://brew.sh"
@ -33,7 +33,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
depends_on "openssl" depends_on "openssl"
depends_on "libressl" => :optional depends_on "libressl" => :optional
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae should not depend on both OpenSSL and LibreSSL (even optionally). ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Formulae should not depend on both OpenSSL and LibreSSL (even optionally).
end end
RUBY RUBY
@ -44,7 +44,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
depends_on "openssl" depends_on "openssl"
depends_on "libressl" depends_on "libressl"
^^^^^^^^^^^^^^^^^^^^^ Formulae should not depend on both OpenSSL and LibreSSL (even optionally). ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Formulae should not depend on both OpenSSL and LibreSSL (even optionally).
end end
RUBY RUBY
end end
@ -55,7 +55,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
homepage "https://brew.sh" homepage "https://brew.sh"
depends_on "veclibfort" depends_on "veclibfort"
^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should use OpenBLAS as the default serial linear algebra library. ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Formulae in homebrew/core should use OpenBLAS as the default serial linear algebra library.
end end
RUBY RUBY
end end
@ -66,7 +66,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
homepage "https://brew.sh" homepage "https://brew.sh"
depends_on "lapack" depends_on "lapack"
^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should use OpenBLAS as the default serial linear algebra library. ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Formulae in homebrew/core should use OpenBLAS as the default serial linear algebra library.
end end
RUBY RUBY
end end
@ -79,7 +79,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
def install def install
system "go", "get", "bar" system "go", "get", "bar"
^^^^^^^^^^^^^^^^^^^^^^^^^ Do not use `go get`. Please ask upstream to implement Go vendoring ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Do not use `go get`. Please ask upstream to implement Go vendoring
end end
end end
RUBY RUBY
@ -93,7 +93,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
def install def install
system "xcodebuild", "foo", "bar" system "xcodebuild", "foo", "bar"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use "xcodebuild *args" instead of "system 'xcodebuild', *args" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: use "xcodebuild *args" instead of "system 'xcodebuild', *args"
end end
end end
RUBY RUBY
@ -107,11 +107,11 @@ describe RuboCop::Cop::FormulaAudit::Text do
def install def install
system "xcodebuild", "foo", "bar" system "xcodebuild", "foo", "bar"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use "xcodebuild *args" instead of "system 'xcodebuild', *args" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: use "xcodebuild *args" instead of "system 'xcodebuild', *args"
end end
def plist def plist
^^^^^^^^^ Please set plist_options when using a formula-defined plist. ^^^^^^^^^ FormulaAudit/Text: Please set plist_options when using a formula-defined plist.
<<~XML <<~XML
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@ -130,7 +130,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
it 'reports an offense if `require "language/go"` is present' do it 'reports an offense if `require "language/go"` is present' do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
require "language/go" require "language/go"
^^^^^^^^^^^^^^^^^^^^^ require "language/go" is unnecessary unless using `go_resource`s ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: require "language/go" is unnecessary unless using `go_resource`s
class Foo < Formula class Foo < Formula
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
@ -138,7 +138,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
def install def install
system "go", "get", "bar" system "go", "get", "bar"
^^^^^^^^^^^^^^^^^^^^^^^^^ Do not use `go get`. Please ask upstream to implement Go vendoring ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Do not use `go get`. Please ask upstream to implement Go vendoring
end end
end end
RUBY RUBY
@ -152,7 +152,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
def install def install
Formula.factory(name) Formula.factory(name)
^^^^^^^^^^^^^^^^^^^^^ "Formula.factory(name)" is deprecated in favor of "Formula[name]" ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: "Formula.factory(name)" is deprecated in favor of "Formula[name]"
end end
end end
RUBY RUBY
@ -166,7 +166,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
def install def install
system "dep", "ensure" system "dep", "ensure"
^^^^^^^^^^^^^^^^^^^^^^ use "dep", "ensure", "-vendor-only" ^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: use "dep", "ensure", "-vendor-only"
end end
end end
RUBY RUBY
@ -180,7 +180,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
def install def install
system "cargo", "build" system "cargo", "build"
^^^^^^^^^^^^^^^^^^^^^^^ use "cargo", "install", *std_cargo_args ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: use "cargo", "install", *std_cargo_args
end end
end end
RUBY RUBY
@ -204,7 +204,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
class Foo < Formula class Foo < Formula
def install def install
system "make && make install" system "make && make install"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use separate `make` calls ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Use separate `make` calls
end end
end end
RUBY RUBY
@ -215,7 +215,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
class Foo < Formula class Foo < Formula
def install def install
ohai "foo \#{bar + "baz"}" ohai "foo \#{bar + "baz"}"
^^^^^^^^^^^^^^ Do not concatenate paths in string interpolation ^^^^^^^^^^^^^^ FormulaAudit/Text: Do not concatenate paths in string interpolation
end end
end end
RUBY RUBY
@ -226,7 +226,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
class Foo < Formula class Foo < Formula
def install def install
ohai prefix + "bin" ohai prefix + "bin"
^^^^^^^^^^^^^^ Use `bin` instead of `prefix + "bin"` ^^^^^^^^^^^^^^ FormulaAudit/Text: Use `bin` instead of `prefix + "bin"`
end end
end end
RUBY RUBY
@ -235,7 +235,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
class Foo < Formula class Foo < Formula
def install def install
ohai prefix + "bin/foo" ohai prefix + "bin/foo"
^^^^^^^^^^^^^^^^^^ Use `bin` instead of `prefix + "bin"` ^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Use `bin` instead of `prefix + "bin"`
end end
end end
RUBY RUBY

View File

@ -56,7 +56,7 @@ describe RuboCop::Cop::FormulaAudit::GitUrls do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
url "https://github.com/foo/bar.git", url "https://github.com/foo/bar.git",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should specify a revision for git URLs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/GitUrls: Formulae in homebrew/core should specify a revision for git URLs
tag: "v1.0.0" tag: "v1.0.0"
end end
RUBY RUBY
@ -67,7 +67,7 @@ describe RuboCop::Cop::FormulaAudit::GitUrls do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
url "https://github.com/foo/bar.git", url "https://github.com/foo/bar.git",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should specify a revision for git URLs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/GitUrls: Formulae in homebrew/core should specify a revision for git URLs
shallow: false, shallow: false,
tag: "v1.0.0" tag: "v1.0.0"
end end

View File

@ -47,7 +47,7 @@ describe RuboCop::Cop::FormulaAuditStrict::GitUrls do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
url "https://github.com/foo/bar.git", url "https://github.com/foo/bar.git",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should specify a tag for git URLs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAuditStrict/GitUrls: Formulae in homebrew/core should specify a tag for git URLs
revision: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" revision: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
end end
RUBY RUBY
@ -58,7 +58,7 @@ describe RuboCop::Cop::FormulaAuditStrict::GitUrls do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
url "https://github.com/foo/bar.git", url "https://github.com/foo/bar.git",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should specify a tag for git URLs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAuditStrict/GitUrls: Formulae in homebrew/core should specify a tag for git URLs
revision: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", revision: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
shallow: false shallow: false
end end

View File

@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::PyPiUrls do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
url "https://pypi.python.org/packages/source/foo/foo-0.1.tar.gz" url "https://pypi.python.org/packages/source/foo/foo-0.1.tar.gz"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use the `Source` url found on PyPI downloads page (`https://pypi.org/project/foo/#files`) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/PyPiUrls: use the `Source` url found on PyPI downloads page (`https://pypi.org/project/foo/#files`)
end end
RUBY RUBY
end end
@ -22,7 +22,7 @@ describe RuboCop::Cop::FormulaAudit::PyPiUrls do
class Foo < Formula class Foo < Formula
desc "foo" desc "foo"
url "https://files.pythonhosted.org/packages/source/f/foo/foo-0.1.tar.gz" url "https://files.pythonhosted.org/packages/source/f/foo/foo-0.1.tar.gz"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use the `Source` url found on PyPI downloads page (`https://pypi.org/project/foo/#files`) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/PyPiUrls: use the `Source` url found on PyPI downloads page (`https://pypi.org/project/foo/#files`)
end end
RUBY RUBY
end end

View File

@ -194,7 +194,7 @@ describe RuboCop::Cop::FormulaAudit::Urls do
url "#{offense_info["url"]}" url "#{offense_info["url"]}"
end end
RUBY RUBY
expected_offenses = [{ message: offense_info["msg"], expected_offenses = [{ message: "FormulaAudit/Urls: #{offense_info["msg"]}",
severity: :convention, severity: :convention,
line: 3, line: 3,
column: offense_info["col"], column: offense_info["col"],
@ -219,7 +219,7 @@ describe RuboCop::Cop::FormulaAudit::Urls do
stable do stable do
url "git://github.com/foo.git", url "git://github.com/foo.git",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Please use https:// for git://github.com/foo.git ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Urls: Please use https:// for git://github.com/foo.git
:tag => "v1.0.1", :tag => "v1.0.1",
:revision => "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" :revision => "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
version "1.0.1" version "1.0.1"
@ -234,7 +234,7 @@ describe RuboCop::Cop::FormulaAudit::Urls do
desc "foo" desc "foo"
url "https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz" url "https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz"
mirror "https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz" mirror "https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ URL should not be duplicated as a mirror: https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Urls: URL should not be duplicated as a mirror: https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz
end end
RUBY RUBY
end end

View File

@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::UsesFromMacos do
homepage "https://brew.sh" homepage "https://brew.sh"
uses_from_macos "postgresql" uses_from_macos "postgresql"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `uses_from_macos` should only be used for macOS dependencies, not postgresql. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/UsesFromMacos: `uses_from_macos` should only be used for macOS dependencies, not postgresql.
end end
RUBY RUBY
end end

View File

@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::Version do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
version "" version ""
^^^^^^^^^^ version is set to an empty string ^^^^^^^^^^ FormulaAudit/Version: version is set to an empty string
end end
RUBY RUBY
end end
@ -22,7 +22,7 @@ describe RuboCop::Cop::FormulaAudit::Version do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
version "v1.0" version "v1.0"
^^^^^^^^^^^^^^ version v1.0 should not have a leading 'v' ^^^^^^^^^^^^^^ FormulaAudit/Version: version v1.0 should not have a leading 'v'
end end
RUBY RUBY
end end
@ -32,7 +32,7 @@ describe RuboCop::Cop::FormulaAudit::Version do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
version "1_0" version "1_0"
^^^^^^^^^^^^^ version 1_0 should not end with an underline and a number ^^^^^^^^^^^^^ FormulaAudit/Version: version 1_0 should not end with an underline and a number
end end
RUBY RUBY
end end