<commit_before># frozen_string_literal: true

require 'cucumber/platform'

module Cucumber
  module Formatter
    @backtrace_filters = %w[
      /vendor/rails
      lib/cucumber
      bin/cucumber:
      lib/rspec
      gems/
      minitest
      test/unit
      .gem/ruby
      bin/bundle
    ]

    @backtrace_filters << RbConfig::CONFIG['rubyarchdir'] if RbConfig::CONFIG['rubyarchdir']
    @backtrace_filters << RbConfig::CONFIG['rubylibdir'] if RbConfig::CONFIG['rubylibdir']

    @backtrace_filters << 'org/jruby/' if ::Cucumber::JRUBY

    BACKTRACE_FILTER_PATTERNS = Regexp.new(@backtrace_filters.join('|'))

    class BacktraceFilter
      def initialize(exception)
        @exception = exception
      end

      def exception
        return @exception if ::Cucumber.use_full_backtrace

        pwd_pattern = /#{::Regexp.escape(::Dir.pwd)}\//m # rubocop:disable Style/RegexpLiteral
        backtrace = @exception.backtrace.map { |line| line.gsub(pwd_pattern, './') }

        filtered = (backtrace || []).reject do |line|
          line =~ BACKTRACE_FILTER_PATTERNS
        end

        if ::ENV['CUCUMBER_TRUNCATE_OUTPUT']
          # Strip off file locations<commit_msg>Filter out bundler in backtrace<commit_after># frozen_string_literal: true

require 'cucumber/platform'

module Cucumber
  module Formatter
    @backtrace_filters = %w[
      /vendor/rails
      lib/cucumber
      bin/cucumber:
      lib/rspec
      gems/
      bundler/
      minitest
      test/unit
      .gem/ruby
      bin/bundle
    ]

    @backtrace_filters << RbConfig::CONFIG['rubyarchdir'] if RbConfig::CONFIG['rubyarchdir']
    @backtrace_filters << RbConfig::CONFIG['rubylibdir'] if RbConfig::CONFIG['rubylibdir']

    @backtrace_filters << 'org/jruby/' if ::Cucumber::JRUBY

    BACKTRACE_FILTER_PATTERNS = Regexp.new(@backtrace_filters.join('|'))

    class BacktraceFilter
      def initialize(exception)
        @exception = exception
      end

      def exception
        return @exception if ::Cucumber.use_full_backtrace

        pwd_pattern = /#{::Regexp.escape(::Dir.pwd)}\//m # rubocop:disable Style/RegexpLiteral
        backtrace = @exception.backtrace.map { |line| line.gsub(pwd_pattern, './') }

        filtered = (backtrace || []).reject do |line|
          line =~ BACKTRACE_FILTER_PATTERNS
        end

        if ::ENV['CUCUMBER_TRUNCATE_OUTPUT']
          # Strip off file locations
{'fraction_non_alphanumeric': 0.11556111806424697, 'fraction_numerical': 0.0, 'mean_word_length': 2.886547811993517, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6975428', 'n_tokens_mistral': 800, 'n_tokens_neox': 759, 'n_words': 142}