<commit_before>require_relative "./helper"

class TestColorThreshold < Minitest::Test
  include Linguist

  def test_color_threshold
    langs_with_colors = Language.all.reject { |language| language.color.nil? }
    cp = ColorProximity.new(20, langs_with_colors.map(&:color))
    failing_threshold = []
    langs_with_colors.each do |lang|
      state = cp.within_threshold?(lang.color[1..-1])
      unless state.first
        failing_threshold << [lang, state.last]
      end
    end
    message = "The following languages have failing color thresholds. Please modify the hex color.\n#{failing_threshold}"<commit_msg>Drop threshold back down to a passing 10<commit_after>require_relative "./helper"

class TestColorThreshold < Minitest::Test
  include Linguist

  def test_color_threshold
    langs_with_colors = Language.all.reject { |language| language.color.nil? }
    cp = ColorProximity.new(10, langs_with_colors.map(&:color))
    failing_threshold = []
    langs_with_colors.each do |lang|
      state = cp.within_threshold?(lang.color[1..-1])
      unless state.first
        failing_threshold << [lang, state.last]
      end
    end
    message = "The following languages have failing color thresholds. Please modify the hex color.\n#{failing_threshold}"
{'fraction_non_alphanumeric': 0.0997624703087886, 'fraction_numerical': 0.00791765637371338, 'mean_word_length': 3.8615384615384616, 'pattern_counts': {'":': 0, '<': 9, '<?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': '7122817', 'n_tokens_mistral': 382, 'n_tokens_neox': 377, 'n_words': 90}