Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions common/spec/warning_monkey_patch.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# frozen_string_literal: true

ALLOW_PATTERNS = [
# Ignore parser warnings for ruby 2.7 minor version mismatches
# TODO: Fix these by upgrading to ruby 2.7.3 (requires ubuntu upgrade)
# Ignore parser warnings for ruby 2.7 minor version mismatches.
# This is a recurring issue that occurs whenever the parser gets
# ahead of our installed ruby version.
%r{parser/current is loading parser/ruby27},
/2.7.\d-compliant syntax, but you are running 2.7.\d/,
Copy link
Copy Markdown
Member Author

@jeffwidman jeffwidman Apr 22, 2022

Choose a reason for hiding this comment

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

I am unclear why these first two lines are separate patterns, when the matching error line is a single line:

parser/current is loading parser/ruby27, which recognizes2.7.6-compliant syntax, but you are running 2.7.5.

This code was originally added here: https://github.com/dependabot/dependabot-core/pull/3913/files#diff-ccda7b2806a38f2ed3bdb918dd76c7720fd55e0d5c825f4d961edde095e97af4R3-R9 but that doesn't provide much context... @feelepxyz do you recall why?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just did a quick Google search for "compliant syntax, but you are running " and saw an issue wherein someone had the message displayed as:

warning: parser/current is loading parser/ruby22, which recognizes
warning: 2.2.3-compliant syntax, but you are running 2.2.4.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.

I'd expect ALLOW_PATTERNS.none? { |pattern| pattern =~ message } to nicely handle that case and the case you quoted 🙂

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah, that makes perfect sense, thank you @landongrindheim!

%r{whitequark/parser}
Expand Down