mike42 / doxyphp2sphinx

API Documentation generator for PHP priojects which use Sphinx.
BSD 2-Clause "Simplified" License
2 stars 2 forks source link

KeyError traceback #1

Open mikeryan776 opened 5 years ago

mikeryan776 commented 5 years ago

Trying out generating PHP docs per https://mike42.me/blog/2018-06-how-to-create-effective-php-project-documentation-with-read-the-docs, and doxyphp2sphinx crashed on me:

docs$ doxyphp2sphinx Soong
Processing namespace Soong
  refid is namespace_soong
  Opening xml/namespace_soong.xml
  Page title will be 'API documentation'
  Page path will be  './api.rst'
  Desc is ... '
'
...
Processing class Soong::Console::Command::EtlCommand
  refid is class_soong_1_1_console_1_1_command_1_1_etl_command
  Class title will be 'EtlCommand'
  Class path will be  './api/console/command/etlcommand.rst'
Traceback (most recent call last):
  File "/usr/local/bin/doxyphp2sphinx", line 11, in <module>
    sys.exit(Cli.run())
  File "/Library/Python/2.7/site-packages/doxyphp2sphinx/cli.py", line 28, in run
    generator.render_namespace_by_name(tree, root_namespace)
  File "/Library/Python/2.7/site-packages/doxyphp2sphinx/rstgenerator.py", line 29, in render_namespace_by_name
    self.render_namespace_by_ref_id(child.attrib['refid'], this_namespace_name)
  File "/Library/Python/2.7/site-packages/doxyphp2sphinx/rstgenerator.py", line 79, in render_namespace_by_ref_id
    self.render_namespace_by_ref_id(ns_id, ns_name)
  File "/Library/Python/2.7/site-packages/doxyphp2sphinx/rstgenerator.py", line 79, in render_namespace_by_ref_id
    self.render_namespace_by_ref_id(ns_id, ns_name)
  File "/Library/Python/2.7/site-packages/doxyphp2sphinx/rstgenerator.py", line 74, in render_namespace_by_ref_id
    self.render_class_by_ref_id(cl_id, cl_name)
  File "/Library/Python/2.7/site-packages/doxyphp2sphinx/rstgenerator.py", line 343, in render_class_by_ref_id
    class_rst = self.class_xml_to_rst(compounddef, title)
  File "/Library/Python/2.7/site-packages/doxyphp2sphinx/rstgenerator.py", line 124, in class_xml_to_rst
    baserefid = base_class.attrib['refid']
KeyError: 'refid'

It would seem to be choking either finishing the EtlCommand class or starting the MigrateCommand class in https://gitlab.com/soongetl/soong/tree/master/src/Console/Command.

Any thoughts?

mikeryan776 commented 5 years ago

So, while Doxygen seems to handle {@inheritdoc} for purely internal hierarchies, it doesn't pick it up when inheriting from a library in ../vendor (the description is empty in these cases, presumably this is what confused doxyphp2sphinx). I need to research Doxygen a bit to see how I can have it pull in inherited docs from vendor but not generate the docs for everything in there...

mikeryan776 commented 5 years ago

Doxygen's XML for the suspect class:

_migrate_command_8php.xml.txt

mike42 commented 5 years ago

Cheers, labeling this as 'bug', since we should prefer to skip past unsupported doxygen features rather than crashing out.

romaninsh commented 5 years ago

I had some quick fixes locally to get this working, here is the modified file: https://gist.github.com/romaninsh/10a0c8acf24aef9d06a9b658a3c7c0ba