diff options
| author | Mike McQuaid | 2017-10-18 10:32:34 +0100 |
|---|---|---|
| committer | GitHub | 2017-10-18 10:32:34 +0100 |
| commit | 1d40061c69fd11ed5b05c94c46c6004d56b11acb (patch) | |
| tree | afc6725a25b0a9b68e533a9403836e9fc108d3c9 /Library | |
| parent | a5c8628ffb05b2af91dcd2b0039d62c574a6f120 (diff) | |
| parent | 85fa79b5cf6f1430d67ea5af7c10571caa1db5d7 (diff) | |
| download | brew-1d40061c69fd11ed5b05c94c46c6004d56b11acb.tar.bz2 | |
Merge pull request #3291 from JCount/lines-cop-fix-wine-universal-binary
lines_cop: add ENV.universal_binary audit exemption for wine
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/rubocops/lines_cop.rb | 1 | ||||
| -rw-r--r-- | Library/Homebrew/test/rubocops/lines_cop_spec.rb | 25 |
2 files changed, 21 insertions, 5 deletions
diff --git a/Library/Homebrew/rubocops/lines_cop.rb b/Library/Homebrew/rubocops/lines_cop.rb index 01b13585c..a45f673c6 100644 --- a/Library/Homebrew/rubocops/lines_cop.rb +++ b/Library/Homebrew/rubocops/lines_cop.rb @@ -121,6 +121,7 @@ module RuboCop end find_instance_method_call(body_node, "ENV", :universal_binary) do + next if @formula_name == "wine" problem "macOS has been 64-bit only since 10.6 so ENV.universal_binary is deprecated." end diff --git a/Library/Homebrew/test/rubocops/lines_cop_spec.rb b/Library/Homebrew/test/rubocops/lines_cop_spec.rb index 753439c8e..af816a5a9 100644 --- a/Library/Homebrew/test/rubocops/lines_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/lines_cop_spec.rb @@ -82,7 +82,7 @@ end describe RuboCop::Cop::FormulaAudit::Comments do subject(:cop) { described_class.new } - context "When auditing formula" do + context "When auditing formulae" do it "with commented cmake call" do source = <<-EOS.undent class Foo < Formula @@ -154,7 +154,7 @@ end describe RuboCop::Cop::FormulaAudit::Miscellaneous do subject(:cop) { described_class.new } - context "When auditing formula" do + context "When auditing formulae" do it "with FileUtils" do source = <<-EOS.undent class Foo < Formula @@ -380,7 +380,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end end - it "with build.universal? exempted formula" do + it "with a build.universal? exemption reports no offenses" do source = <<-EOS.undent class Wine < Formula desc "foo" @@ -392,7 +392,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do EOS inspect_source(source, "/homebrew-core/Formula/wine.rb") - expect(cop.offenses).to eq([]) + expect(cop.offenses).to be_empty end it "with ENV.universal_binary" do @@ -419,7 +419,22 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end end - it "with ENV.universal_binary" do + it "with an ENV.universal_binary exemption reports no offenses" do + source = <<-EOS.undent + class Wine < Formula + desc "foo" + url 'http://example.com/foo-1.0.tgz' + if build? + ENV.universal_binary + end + end + EOS + + inspect_source(source, "/homebrew-core/Formula/wine.rb") + expect(cop.offenses).to be_empty + end + + it "with ENV.x11" do source = <<-EOS.undent class Foo < Formula desc "foo" |
