Skip to content

Commit

Permalink
Merge pull request #10567 from MikeMcQuaid/env-ci-rubocop
Browse files Browse the repository at this point in the history
rubocops/lines: check for `if ENV["CI"]` usage.
  • Loading branch information
MikeMcQuaid authored Feb 12, 2021
2 parents 019b8fc + e8c71ae commit e2cbc91
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Library/Homebrew/rubocops/lines.rb
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,15 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
problem "`depends_on` can take requirement classes instead of instances"
end

find_instance_method_call(body_node, "ENV", :[]) do |method|
next unless modifier?(method.parent)

param = parameters(method).first
next unless node_equals?(param, "CI")

problem 'Don\'t use ENV["CI"] for Homebrew CI checks.'
end

find_instance_method_call(body_node, "Dir", :[]) do |method|
next unless parameters(method).size == 1

Expand Down

0 comments on commit e2cbc91

Please sign in to comment.