Merge pull request #11958 from Homebrew/remove_if_os_rubocop

rubocops/lines: remove OS.mac?/OS.linux? check.
This commit is contained in:
Mike McQuaid 2021-09-02 14:07:41 +01:00 committed by GitHub
commit 034d4ac82b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 24 deletions

View File

@ -372,14 +372,6 @@ module RuboCop
end
end
[:mac?, :linux?].each do |method_name|
next if formula_tap != "homebrew-core" || file_path&.include?("linuxbrew")
find_instance_method_call(body_node, "OS", method_name) do |check|
problem "Don't use #{check.source}; homebrew/core only supports macOS"
end
end
find_instance_call(body_node, "ARGV") do |_method_node|
problem "Use build instead of ARGV to check options"
end

View File

@ -45,22 +45,6 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
RUBY
end
it "reports an offense when `OS.linux?` is used in homebrew/core" do
expect_offense(<<~RUBY, "/homebrew-core/")
class Foo < Formula
desc "foo"
url 'https://brew.sh/foo-1.0.tgz'
bottle do
if OS.linux?
^^^^^^^^^ Don\'t use OS.linux?; homebrew/core only supports macOS
nil
end
sha256 "fe0679b932dd43a87fd415b609a7fbac7a069d117642ae8ebaac46ae1fb9f0b3" => :sierra
end
end
RUBY
end
it "reports an offense when a useless `fails_with :llvm` is used" do
expect_offense(<<~RUBY)
class Foo < Formula