From 3c9ee4b7475b7b6c58e39b6d9a0465583f025847 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 f8e052456..ac5486ea6 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