Limit veclibfort & lapack cop to core & add tests

This commit is contained in:
Izaak Beekman 2019-06-06 18:09:44 -04:00
parent 65fbcc86d0
commit 75bc30bfff
No known key found for this signature in database
GPG Key ID: A93CE70D8021BD0F
2 changed files with 23 additions and 1 deletions

View File

@ -17,7 +17,7 @@ module RuboCop
end
if depends_on?("veclibfort") || depends_on?("lapack")
problem "Formulae should use OpenBLAS as the default serial linear algebra library."
problem "Formulae should use OpenBLAS as the default serial linear algebra library." if formula_tap == "homebrew-core"
end
if method_called_ever?(body_node, :virtualenv_create) ||

View File

@ -32,6 +32,28 @@ describe RuboCop::Cop::FormulaAudit::Text do
RUBY
end
it "when veclibfort is used instead of OpenBLAS" do
expect_offense(<<~RUBY, "/homebrew-core/")
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
homepage "https://brew.sh"
depends_on "veclibfort"
^^^^^^^^^^^^^^^^^^^^^^^ Formulae should use OpenBLAS as the default serial linear algebra library.
end
RUBY
end
it "when lapack is used instead of OpenBLAS" do
expect_offense(<<~RUBY, "/homebrew-core/")
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
homepage "https://brew.sh"
depends_on "lapack"
^^^^^^^^^^^^^^^^^^^ Formulae should use OpenBLAS as the default serial linear algebra library.
end
RUBY
end
it "When xcodebuild is called without SYMROOT" do
expect_offense(<<~RUBY)
class Foo < Formula