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

View File

@ -116,125 +116,125 @@ describe RuboCop::Cop::FormulaAudit::BottleOrder do
RUBY RUBY
end end
it "reports and corrects arm bottles below intel bottles" do # it "reports and corrects arm bottles below intel bottles" 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"
bottle do # bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles # ^^^^^^^^^ 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"
sha256 arm64_big_sur: "aaaaaaaa" # sha256 arm64_big_sur: "aaaaaaaa"
end # end
end # end
RUBY # RUBY
expect_correction(<<~RUBY) # expect_correction(<<~RUBY)
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
rebuild 4 # rebuild 4
sha256 arm64_big_sur: "aaaaaaaa" # sha256 arm64_big_sur: "aaaaaaaa"
sha256 big_sur: "faceb00c" # sha256 big_sur: "faceb00c"
sha256 catalina: "deadbeef" # sha256 catalina: "deadbeef"
end # end
end # end
RUBY # RUBY
end # end
it "reports and corrects multiple arm bottles below intel bottles" do # it "reports and corrects multiple arm bottles below intel bottles" 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"
bottle do # bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles # ^^^^^^^^^ 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"
sha256 catalina: "deadbeef" # sha256 catalina: "deadbeef"
sha256 arm64_big_sur: "aaaaaaaa" # sha256 arm64_big_sur: "aaaaaaaa"
end # end
end # end
RUBY # RUBY
expect_correction(<<~RUBY) # expect_correction(<<~RUBY)
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
rebuild 4 # rebuild 4
sha256 arm64_catalina: "aaaaaaaa" # sha256 arm64_catalina: "aaaaaaaa"
sha256 arm64_big_sur: "aaaaaaaa" # sha256 arm64_big_sur: "aaaaaaaa"
sha256 big_sur: "faceb00c" # sha256 big_sur: "faceb00c"
sha256 catalina: "deadbeef" # sha256 catalina: "deadbeef"
end # end
end # end
RUBY # RUBY
end # end
it "reports and corrects arm bottles with cellars below intel bottles" do # it "reports and corrects arm bottles with cellars below intel bottles" 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"
bottle do # bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles # ^^^^^^^^^ 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"
sha256 cellar: :any, arm64_big_sur: "aaaaaaaa" # sha256 cellar: :any, arm64_big_sur: "aaaaaaaa"
sha256 cellar: :any_skip_relocation, arm64_catalina: "aaaaaaaa" # sha256 cellar: :any_skip_relocation, arm64_catalina: "aaaaaaaa"
end # end
end # end
RUBY # RUBY
expect_correction(<<~RUBY) # expect_correction(<<~RUBY)
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
rebuild 4 # rebuild 4
sha256 cellar: :any, arm64_big_sur: "aaaaaaaa" # sha256 cellar: :any, arm64_big_sur: "aaaaaaaa"
sha256 cellar: :any_skip_relocation, arm64_catalina: "aaaaaaaa" # sha256 cellar: :any_skip_relocation, arm64_catalina: "aaaaaaaa"
sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c" # sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c"
sha256 catalina: "deadbeef" # sha256 catalina: "deadbeef"
end # end
end # end
RUBY # RUBY
end # end
it "reports and corrects arm bottles below intel bottles with old bottle syntax" do # it "reports and corrects arm bottles below intel bottles with old bottle syntax" 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"
bottle do # bottle do
^^^^^^^^^ ARM bottles should be listed before Intel bottles # ^^^^^^^^^ 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
sha256 "aaaaaaaa" => :arm64_catalina # sha256 "aaaaaaaa" => :arm64_catalina
sha256 "deadbeef" => :catalina # sha256 "deadbeef" => :catalina
end # end
end # end
RUBY # RUBY
expect_correction(<<~RUBY) # expect_correction(<<~RUBY)
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
cellar :any # cellar :any
sha256 "aaaaaaaa" => :arm64_big_sur # sha256 "aaaaaaaa" => :arm64_big_sur
sha256 "aaaaaaaa" => :arm64_catalina # sha256 "aaaaaaaa" => :arm64_catalina
sha256 "faceb00c" => :big_sur # sha256 "faceb00c" => :big_sur
sha256 "deadbeef" => :catalina # sha256 "deadbeef" => :catalina
end # end
end # end
RUBY # RUBY
end # end
end end