-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Upgrade regexp_parser to 2.0 #9102
Conversation
Methods we use that used to return byte-based indices now return char-based indices, so we can revert the changes made in rubocop#8989. https://github.com/ammar/regexp_parser/blob/master/CHANGELOG.md#200---2020-11-25---janosch-m%C3%BCller
73adc65
to
9b90cae
Compare
I was just investigating this too. Thank you for the early catching up and fixing! |
Great news, thanks! |
This is not a good change. It breaks compatibility with other important gems such as |
Sorry about your troubles.
|
Update: capybara master is already updated, just not released yet. |
Thanks for looking into this. It's nice to see Capybara is using RuboCop as well. :-) |
Follow rubocop#9154, rubocop#9155, and rubocop#9102. This is a step towards the widespread use of regexp_parser 2.0. RuboCop core accepts regexp_parser 1.8, but several code is already incompatible with regexp_parser 1.8. It can cause issue because these combination of versions. Therefore, this PR ports code for regexp_parser 1.8 that will never be maintained from rubocop#9102. Implementation of this patch, code is intentionally duplicated because it is evaluated only when the class is defined. Also, since obsoleted code for regexp_parser 1.8 is assumed to never be maintained, the target to be removed is clear. To be honest, it's ugly as implementation, but I think it has the least impact for RuboCop 1.x series users.
Follow #9154, #9155, and #9102. This is a step towards the widespread use of regexp_parser 2.0. RuboCop core accepts regexp_parser 1.8, but several code is already incompatible with regexp_parser 1.8. It can cause issue because these combination of versions. Therefore, this PR ports code for regexp_parser 1.8 that will never be maintained from #9102. Implementation of this patch, code is intentionally duplicated because it is evaluated only when the class is defined. Also, since obsoleted code for regexp_parser 1.8 is assumed to never be maintained, the target to be removed is clear. To be honest, it's ugly as implementation, but I think it has the least impact for RuboCop 1.x series users.
@marcandre Thanks for the changes! I missed that commit. |
…lass` Fixes rubocop#12985. This PR fixes an error for `Style/RedundantRegexpCharacterClass` when using regexp_parser gem 2.3.1 or older. Unfortunately, rubocop#11565 can cause error issue rubocop#12985 with regexp_parser gem versions 2.3.1 or older. This issue has already been resolved in regexp_parser gem 2.4, but as mentioned below, it is necessary to continue supporting the `regexp_parser` version 1 series due to compatibility requirements with Capybara: rubocop#9102 (comment) Therefore, it is not possible to specify support only for version 2.4+ in `spec.add_runtime_dependency`. As a result, this PR includes logic adjustments to ensure it works with regexp_parser versions prior to 2.3.1.
…lass` Fixes rubocop#12985. This PR fixes an error for `Style/RedundantRegexpCharacterClass` when using regexp_parser gem 2.3.1 or older. This issue has already been resolved in regexp_parser gem 2.4. In the past, there was an issue with compatibility with regexp_parser 1.x due to the following: rubocop#9102 (comment) Currently, many dependent gems including Capybara have permitted upgrading to regexp_parser 2.x: https://rubygems.org/gems/regexp_parser/reverse_dependencies Therefore, it would be a good time to specify `spec.runtime_dependency` as regexp_parser 2.4+.
Fixes #12985. This PR fixes an error for `Style/RedundantRegexpCharacterClass` when using regexp_parser gem 2.3.1 or older. This issue has already been resolved in regexp_parser gem 2.4. In the past, there was an issue with compatibility with regexp_parser 1.x due to the following: #9102 (comment) Currently, many dependent gems including Capybara have permitted upgrading to regexp_parser 2.x: https://rubygems.org/gems/regexp_parser/reverse_dependencies Therefore, it would be a good time to specify `spec.runtime_dependency` as regexp_parser 2.4+.
regexp_parser 2.0 is out, which introduced char-based indices we wanted.
ammar/regexp_parser#72
ammar/regexp_parser#73
Methods we use that used to return byte-based indices now return char-based indices, so we can revert the changes made in #8989.
https://github.com/ammar/regexp_parser/blob/master/CHANGELOG.md#200---2020-11-25---janosch-m%C3%BCller
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.