<commit_before>class StyleStats
  class CLI
    class << self
      def run(files, option)
        @options = option
        stylestats = StyleStats.new(files, options)
        stylestats.render
      rescue StyleStats::RequestError
        puts '[ERROR] getaddrinfo ENOTFOUND'
      rescue StyleStats::ContentError
        puts '[ERROR] Content type is not HTML or CSS!'
      rescue StyleStats::InvalidError
        puts '[ERROR] Argument is invalid'
      end

      private
      def options
        {
          format: @options[:format],
          user_agent: user_agent
        }
      end

      def user_agent
        case @options[:user_agent]
        when 'ios'
          'Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.4 Version/8.0 Safari/600.1.4'
        when 'android'
          'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.99 Mobile Safari/537.36'
        else
          @options[:user_agent]
        end
      end
    end
  end
end<commit_msg>add read config file<commit_after>class StyleStats
  class CLI
    class << self
      def run(files, option)
        @options = option
        stylestats = StyleStats.new(files, options)
        stylestats.render
      rescue StyleStats::RequestError
        puts '[ERROR] getaddrinfo ENOTFOUND'
      rescue StyleStats::ContentError
        puts '[ERROR] Content type is not HTML or CSS!'
      rescue StyleStats::InvalidError
        puts '[ERROR] Argument is invalid'
      end

      private
      def options
        {
          format: @options[:format],
          user_agent: user_agent
        }
      end

      def user_agent
        case @options[:user_agent]
        when 'ios'
          'Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.4 Version/8.0 Safari/600.1.4'
        when 'android'
          'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.99 Mobile Safari/537.36'
        else
          @options[:user_agent]
        end
      end

      def configuration
        config = case File.extname(@options[:config])
                 when '.yml', '.yaml'
                   YAML.load_file(@options[:config])
                 when '.json'
                   json = File.read(@options[:config])
                   JSON.parse(json)
                 end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09117043121149897, 'fraction_numerical': 0.035318275154004104, 'mean_word_length': 1.8591549295774648, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7520433', 'n_tokens_mistral': 776, 'n_tokens_neox': 725, 'n_words': 198}