style: env :std deprecated in homebrew-core

This commit is contained in:
Rylan Polster 2020-07-05 11:42:16 -04:00
parent bd8805b14f
commit 1e943d7b6f
4 changed files with 25 additions and 6 deletions

View File

@ -887,11 +887,6 @@ module Homebrew
# TODO: check could be in RuboCop # TODO: check could be in RuboCop
problem "Use pkgshare instead of (share#{Regexp.last_match(1)}\"#{formula.name}\")" problem "Use pkgshare instead of (share#{Regexp.last_match(1)}\"#{formula.name}\")"
end end
return unless @core_tap
# TODO: check could be in RuboCop
problem "`env :std` in homebrew/core formulae is deprecated" if line.include?("env :std")
end end
def audit_reverse_migration def audit_reverse_migration

View File

@ -79,6 +79,12 @@ module RuboCop
find_method_with_args(body_node, :go_resource) do find_method_with_args(body_node, :go_resource) do
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
return unless formula_tap == "homebrew-core"
find_method_with_args(body_node, :env, :std) do
problem "`env :std` in homebrew/core formulae is deprecated"
end
end end
end end
end end

View File

@ -21,7 +21,7 @@ RSpec/InstanceVariable:
- 'utils/git_spec.rb' - 'utils/git_spec.rb'
- 'version_spec.rb' - 'version_spec.rb'
# Offense count: 74 # Offense count: 75
RSpec/MultipleDescribes: RSpec/MultipleDescribes:
Exclude: Exclude:
- 'ENV_spec.rb' - 'ENV_spec.rb'
@ -94,6 +94,7 @@ RSpec/MultipleDescribes:
- 'rubocops/class_spec.rb' - 'rubocops/class_spec.rb'
- 'rubocops/formula_desc_spec.rb' - 'rubocops/formula_desc_spec.rb'
- 'rubocops/lines_spec.rb' - 'rubocops/lines_spec.rb'
- 'rubocops/text_spec.rb'
- 'rubocops/urls_spec.rb' - 'rubocops/urls_spec.rb'
- 'software_spec_spec.rb' - 'software_spec_spec.rb'
- 'tap_spec.rb' - 'tap_spec.rb'

View File

@ -228,3 +228,20 @@ describe RuboCop::Cop::FormulaAudit::Text do
end end
end end
end end
describe RuboCop::Cop::FormulaAuditStrict::Text do
subject(:cop) { described_class.new }
context "When auditing formula text" do
it "when deprecated `env :std` is present in homebrew-core" do
expect_offense(<<~RUBY, "/homebrew-core/")
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
env :std
^^^^^^^^ `env :std` in homebrew/core formulae is deprecated
end
RUBY
end
end
end