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

Add RegexpNode regopt predicates #20

Merged
merged 3 commits into from Jun 5, 2020

Conversation

owst
Copy link
Contributor

@owst owst commented Jun 4, 2020

owst added a commit to owst/rubocop that referenced this pull request Jun 4, 2020
@marcandre
Copy link
Contributor

Looks great!
Would you also add the "o" option please?

@owst
Copy link
Contributor Author

owst commented Jun 4, 2020

Oops - accidental omission, thanks @marcandre !

I've never used the o option before, and I struggled to find an example where it causes a change in behaviour. I finally came up with:

[1] pry(main)> Array.new(3) { |i| /#{i}/ }
=> [/0/, /1/, /2/]
[2] pry(main)> Array.new(3) { |i| /#{i}/o }
=> [/0/, /0/, /0/]

even then, I'm not sure when this would be useful!

The Perl docs say:

o - pretend to optimize your code, but actually introduce bugs

😄

@bbatsov bbatsov merged commit e98d015 into rubocop:master Jun 5, 2020
@bbatsov
Copy link
Contributor

bbatsov commented Jun 5, 2020

Thanks!

@marcandre
Copy link
Contributor

Oh, that actually breaks RuboCop. Probably a naming conflict with multiline?. I'm reopening #5

@owst
Copy link
Contributor Author

owst commented Jun 7, 2020

Good catch @marcandre and 👍 for running RuboCop specs too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants