Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

(PDOC-283) Fix namespaced symbols #205

Merged
merged 1 commit into from
Jul 1, 2019

Conversation

glennsarti
Copy link
Contributor

@glennsarti glennsarti commented Jun 29, 2019

Previously in Yard 0.9.19 dyna_symbols (symbols represented as strings e.g.
:'something') were converted to their unqualified symbol name e.g. :something.
However YARD treated this as a bug and in Yard 0.19.20 dynasymbols are now their
original source. This commit modifies the base ruby handler to always convert
dyna_symbols to their plain name, as Puppet uses this for actual documentation
and Puppet Code. For example the fully qualified function 'foo::bar' will
appear in the ruby function definition as .. :'foo::bar' however in the Puppet
documentation the name should appears as foo::bar.

This commit also adds tests for this scenario as there were no existing tests
for this.

Previously in Yard 0.9.19 dyna_symbols (symbols represented as strings e.g.
:'something') were converted to their unqualified symbol name e.g. :something.
However YARD treated this as a bug and in Yard 0.19.20 dynasymbols are now their
original source.  This commit modifies the base ruby handler to always convert
dyna_symbols to their plain name, as Puppet uses this for actual documentation
and Puppet Code.  For example the fully qualified function 'foo::bar' will
appear in the ruby function definition as `.. :'foo::bar'` however in the Puppet
documentation the name should appears as `foo::bar`.

This commit also adds tests for this scenario as there were no existing tests
for this.
@glennsarti glennsarti force-pushed the pdoc-283-fix-symbols branch from a18a3ae to 42a643e Compare July 1, 2019 01:43
@glennsarti glennsarti changed the title {WIP}(PDOC-283) Fix namespaced symbols (PDOC-283) Fix namespaced symbols Jul 1, 2019
@glennsarti glennsarti requested a review from kris-bosland July 1, 2019 01:44
@glennsarti glennsarti self-assigned this Jul 1, 2019
@glennsarti glennsarti mentioned this pull request Jul 1, 2019
15 tasks
# YARD 0.9.20 changed how dyna_symbols are represented
# https://github.com/lsegal/yard/commit/225ded9ef38c6d2be5a3b0fc7effbc7d6644768d
if yard_version >= Gem::Version.new('0.9.20')
node.source[2..-2]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a really fragile way to do this, but I trust your judgement that there's not a better way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I wasn't super happy with it. But it's no worse than the examples above or below 🤷‍♂️ The fragility is also why I add tests so at least we should be able to detect when it goes bad.

@binford2k binford2k merged commit b3b24fe into puppetlabs:master Jul 1, 2019
@glennsarti glennsarti deleted the pdoc-283-fix-symbols branch July 17, 2019 05:57
@scotje scotje added the bugfix label Jul 17, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants