Merge pull request #10517 from carlocab/bottle-order

rubocops/bottle: disable bottle order check
This commit is contained in:
Carlo Cabrera 2021-02-04 11:43:38 +00:00 committed by GitHub
commit 92caaf8c37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 115 additions and 115 deletions

View File

@ -167,15 +167,15 @@ module RuboCop
return if sha256_order(sha256_nodes) == sha256_order(arm64_nodes + intel_nodes)
offending_node(bottle_node)
problem "ARM bottles should be listed before Intel bottles" do |corrector|
lines = ["bottle do"]
lines += non_sha256_nodes.map { |node| " #{node.source}" }
lines += arm64_nodes.map { |node| " #{node.source}" }
lines += intel_nodes.map { |node| " #{node.source}" }
lines << " end"
corrector.replace(bottle_node.source_range, lines.join("\n"))
end
# offending_node(bottle_node)
# problem "ARM bottles should be listed before Intel bottles" do |corrector|
# lines = ["bottle do"]
# lines += non_sha256_nodes.map { |node| " #{node.source}" }
# lines += arm64_nodes.map { |node| " #{node.source}" }
# lines += intel_nodes.map { |node| " #{node.source}" }
# lines << " end"
# corrector.replace(bottle_node.source_range, lines.join("\n"))
# end
end
def sha256_order(nodes)

View File

@ -116,125 +116,125 @@ describe RuboCop::Cop::FormulaAudit::BottleOrder do
RUBY
end
it "reports and corrects arm bottles below intel bottles" do
expect_offense(<<~RUBY)
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
# it "reports and corrects arm bottles below intel bottles" do
# expect_offense(<<~RUBY)
# class Foo < Formula
# url "https://brew.sh/foo-1.0.tgz"
bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles
rebuild 4
sha256 big_sur: "faceb00c"
sha256 catalina: "deadbeef"
sha256 arm64_big_sur: "aaaaaaaa"
end
end
RUBY
# bottle do
# ^^^^^^^^^ ARM bottles should be listed before Intel bottles
# rebuild 4
# sha256 big_sur: "faceb00c"
# sha256 catalina: "deadbeef"
# sha256 arm64_big_sur: "aaaaaaaa"
# end
# end
# RUBY
expect_correction(<<~RUBY)
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
# expect_correction(<<~RUBY)
# class Foo < Formula
# url "https://brew.sh/foo-1.0.tgz"
bottle do
rebuild 4
sha256 arm64_big_sur: "aaaaaaaa"
sha256 big_sur: "faceb00c"
sha256 catalina: "deadbeef"
end
end
RUBY
end
# bottle do
# rebuild 4
# sha256 arm64_big_sur: "aaaaaaaa"
# sha256 big_sur: "faceb00c"
# sha256 catalina: "deadbeef"
# end
# end
# RUBY
# end
it "reports and corrects multiple arm bottles below intel bottles" do
expect_offense(<<~RUBY)
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
# it "reports and corrects multiple arm bottles below intel bottles" do
# expect_offense(<<~RUBY)
# class Foo < Formula
# url "https://brew.sh/foo-1.0.tgz"
bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles
rebuild 4
sha256 big_sur: "faceb00c"
sha256 arm64_catalina: "aaaaaaaa"
sha256 catalina: "deadbeef"
sha256 arm64_big_sur: "aaaaaaaa"
end
end
RUBY
# bottle do
# ^^^^^^^^^ ARM bottles should be listed before Intel bottles
# rebuild 4
# sha256 big_sur: "faceb00c"
# sha256 arm64_catalina: "aaaaaaaa"
# sha256 catalina: "deadbeef"
# sha256 arm64_big_sur: "aaaaaaaa"
# end
# end
# RUBY
expect_correction(<<~RUBY)
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
# expect_correction(<<~RUBY)
# class Foo < Formula
# url "https://brew.sh/foo-1.0.tgz"
bottle do
rebuild 4
sha256 arm64_catalina: "aaaaaaaa"
sha256 arm64_big_sur: "aaaaaaaa"
sha256 big_sur: "faceb00c"
sha256 catalina: "deadbeef"
end
end
RUBY
end
# bottle do
# rebuild 4
# sha256 arm64_catalina: "aaaaaaaa"
# sha256 arm64_big_sur: "aaaaaaaa"
# sha256 big_sur: "faceb00c"
# sha256 catalina: "deadbeef"
# end
# end
# RUBY
# end
it "reports and corrects arm bottles with cellars below intel bottles" do
expect_offense(<<~RUBY)
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
# it "reports and corrects arm bottles with cellars below intel bottles" do
# expect_offense(<<~RUBY)
# class Foo < Formula
# url "https://brew.sh/foo-1.0.tgz"
bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles
rebuild 4
sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c"
sha256 catalina: "deadbeef"
sha256 cellar: :any, arm64_big_sur: "aaaaaaaa"
sha256 cellar: :any_skip_relocation, arm64_catalina: "aaaaaaaa"
end
end
RUBY
# bottle do
# ^^^^^^^^^ ARM bottles should be listed before Intel bottles
# rebuild 4
# sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c"
# sha256 catalina: "deadbeef"
# sha256 cellar: :any, arm64_big_sur: "aaaaaaaa"
# sha256 cellar: :any_skip_relocation, arm64_catalina: "aaaaaaaa"
# end
# end
# RUBY
expect_correction(<<~RUBY)
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
# expect_correction(<<~RUBY)
# class Foo < Formula
# url "https://brew.sh/foo-1.0.tgz"
bottle do
rebuild 4
sha256 cellar: :any, arm64_big_sur: "aaaaaaaa"
sha256 cellar: :any_skip_relocation, arm64_catalina: "aaaaaaaa"
sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c"
sha256 catalina: "deadbeef"
end
end
RUBY
end
# bottle do
# rebuild 4
# sha256 cellar: :any, arm64_big_sur: "aaaaaaaa"
# sha256 cellar: :any_skip_relocation, arm64_catalina: "aaaaaaaa"
# sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c"
# sha256 catalina: "deadbeef"
# end
# end
# RUBY
# end
it "reports and corrects arm bottles below intel bottles with old bottle syntax" do
expect_offense(<<~RUBY)
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
# it "reports and corrects arm bottles below intel bottles with old bottle syntax" do
# expect_offense(<<~RUBY)
# class Foo < Formula
# url "https://brew.sh/foo-1.0.tgz"
bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles
cellar :any
sha256 "faceb00c" => :big_sur
sha256 "aaaaaaaa" => :arm64_big_sur
sha256 "aaaaaaaa" => :arm64_catalina
sha256 "deadbeef" => :catalina
end
end
RUBY
# bottle do
# ^^^^^^^^^ ARM bottles should be listed before Intel bottles
# cellar :any
# sha256 "faceb00c" => :big_sur
# sha256 "aaaaaaaa" => :arm64_big_sur
# sha256 "aaaaaaaa" => :arm64_catalina
# sha256 "deadbeef" => :catalina
# end
# end
# RUBY
expect_correction(<<~RUBY)
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
# expect_correction(<<~RUBY)
# class Foo < Formula
# url "https://brew.sh/foo-1.0.tgz"
bottle do
cellar :any
sha256 "aaaaaaaa" => :arm64_big_sur
sha256 "aaaaaaaa" => :arm64_catalina
sha256 "faceb00c" => :big_sur
sha256 "deadbeef" => :catalina
end
end
RUBY
end
# bottle do
# cellar :any
# sha256 "aaaaaaaa" => :arm64_big_sur
# sha256 "aaaaaaaa" => :arm64_catalina
# sha256 "faceb00c" => :big_sur
# sha256 "deadbeef" => :catalina
# end
# end
# RUBY
# end
end