Sha256: 9ca8d7ceb98313daac70947dba98e59d5fe7c3ebdefca687180a8cb057c651cc

Contents?: true

Size: 1.18 KB

Versions: 15

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

$VERBOSE = true
Warning[:deprecated] = true

module ActiveSupport
  module RaiseWarnings # :nodoc:
    PROJECT_ROOT = File.expand_path("../../../../", __dir__)
    ALLOWED_WARNINGS = Regexp.union(
      /circular require considered harmful.*delayed_job/, # Bug in delayed job.

      # Expected non-verbose warning emitted by Rails.
      /Ignoring .*\.yml because it has expired/,
      /Failed to validate the schema cache because/,
    )

    SUPPRESSED_WARNINGS = Regexp.union(
      # TODO: remove if https://github.com/mikel/mail/pull/1557 or similar fix
      %r{/lib/mail/parsers/.*statement not reached},
      %r{/lib/mail/parsers/.*assigned but unused variable - disp_type_s},
      %r{/lib/mail/parsers/.*assigned but unused variable - testEof}
    )

    def warn(message, *)
      return if SUPPRESSED_WARNINGS.match?(message)

      super

      return unless message.include?(PROJECT_ROOT)
      return if ALLOWED_WARNINGS.match?(message)
      return unless ENV["RAILS_STRICT_WARNINGS"] || ENV["CI"]

      raise message
    end
    ruby2_keywords :warn if respond_to?(:ruby2_keywords, true)
  end
end

Warning.singleton_class.prepend(ActiveSupport::RaiseWarnings)

Version data entries

15 entries across 15 versions & 6 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/testing/strict_warnings.rb
activesupport-7.1.5.1 lib/active_support/testing/strict_warnings.rb
activesupport-7.1.5 lib/active_support/testing/strict_warnings.rb
activesupport-7.1.4.2 lib/active_support/testing/strict_warnings.rb
activesupport-7.1.4.1 lib/active_support/testing/strict_warnings.rb
activesupport-7.1.4 lib/active_support/testing/strict_warnings.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/testing/strict_warnings.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/activesupport-7.1.3.4/lib/active_support/testing/strict_warnings.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/activesupport-7.1.3.4/lib/active_support/testing/strict_warnings.rb
activesupport-7.1.3.4 lib/active_support/testing/strict_warnings.rb
activesupport-7.1.3.2 lib/active_support/testing/strict_warnings.rb
activesupport-7.1.3.1 lib/active_support/testing/strict_warnings.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3/lib/active_support/testing/strict_warnings.rb
activesupport-7.1.3 lib/active_support/testing/strict_warnings.rb
activesupport-7.1.2 lib/active_support/testing/strict_warnings.rb