fix: return if no install def

Co-authored-by: Rylan Polster <rslpolster@gmail.com>
This commit is contained in:
Max Eisner 2022-09-06 01:03:04 +02:00
parent 2946752083
commit 088dce08d6
No known key found for this signature in database
GPG Key ID: 4BF122C22879F0C8

View File

@ -423,6 +423,7 @@ module RuboCop
def audit_formula(_node, _class_node, _parent_class_node, body_node)
install = find_method_def(body_node, :install)
return if install.blank?
correctable_shell_completion_node(install) do |node, shell, base_name, executable, subcmd, shell_parameter| # rubocop:disable Metrics/ParameterLists
# generate_completions_from_executable only applicable if shell is passed
@ -505,6 +506,7 @@ module RuboCop
def audit_formula(_node, _class_node, _parent_class_node, body_node)
install = find_method_def(body_node, :install)
return if install.blank?
methods = find_every_method_call_by_name(install, :generate_completions_from_executable)
return if methods.length <= 1