mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00

The methods `OS.linux?` and `OS.mac?` should only be used in `extend/os` and this cop makes sure of that.
23 lines
536 B
Ruby
23 lines
536 B
Ruby
# typed: false
|
|
# frozen_string_literal: true
|
|
|
|
require "rubocops/platform"
|
|
|
|
describe RuboCop::Cop::Homebrew::MoveToExtendOS do
|
|
subject(:cop) { described_class.new }
|
|
|
|
it "registers an offense when using `OS.linux?`" do
|
|
expect_offense(<<~RUBY)
|
|
OS.linux?
|
|
^^^^^^^^^ Move calls to `OS.linux?` and `OS.mac?` to `extend/os`.
|
|
RUBY
|
|
end
|
|
|
|
it "registers an offense when using `OS.mac?`" do
|
|
expect_offense(<<~RUBY)
|
|
OS.mac?
|
|
^^^^^^^ Move calls to `OS.linux?` and `OS.mac?` to `extend/os`.
|
|
RUBY
|
|
end
|
|
end
|