-
-
Notifications
You must be signed in to change notification settings - Fork 407
Allowing YARD to parse content of C++ namespaces. Fixes #809. #1063
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
Conversation
I had to add another commit to correct a last moment issue that made RuboCop fail. Do I have to go back and squash this? Or can you just use the GitHub Merge and Squash feature? I was at first not running rubocop before I submitted because I threw errors on all files due to line endings. That's because git normalize to OS line endings upon checkout - but then correct them when you check in. I ended up adding these lines temporarily to
Since git normalize line ending upon checking, is that RuboCop check really needed? |
hmm... hold this PR. I might have run into a regression. Let me run more tests to be sure. |
@@ -2,7 +2,7 @@ | |||
source 'https://rubygems.org' | |||
|
|||
group :development do | |||
gem 'rspec', '~> 3.0' | |||
gem 'rspec', '~> 3.5' |
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.
Ah, so I had not intended this to be part of this PR. But this was something I had to do in order to get things running. See #1062
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.
Undo this change and rebase off of master since this fix was pushed separately.
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.
Ok. So when rebasing, do I then create a new PR? since that changes the history of the branch. (I'm not that familiar with rebase.)
@@ -38,6 +38,7 @@ def parse_toplevel | |||
when '#'; consume_directive | |||
when '/'; consume_comment | |||
when /\s/; consume_whitespace | |||
when '}'; advance # Skip possible C++ namespace closing brackets. |
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.
So this one, I'm not sure if you'll like this much. I can try to refactor it if you prefer. Though any suggestions would be appreciated. The issue here was that when there are namespaces my fix was to just ignore it. But then consume_toplevel_statement
would later run into stray }
(closing namespaces) that would throw it off.
So this line is currently very generic in advancing over any }
in the top level. I could try to keep track of the depth of the C++ namespaces and only advance over }
a matching number of times.
It all depend on how low impact we want to keep this. I ran this fix over our code base with over 1300 methods and 98 classes - no documentation objects where lost.
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.
I'm not too concerned, since the worst case is that it continues past a toplevel element to find the next one.
b83080f
to
405f0b1
Compare
Description
This Pull Request attempts to address #809 - where content inside of C++ namespaces isn't processed. This is an issue for source code that use the Ruby C API in a C++ environment.
What this fix do is simply make the C Parser not treat the content of namespaces as body statements. Instead it just ignores the namespaces all together.
I'm not sure if it's perfect, but we're working on getting a very sizable amount of code parsed so I'll follow up with improvements as needed if we run into them.
Completed Tasks
bundle exec rake
locally (if code is attached to PR).