-
Notifications
You must be signed in to change notification settings - Fork 280
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
Parser 2.3 support #801
Parser 2.3 support #801
Conversation
YES, I WANT THAT SQUIGGLY THING TOO!
We then also need to address the safe navigation operator i guess.... |
Yes! We should support 2.3 syntax ASAP. Perhaps we can at least start a branch moving to parser 2.3.0.pre.x and adding support for I would like to drop unparser and find some other way of printing source (perhaps by just finding it in the original string). The reason is that unparser is still in a below-1.0 version and considered as such by the author, plus we only print tiny bits of code anyway. |
Good idea! I'm a swamped right now, would anybody like to tackle this problem? |
I got pack from four days of meeting families and promptly got a 39°C fever (→ staying offline makes me sick), but I’ll get on this one. :) |
Oooh, the lovely issue → PR transformation API still works. ;) |
Aaaaaand parser 2.3 is out! One problem though:
and that is the latest |
I'll start with #815 right away. |
You're on a roll! Awesome 👍 |
I’m sick again (as in, third time in a row), but I’ll be on this this weekend. :) (And I agree we should get it fixed ASAP, I have projects I want to switch to the squiggly heredoc!) ;) |
f4233a8
to
d9e0a7f
Compare
This is green now and (patiently!) waits for mbj/unparser#60. |
@@ -33,7 +33,7 @@ Feature: Reek reads from $stdin when no files are given | |||
""" | |||
|
|||
Scenario: syntax error causes the source to be ignored | |||
When I pass "def incomplete" to reek | |||
When I pass "=" to reek |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parser 2.3.0.1 blows up on parsing def incomplete
:
lib/parser/diagnostic.rb:121:in `[]=': 1...1 out of range (RangeError)
I tried to make Parser raise the expected Parser::SyntaxError
and =
was the first thing that worked. I can try coming up with something less crypting that doesn’t make Parser blow up (but raise what we expect).
(We should probably guard Reek users from Parser blowing up, but that’s a task for another PR…)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this should be reported as a bug in parser?
Are those really the only changes we need to do?
looks vastly different from
.... |
You’re right, these are by far not the only changes we need to do to support the full Ruby 2.3 syntax; this is just the base to actually make Reek being able to depend on Parser 2.3. Still, I’d rather we get this in ASAP (probably by getting #827 in first) so that people can at least upgrade their RuboCops. I’ll work on supporting what Parser calls on the new syntax ASAP, unless you’d rather I worked on #827 first. :) |
No, please go ahead by all means. I'm afraid removing |
I did fix the dependency issue in unparser, but if you read that PR you’ll see that it’s unlikely to be merged soon, and I doubt unparser will support the new Ruby 2.3 syntax anytime soon either. I think we should push on with #827; we can’t release Reek with a runtime dependency on a GitHub repo. Let me know if I can help with #827 – I really want a Reek version that does not block Parser upgrade ASAP (even before we fully support Ruby 2.3), as people currently can’t upgrade to the newest RuboCop if they happen to use Reek as well (and I really don’t want them to stop using Reek). |
I agree. I can help with that one as well if needed. |
That would be highly welcome! #827 is really just a super-early wip branch, nothing more. If you'd like to take over, I'd just close this one. Would you like to tackle this? |
I can just take over the branch from #827. It seems to at least be heading in the right direction. |
Ok, sounds great, then I'll just leave it like that ;) |
Now that #827 is merged lets rebase this one so we can make Reek 2.3 compatible! |
Yes, sorry! This week totally blew up for me. On it! |
c4b06d8
to
77dfc7e
Compare
@troessner I limited this PR (and issue) to relaxing our dependency on Parser so that Reek can be installed alonside Parser 2.3. I also made the invalid syntax feature a bit more self-explanatory. I think we should get this merged and released, and I’ll work on actual Ruby 2.3 support (handling what Parser emits for the new syntax) in a separate PR. |
I dont get it, why not
right away? Whats the benefit? Parser is fully backwards compatible so i'd rather update now... |
77dfc7e
to
15ba789
Compare
My reasons for allowing Parser 2.2.2.5 and 2.2.2.6 are:
But if you’re feeling strong about |
But that way Reek + ruby 2.3 might work for a user depending on randomness. That is, if he has parser 2.2.2 already installed this doesnt work. On fresh install it would work. Which is really really weird.
Conjecture. Maybe, maybe not. Donald Knuth is screaming "premature optimization" in my ear as we speak.
He is still screaming. And my closing argument: This is not enterprise java beans but ruby. I believe we should rather take swift and bold actions and not live the live of a "make it right for every user on this planet" slave. Wdyt? |
15ba789
to
6a58140
Compare
Addendum: i see the rubocop problem but do we really want to limit Reek to some other tool, no matter how popular it is? |
Ok, this is a good point. I bumped this to
I’m not sure I got my point across: with Meanwhile, this built. ;) |
Merged! Release incoming! |
I see your point, but i beliebe being tentative about this makes dependency hell even worse. We should update aggressively and tool x then just has to update as well. |
I KNOW, RIGHT? 😆 Thanks so much for the merge! |
I want to get my pet projects that would benefit from the squiggly heredoc over to Ruby 2.3 ASAP, and for this we need to make sure Reek supports it.
To the best of my quick checks the current blockers are:
'~> 2.2.2'
.Once the above are resolved I want to make sure Reek at least doesn’t blow up on the new syntax, but ideally addresses those parts of the new syntax it should address. ;)