<commit_before>module LicenseFinder
  class Finder

    attr_reader :whitelist, :ignore_groups
    def initialize
      if File.exists?('./config/license_finder.yml')
        config = YAML.load(File.open('./config/license_finder.yml').readlines.join)
        @whitelist = config['whitelist'] || []
        @ignore_groups = config['ignore_groups'] ? config['ignore_groups'].map{|g| g.to_sym} : []
      end
    end

    def from_bundler
      require 'bundler'
      Bundler.load.specs.map { |spec| GemSpecDetails.new(spec) }.sort_by &:sort_order
    end

    def write_files
      new_list = generate_list

      File.open('./dependencies.yml', 'w+') do |f|
        f.puts new_list.to_yaml
      end
      File.open('./dependencies.txt', 'w+') do |f|
        f.puts new_list.to_s
      end

    end

    def action_items
      new_list = generate_list
      new_list.action_items
    end

    private
    def generate_list
      bundler_list = DependencyList.from_bundler(whitelist)
<commit_msg>add bundler ignore groups to config<commit_after>module LicenseFinder
  class Finder

    attr_reader :whitelist, :ignore_groups
    def initialize
      if File.exists?('./config/license_finder.yml')
        config = YAML.load(File.open('./config/license_finder.yml').readlines.join)
        @whitelist = config['whitelist'] || []
        @ignore_groups = config['ignore_groups'] ? config['ignore_groups'].map{|g| g.to_sym} : []
      end
    end

    def from_bundler
      require 'bundler'
      Bundler.load.specs.map { |spec| GemSpecDetails.new(spec) }.sort_by &:sort_order
    end

    def write_files
      new_list = generate_list

      File.open('./dependencies.yml', 'w+') do |f|
        f.puts new_list.to_yaml
      end
      File.open('./dependencies.txt', 'w+') do |f|
        f.puts new_list.to_s
      end

    end

    def action_items
      new_list = generate_list
      new_list.action_items
    end

    private
    def generate_list
      bundler_list = DependencyList.from_bundler(whitelist, ignore_groups)

{'fraction_non_alphanumeric': 0.1139615194869265, 'fraction_numerical': 0.0, 'mean_word_length': 2.680580762250454, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3801773', 'n_tokens_mistral': 685, 'n_tokens_neox': 658, 'n_words': 128}