From 119a2636d06472008600790ea78baad6f2e94649 Mon Sep 17 00:00:00 2001 From: Sam Bostock Date: Fri, 26 Jan 2024 02:18:17 -0500 Subject: [PATCH] Rely on requiring `rubocop-ast` in extension Extensions are loaded before the host application, and we need to ensure we patch the class before the macros are used. --- lib/tapioca/dsl/extensions/rubocop.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/tapioca/dsl/extensions/rubocop.rb b/lib/tapioca/dsl/extensions/rubocop.rb index f8e052456b..ac5486ea64 100644 --- a/lib/tapioca/dsl/extensions/rubocop.rb +++ b/lib/tapioca/dsl/extensions/rubocop.rb @@ -1,7 +1,11 @@ # typed: strict # frozen_string_literal: true -return unless defined?(RuboCop::AST::NodePattern::Macros) +begin + require "rubocop-ast" +rescue LoadError + return +end module Tapioca module Dsl