<commit_before># Rails 3.x hooks

require "rails"
require "bugsnag"
require "bugsnag/middleware/rails3_request"
require "bugsnag/middleware/rack_request"

module Bugsnag
  class Railtie < Rails::Railtie

    FRAMEWORK_ATTRIBUTES = {
      :framework => "Rails"
    }

    rake_tasks do
      require "bugsnag/integrations/rake"
      load "bugsnag/tasks/bugsnag.rake"
    end

    # send notifications if a command fails in a 'rails runner' call
    if self.respond_to? :runner
      runner do
        at_exit do
          if $!
            Bugsnag.notify($!, true) do |report|
              report.severity = "error"
              report.severity_reason = {
                :type => Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE,
                :attributes => FRAMEWORK_ATTRIBUTES
              }
            end
          end
        end
      end
    end

    config.before_initialize do
      # Configure bugsnag rails defaults<commit_msg>docs(rails): Indicate why API key validation is skipped<commit_after># Rails 3.x hooks

require "rails"
require "bugsnag"
require "bugsnag/middleware/rails3_request"
require "bugsnag/middleware/rack_request"

module Bugsnag
  class Railtie < Rails::Railtie

    FRAMEWORK_ATTRIBUTES = {
      :framework => "Rails"
    }

    rake_tasks do
      require "bugsnag/integrations/rake"
      load "bugsnag/tasks/bugsnag.rake"
    end

    # send notifications if a command fails in a 'rails runner' call
    if self.respond_to? :runner
      runner do
        at_exit do
          if $!
            Bugsnag.notify($!, true) do |report|
              report.severity = "error"
              report.severity_reason = {
                :type => Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE,
                :attributes => FRAMEWORK_ATTRIBUTES
              }
            end
          end
        end
      end
    end

    config.before_initialize do
      # Configure bugsnag rails defaults
      # Skipping API key validation as the key may be set later in an
      # initializer. If not, the key will be validated in after_initialize.
{'fraction_non_alphanumeric': 0.075, 'fraction_numerical': 0.0019230769230769232, 'mean_word_length': 2.157814871016692, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '1194042', 'n_tokens_mistral': 665, 'n_tokens_neox': 609, 'n_words': 165}