From 1717e871671a4c8ea8a903b750f53c58d88c678a Mon Sep 17 00:00:00 2001 From: Jaime Rave Torres Date: Thu, 27 Aug 2020 12:54:32 +0200 Subject: [PATCH 1/2] Add workaround for bug in truffleruby --- lib/rubocop/cop/utils/format_string.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/rubocop/cop/utils/format_string.rb b/lib/rubocop/cop/utils/format_string.rb index 96de5f8f18f..4d130b6dca5 100644 --- a/lib/rubocop/cop/utils/format_string.rb +++ b/lib/rubocop/cop/utils/format_string.rb @@ -111,11 +111,9 @@ def max_digit_dollar_num private def parse - @source.to_enum(:scan, SEQUENCE).map do - FormatSequence.new( - Regexp.last_match - ) - end + matches = [] + @source.scan(SEQUENCE) { matches << FormatSequence.new(Regexp.last_match) } + matches end def mixed_formats? From 9640e544677e431a7a6fa2b741c41717fd9f2f9e Mon Sep 17 00:00:00 2001 From: Jaime Rave Torres Date: Thu, 27 Aug 2020 15:11:27 +0200 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 588b834a949..4ca699a8548 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ * [#8513](https://github.com/rubocop-hq/rubocop/pull/8513): Clarify the ruby warning mentioned in the `Lint/ShadowingOuterLocalVariable` documentation. ([@chocolateboy][]) * [#8517](https://github.com/rubocop-hq/rubocop/pull/8517): Make `Style/HashTransformKeys` and `Style/HashTransformValues` aware of `to_h` with block. ([@eugeneius][]) * [#8529](https://github.com/rubocop-hq/rubocop/pull/8529): Mark `Lint/FrozenStringLiteralComment` as `Safe`, but with unsafe auto-correction. ([@marcandre][]) +* [#8602](https://github.com/rubocop-hq/rubocop/pull/8602): Fix usage of `to_enum(:scan, regexp)` to work on TruffleRuby. ([@jaimerave][]) ## 0.89.1 (2020-08-10) @@ -4817,3 +4818,4 @@ [@nguyenquangminh0711]: https://github.com/nguyenquangminh0711 [@chocolateboy]: https://github.com/chocolateboy [@Lykos]: https://github.com/Lykos +[@jaimerave]: https://github.com/jaimerave