style: env :userpaths is deprecated
This commit is contained in:
parent
1e943d7b6f
commit
63b81d847a
@ -867,9 +867,6 @@ module Homebrew
|
|||||||
|
|
||||||
return unless @strict
|
return unless @strict
|
||||||
|
|
||||||
# TODO: check could be in RuboCop
|
|
||||||
problem "`env :userpaths` in formulae is deprecated" if line.include?("env :userpaths")
|
|
||||||
|
|
||||||
# TODO: check could be in RuboCop
|
# TODO: check could be in RuboCop
|
||||||
problem "`#{Regexp.last_match(1)}` is now unnecessary" if line =~ /(require ["']formula["'])/
|
problem "`#{Regexp.last_match(1)}` is now unnecessary" if line =~ /(require ["']formula["'])/
|
||||||
|
|
||||||
|
|||||||
@ -80,6 +80,10 @@ module RuboCop
|
|||||||
problem "`go_resource`s are deprecated. Please ask upstream to implement Go vendoring"
|
problem "`go_resource`s are deprecated. Please ask upstream to implement Go vendoring"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
find_method_with_args(body_node, :env, :userpaths) do
|
||||||
|
problem "`env :userpaths` in homebrew/core formulae is deprecated"
|
||||||
|
end
|
||||||
|
|
||||||
return unless formula_tap == "homebrew-core"
|
return unless formula_tap == "homebrew-core"
|
||||||
|
|
||||||
find_method_with_args(body_node, :env, :std) do
|
find_method_with_args(body_node, :env, :std) do
|
||||||
|
|||||||
@ -233,6 +233,17 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do
|
|||||||
subject(:cop) { described_class.new }
|
subject(:cop) { described_class.new }
|
||||||
|
|
||||||
context "When auditing formula text" do
|
context "When auditing formula text" do
|
||||||
|
it "when deprecated `env :userpaths` is present" do
|
||||||
|
expect_offense(<<~RUBY)
|
||||||
|
class Foo < Formula
|
||||||
|
url "https://brew.sh/foo-1.0.tgz"
|
||||||
|
|
||||||
|
env :userpaths
|
||||||
|
^^^^^^^^^^^^^^ `env :userpaths` in homebrew/core formulae is deprecated
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
end
|
||||||
|
|
||||||
it "when deprecated `env :std` is present in homebrew-core" do
|
it "when deprecated `env :std` is present in homebrew-core" do
|
||||||
expect_offense(<<~RUBY, "/homebrew-core/")
|
expect_offense(<<~RUBY, "/homebrew-core/")
|
||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user