<commit_before>def apply_local_configuration(config, config_key)
  return unless ENV.key?(config_key.upcase)

  config.send("#{config_key}=".to_sym, ENV[config_key.upcase])
end

TrlnArgon::Engine.configure do |config|
  apply_local_configuration(config, 'local_institution_code')
  apply_local_configuration(config, 'application_name')
  apply_local_configuration(config, 'refworks_url')
  apply_local_configuration(config, 'root_url')
  apply_local_configuration(config, 'article_search_url')
  apply_local_configuration(config, 'citation_formats')
  apply_local_configuration(config, 'contact_url')
  apply_local_configuration(config, 'feedback_url')
  apply_local_configuration(config, 'sort_order_in_holding_list')
  apply_local_configuration(config, 'number_of_location_facets')
  apply_local_configuration(config, 'number_of_items_index_view')
  apply_local_configuration(config, 'number_of_items_show_view')
  apply_local_configuration(config, 'argon_code_mappings_dir')
  apply_local_configuration(config, 'paging_limit')
  apply_local_configuration(config, 'facet_paging_limit')
  apply_local_configuration(config, 'unc_latest_received_url')
  apply_local_configuration(config, 'solr_cache_exp_time')
  apply_local_configuration(config, 'allow_open_search')
  apply_local_configuration(config, 'open_search_q_min_length')
  apply_local_configuration(config, 'worldcat_cite_base_url')
  apply_local_configuration(config, 'worldcat_cite_api_key')

  mappings_options = {
    git_url: 'https://github.com/trln/argon_code_mappings',
    repo_base: config.argon_code_mappings_dir
  }

  # set this env var if you want to test changes without
  # having to use the default branch

  if ENV.key?('ARGON_MAPPINGS_BRANCH')
    mappings_options[:branch] = ENV['ARGON_MAPPINGS_BRANCH']
  end

  git_fetcher = TrlnArgon::MappingsGitFetcher.new(mappings_options)

  TrlnArgon::LookupManager.fetcher = git_fetcher
  # do a lookup so the mappings are initialized.
  TrlnArgon::LookupManager.instance.map('ncsu.library.DHHILL')
end

# Configure paging defaults
# Set max paging links to that set in Argon config (default 250).
# Set outer window to 0 to prevent direct access to deep pages.
Kaminari.configure do |config|
  config.max_pages = TrlnArgon::Engine.configuration.paging_limit.to_i
  config.outer_window = 0
end<commit_msg>that should not be a rule rubocop<commit_after>def apply_local_configuration(config, config_key)
  return unless ENV.key?(config_key.upcase)

  config.send("#{config_key}=".to_sym, ENV[config_key.upcase])
end

TrlnArgon::Engine.configure do |config|
  apply_local_configuration(config, 'local_institution_code')
  apply_local_configuration(config, 'application_name')
  apply_local_configuration(config, 'refworks_url')
  apply_local_configuration(config, 'root_url')
  apply_local_configuration(config, 'article_search_url')
  apply_local_configuration(config, 'citation_formats')
  apply_local_configuration(config, 'contact_url')
  apply_local_configuration(config, 'feedback_url')
  apply_local_configuration(config, 'sort_order_in_holding_list')
  apply_local_configuration(config, 'number_of_location_facets')
  apply_local_configuration(config, 'number_of_items_index_view')
  apply_local_configuration(config, 'number_of_items_show_view')
  apply_local_configuration(config, 'argon_code_mappings_dir')
  apply_local_configuration(config, 'paging_limit')
  apply_local_configuration(config, 'facet_paging_limit')
  apply_local_configuration(config, 'unc_latest_received_url')
  apply_local_configuration(config, 'solr_cache_exp_time')
  apply_local_configuration(config, 'allow_open_search')
  apply_local_configuration(config, 'open_search_q_min_length')
  apply_local_configuration(config, 'worldcat_cite_base_url')
  apply_local_configuration(config, 'worldcat_cite_api_key')

  mappings_options = {
    git_url: 'https://github.com/trln/argon_code_mappings',
    repo_base: config.argon_code_mappings_dir
  }

  # set this env var if you want to test changes without
  # having to use the default branch

  mappings_options[:branch] = ENV['ARGON_MAPPINGS_BRANCH'] if ENV.key?('ARGON_MAPPINGS_BRANCH')

  git_fetcher = TrlnArgon::MappingsGitFetcher.new(mappings_options)

  TrlnArgon::LookupManager.fetcher = git_fetcher
  # do a lookup so the mappings are initialized.
  TrlnArgon::LookupManager.instance.map('ncsu.library.DHHILL')
end

# Configure paging defaults
# Set max paging links to that set in Argon config (default 250).
# Set outer window to 0 to prevent direct access to deep pages.
Kaminari.configure do |config|
  config.max_pages = TrlnArgon::Engine.configuration.paging_limit.to_i
  config.outer_window = 0
end
{'fraction_non_alphanumeric': 0.08876500857632934, 'fraction_numerical': 0.002144082332761578, 'mean_word_length': 7.936781609195402, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5980703', 'n_tokens_mistral': 1540, 'n_tokens_neox': 1507, 'n_words': 264}