lib/rubocop/minitest/assert_offense.rb in rubocop-minitest-0.34.5 vs lib/rubocop/minitest/assert_offense.rb in rubocop-minitest-0.35.0

- old
+ new

@@ -184,19 +184,13 @@ file.write(source) file.rewind file = file.path end - processed_source = RuboCop::ProcessedSource.new(source, ruby_version, file) - - # Follow up https://github.com/rubocop/rubocop/pull/10987. - # When support for RuboCop 1.37.1 ends, this condition can be removed. - if processed_source.respond_to?(:config) && processed_source.respond_to?(:registry) - processed_source.config = configuration - processed_source.registry = registry - end - + processed_source = RuboCop::ProcessedSource.new(source, ruby_version, file, parser_engine: parser_engine) + processed_source.config = configuration + processed_source.registry = registry processed_source end def configuration @configuration ||= if defined?(config) @@ -214,10 +208,15 @@ RuboCop::Cop::Registry.new(cops) end end def ruby_version - RuboCop::TargetRuby::DEFAULT_VERSION + # Prism supports parsing Ruby 3.3+. + ENV['PARSER_ENGINE'] == 'parser_prism' ? 3.3 : RuboCop::TargetRuby::DEFAULT_VERSION + end + + def parser_engine + ENV.fetch('PARSER_ENGINE', :parser_whitequark).to_sym end end # rubocop:enable Metrics/ModuleLength end end