<commit_before>class Recipes::Rails < Rails::AppBuilder
  def create
    gather_gem("bootsnap", require: false)
    gather_gems(:development) do
      gather_gem("spring")
    end

    environment 'config.force_ssl = true', env: 'production'

    line = "Rails.application.config.content_security_policy_nonce_generator = \
-> request { SecureRandom.base64(16) }"
    initializer = "config/initializers/content_security_policy.rb"
    gsub_file initializer, /(#{Regexp.escape(line)})/mi do |_match|
      <<~HERE.chomp
        # Rails.application.config.content_security_policy_nonce_generator = -> request do
        #   SecureRandom.base64(16)
        # end
      HERE
    end
  end
end<commit_msg>refactor(rails): move disabling generator logic to method<commit_after>class Recipes::Rails < Rails::AppBuilder
  def create
    gather_gem("bootsnap", require: false)
    gather_gems(:development) do
      gather_gem("spring")
    end

    environment 'config.force_ssl = true', env: 'production'
    disable_automatic_nonce_generation
  end

  def disable_automatic_nonce_generation
    line = "Rails.application.config.content_security_policy_nonce_generator = \
-> request { SecureRandom.base64(16) }"
    initializer = "config/initializers/content_security_policy.rb"
    gsub_file initializer, /(#{Regexp.escape(line)})/mi do |_match|
      <<~HERE.chomp
        # Rails.application.config.content_security_policy_nonce_generator = -> request do
        #   SecureRandom.base64(16)
        # end
      HERE
    end
  end
end
{'fraction_non_alphanumeric': 0.10522875816993464, 'fraction_numerical': 0.01045751633986928, 'mean_word_length': 3.739938080495356, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '1982206', 'n_tokens_mistral': 497, 'n_tokens_neox': 474, 'n_words': 85}