<commit_before>require "guard"
require "guard/plugin"

module Guard
  class Teaspoon < Plugin
    require "guard/teaspoon/resolver"
    require "guard/teaspoon/runner"

    attr_accessor :runner, :resolver, :failed_paths, :last_failed

    def initialize(options = {})
      super
      @options = {
        focus_on_failed:      false,
        all_after_pass:       true,
        all_on_start:         true,
        keep_failed:          true,
        formatters:           'clean',
        run_all:              {},
        run_on_modifications: {}
      }.merge(options)
    end

    def start
      reload
      @resolver = Resolver.new(@options)
      @runner = Runner.new(@options)
      UI.info "Guard::Teaspoon is running"
      run_all if @options[:all_on_start]
    end

    def run_all
      passed = @runner.run_all(@options[:run_all])

      if passed
        notify(:success)
        reload
        true
      else
        notify(:failed)
        @last_failed = true
        throw :task_has_failed
      end
    end

    def reload
      @last_failed = false
      @failed_paths = []
    end

    def run_on_modifications(original_paths)
      @resolver.resolve(original_paths)<commit_msg>really run all tests<commit_after>require "guard"
require "guard/plugin"

module Guard
  class Teaspoon < Plugin
    require "guard/teaspoon/resolver"
    require "guard/teaspoon/runner"

    attr_accessor :runner, :resolver, :failed_paths, :last_failed

    def initialize(options = {})
      super
      @options = {
        focus_on_failed:      false,
        all_after_pass:       true,
        all_on_start:         true,
        keep_failed:          true,
        formatters:           'clean',
        run_all:              {},
        run_on_modifications: {}
      }.merge(options)
    end

    def start
      reload
      @resolver = Resolver.new(@options)
      @runner = Runner.new(@options)
      UI.info "Guard::Teaspoon is running"
      run_all if @options[:all_on_start]
    end

    def run_all
      # run all tests instead of running only the last run tests
      @options.delete :files
      passed = @runner.run_all(@options[:run_all])

      if passed
        notify(:success)
        reload
        true
      else
        notify(:failed)
        @last_failed = true
        throw :task_has_failed
      end
    end

    def reload
      @last_failed = false
      @failed_paths = []
    end

    def run_on_modifications(original_paths)
      @resolver.resolve(original_paths)
{'fraction_non_alphanumeric': 0.086158755484643, 'fraction_numerical': 0.0, 'mean_word_length': 1.9892729439809296, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4187931', 'n_tokens_mistral': 767, 'n_tokens_neox': 742, 'n_words': 169}