<commit_before>require 'rubocop'
module RuboCop
  class ConfigLoader
    RIDECHARGE_RUBOCOP_HOME = File.realpath(File.join(File.dirname(__FILE__), '..', '..'))
    DEFAULT_RIDECHARGE_FILE= File.join(RIDECHARGE_RUBOCOP_HOME, 'config', '0default.yml')

    # https://github.com/bbatsov/rubocop/blob/ff167d8f202baf7a68955db0aaf0dc29afb7e7ee/lib/rubocop/config_loader.rb#L88
=begin 
    def configuration_file_for(target_dir)
      config_files_in_path(target_dir).first || DEFAULT_FILE
    end
=end
    class << self
      def configuration_file_for(target_dir)
        $stderr.puts DEFAULT_RIDECHARGE_FILE
        config_files_in_path(target_dir).first || DEFAULT_RIDECHARGE_FILE
      end
    end
  end
end
<commit_msg>[ridecharge config] config loader monkeypatch<commit_after>require 'rubocop'
module Rubocop
  class ConfigLoader
    RIDECHARGE_RUBOCOP_HOME = File.realpath(File.join(File.dirname(__FILE__), '..', '..'))
    DEFAULT_RIDECHARGE_FILE= File.join(RIDECHARGE_RUBOCOP_HOME, 'config', '0default.yml')

    # https://github.com/bbatsov/rubocop/blob/ff167d8f202baf7a68955db0aaf0dc29afb7e7ee/lib/rubocop/config_loader.rb#L88
=begin 
      def configuration_file_for(target_dir)
        config_files_in_path(target_dir).first || DEFAULT_FILE
      end

      def configuration_from_file(config_file)
        config = load_file(config_file)
        return config if config_file == DEFAULT_FILE

        found_files = config_files_in_path(config_file)
        if found_files.any? && found_files.last != config_file
          print 'AllCops/Excludes ' if debug?
          add_excludes_from_higher_level(config, load_file(found_files.last))
        end
        make_excludes_absolute(config)
        merge_with_default(config, config_file)
      end
      def default_configuration
        @default_configuration ||= begin
                                     print 'Default ' if debug?
                                     load_file(DEFAULT_FILE)
                                   end
      end
=end
    class << self
      def configuration_file_for(target_dir)
        $stderr.puts [target_dir, DEFAULT_RIDECHARGE_FILE].inspect
        config_files_in_path(target_dir).first || DEFAULT_RIDECHARGE_FILE
      end
      def configuration_from_file(config_file)
        $stderr.puts [config_file, DEFAULT_RIDECHARGE_FILE].inspect
        config = load_file(config_file)
        return config if config_file == DEFAULT_RIDECHARGE_FILE

        found_files = config_files_in_path(config_file)
        if found_files.any? && found_files.last != config_file
          print 'AllCops/Excludes ' if debug?
          add_excludes_from_higher_level(config, load_file(found_files.last))
        end
        make_excludes_absolute(config)
        merge_with_default(config, config_file)
      end
      def default_configuration
        @default_configuration ||= begin
                                     print 'Ridecharge Default ' if debug?
                                     load_file(DEFAULT_RIDECHARGE_FILE)
                                   end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.07602339181286549, 'fraction_numerical': 0.014294996751137101, 'mean_word_length': 2.7457420924574207, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6875055', 'n_tokens_mistral': 1006, 'n_tokens_neox': 955, 'n_words': 147}