rubocop/lines: extract whitelist to constant.

This commit is contained in:
Mike McQuaid 2020-04-11 14:19:47 +01:00
parent 2e74e50f82
commit 20998ed6e3
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -196,6 +196,26 @@ module RuboCop
end end
class Miscellaneous < FormulaCop class Miscellaneous < FormulaCop
MAKE_CHECK_WHITELIST = %w[
beecrypt
ccrypt
git
gmp
gnupg
gnupg@1.4
google-sparsehash
jemalloc
jpeg-turbo
mpfr
nettle
open-mpi
openssl@1.1
pcre
protobuf
wolfssl
xz
].freeze
def audit_formula(_node, _class_node, _parent_class_node, body_node) def audit_formula(_node, _class_node, _parent_class_node, body_node)
# FileUtils is included in Formula # FileUtils is included in Formula
# encfs modifies a file with this name, so check for some leading characters # encfs modifies a file with this name, so check for some leading characters
@ -425,25 +445,7 @@ module RuboCop
# Avoid build-time checks in homebrew/core # Avoid build-time checks in homebrew/core
find_every_method_call_by_name(body_node, :system).each do |method| find_every_method_call_by_name(body_node, :system).each do |method|
next if @formula_name.start_with?("lib") next if @formula_name.start_with?("lib")
next if %w[ next if MAKE_CHECK_WHITELIST.include?(@formula_name)
beecrypt
ccrypt
git
gmp
gnupg
gnupg@1.4
google-sparsehash
jemalloc
jpeg-turbo
mpfr
nettle
open-mpi
openssl@1.1
pcre
protobuf
wolfssl
xz
].include?(@formula_name)
params = parameters(method) params = parameters(method)
next unless node_equals?(params[0], "make") next unless node_equals?(params[0], "make")