<commit_before>module RSpec
  module Core
    class BacktraceCleaner

      DEFAULT_INCLUSION_PATTERNS = [Regexp.new(Dir.getwd)]
      DEFAULT_EXCLUSION_PATTERNS = [
        /\/lib\d*\/ruby\//,
        /org\/jruby\//,
        /bin\//,
        %r|/gems/|,
        /spec\/spec_helper\.rb/,
        /lib\/rspec\/(core|expectations|matchers|mocks)/
      ]

      attr_accessor :inclusion_patterns
      attr_accessor :exclusion_patterns

      def initialize(inclusion_patterns=DEFAULT_INCLUSION_PATTERNS.dup, exclusion_patterns=DEFAULT_EXCLUSION_PATTERNS.dup)
        @inclusion_patterns = inclusion_patterns
        @exclusion_patterns = exclusion_patterns
      end

      def exclude?(line)
        @inclusion_patterns.none? {|p| line =~ p} and @exclusion_patterns.any? {|p| line =~ p}
      end

      def full_backtrace=(true_or_false)
        @exclusion_patterns = true_or_false ? [] : DEFAULT_EXCLUSION_PATTERNS.dup
      end
    end
  end
end<commit_msg>Change the default inclusion behaviour of the backtrace cleaner<commit_after>module RSpec
  module Core
    class BacktraceCleaner

      DEFAULT_EXCLUSION_PATTERNS = [
        /\/lib\d*\/ruby\//,
        /org\/jruby\//,
        /bin\//,
        %r|/gems/|,
        /spec\/spec_helper\.rb/,
        /lib\/rspec\/(core|expectations|matchers|mocks)/
      ]

      attr_accessor :inclusion_patterns
      attr_accessor :exclusion_patterns

      def initialize(inclusion_patterns=nil, exclusion_patterns=DEFAULT_EXCLUSION_PATTERNS.dup)
        @exclusion_patterns = exclusion_patterns

        if inclusion_patterns.nil?
          @inclusion_patterns = (matches_an_exclusion_pattern? Dir.getwd) ? [Regexp.new(Dir.getwd)]
                                                                          : []
        else
          @inclusion_patterns = inclusion_patterns
        end
      end

      def exclude?(line)
        @inclusion_patterns.none? {|p| line =~ p} and matches_an_exclusion_pattern?(line)
      end

      def full_backtrace=(true_or_false)
        @exclusion_patterns = true_or_false ? [] : DEFAULT_EXCLUSION_PATTERNS.dup
      end

      private

      def matches_an_exclusion_pattern?(line)
        @exclusion_patterns.any? {|p| line =~ p}
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09991079393398751, 'fraction_numerical': 0.0, 'mean_word_length': 2.2936857562408224, 'pattern_counts': {'":': 0, '<': 3, '<?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': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1062770', 'n_tokens_mistral': 761, 'n_tokens_neox': 714, 'n_words': 114}