
- This builds on @jonchang's work that started in #6265. - We now use `uses_from_macos` to declare dependencies that are implicit on macOS because they ship with macOS, but they're needed on Linux. We have to be sure that the dependencies people specify as `uses_from_macos` are actually shipped with macOS. So, we maintain a safelist of those dependencies and check against it. - Also add more legitimate `uses_from_macos` dependencies to the list. - This is runnable with `brew audit --only-cops=FormulaAudit/UsesFromMacos`. - It produces different number of failures on macOS vs. Linux, because apparently we've not synced Homebrew/linuxbrew-core upstream thoroughly enough yet. - Originally this was designed as a `--strict` audit, but we flipped it to be a normal audit because - to quote Mike - this is "sufficiently robust" now.
20 lines
528 B
Ruby
20 lines
528 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "rubocops/uses_from_macos"
|
|
|
|
describe RuboCop::Cop::FormulaAudit::UsesFromMacos do
|
|
subject(:cop) { described_class.new }
|
|
|
|
it "when auditing uses_from_macos dependencies" do
|
|
expect_offense(<<~RUBY)
|
|
class Foo < Formula
|
|
url "https://brew.sh/foo-1.0.tgz"
|
|
homepage "https://brew.sh"
|
|
|
|
uses_from_macos "postgresql"
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `uses_from_macos` should only be used for macOS dependencies, not postgresql.
|
|
end
|
|
RUBY
|
|
end
|
|
end
|