<commit_before>module PreparerMD

  # Configuration values and credentials read from the process' environment.
  #
  class Config
    attr_reader :content_store_url, :content_store_apikey, :content_id_base


    # Create a new configuration populated with values from the environment.
    #
    def initialize
      @content_store_url = ENV.fetch('CONTENT_STORE_URL', '').gsub(%r{/\Z}, '')
      @content_store_apikey = ENV['CONTENT_STORE_APIKEY']
      @content_id_base = ENV.fetch('CONTENT_ID_BASE', '').gsub(%r{/\Z}, '')
    end

    # Determine and report (to stderr) whether or not we have enough information to submit to the
    # content service.
    #
    def validate
      reasons = []

      if @content_store_url.empty?
        reasons << "CONTENT_STORE_URL is missing. It should be the base URL of the content " \
          "storage service."
      end

      if @content_store_apikey.empty?
        reasons << "CONTENT_STORE_APIKEY is missing. It should be a valid API key issued by the " \
          "content service."
      end

      if @content_id_base.empty?
        reasons << "CONTENT_ID_BASE is missing. It should be the common prefix used to generate " \
          "IDs for content within this repository."
      end

      if ENV['TRAVIS_PULL_REQUEST'] != "false"
        reasons << "This looks like a pull request build on Travis."
      end<commit_msg>Don't die on missing a missing API key.<commit_after>module PreparerMD

  # Configuration values and credentials read from the process' environment.
  #
  class Config
    attr_reader :content_store_url, :content_store_apikey, :content_id_base


    # Create a new configuration populated with values from the environment.
    #
    def initialize
      @content_store_url = ENV.fetch('CONTENT_STORE_URL', '').gsub(%r{/\Z}, '')
      @content_store_apikey = ENV.fetch('CONTENT_STORE_APIKEY', '')
      @content_id_base = ENV.fetch('CONTENT_ID_BASE', '').gsub(%r{/\Z}, '')
    end

    # Determine and report (to stderr) whether or not we have enough information to submit to the
    # content service.
    #
    def validate
      reasons = []

      if @content_store_url.empty?
        reasons << "CONTENT_STORE_URL is missing. It should be the base URL of the content " \
          "storage service."
      end

      if @content_store_apikey.empty?
        reasons << "CONTENT_STORE_APIKEY is missing. It should be a valid API key issued by the " \
          "content service."
      end

      if @content_id_base.empty?
        reasons << "CONTENT_ID_BASE is missing. It should be the common prefix used to generate " \
          "IDs for content within this repository."
      end

      if ENV['TRAVIS_PULL_REQUEST'] != "false"
        reasons << "This looks like a pull request build on Travis."
      end
{'fraction_non_alphanumeric': 0.08882521489971347, 'fraction_numerical': 0.0, 'mean_word_length': 2.7794316644113666, 'pattern_counts': {'":': 0, '<': 19, '<?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': '3185910', 'n_tokens_mistral': 825, 'n_tokens_neox': 809, 'n_words': 270}