Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress output from mail parser warnings #47484

Merged
merged 2 commits into from Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions actionmailbox/test/test_helper.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require "active_support/testing/strict_warnings"

ENV["RAILS_ENV"] = "test"
ENV["RAILS_INBOUND_EMAIL_PASSWORD"] = "tbsy84uSV1Kt3ZJZELY2TmShPRs91E3yL4tzf96297vBCkDWgL"

Expand Down
2 changes: 2 additions & 0 deletions actiontext/test/test_helper.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require "active_support/testing/strict_warnings"

# Configure Rails Environment
ENV["RAILS_ENV"] = "test"

Expand Down
9 changes: 9 additions & 0 deletions activesupport/lib/active_support/testing/strict_warnings.rb
Expand Up @@ -12,7 +12,16 @@ module RaiseWarnings
/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},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I'll investigate... that's what I get for only running Action Mailer locally:
https://buildkite.com/rails/rails/builds/94131#01868059-d79a-43f7-9b4c-4e392240a572

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, right it seem to fix actionmailer, but not actionmailbox.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ba028a4 should fix it, I can squash if you think they should go together

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah it's ok

%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)
Expand Down