I noticed today that several (17) classes (of a total of 749) were missing from the generated class_list.html while they were present in the generated alphabetical index as well as having a proper class .html generated which was also properly crosslinked.
One class is my 'Wx::App' where 'Wx' is the topmost namespace of the library.
Looking through the code and doing some debugging I found that at the point of the classlist method in 'templates/default/fulldoc/html/setup.rb' the object instance from Registry.root representing the topmost 'Wx' module did not have an instance
for the 'Wx::App' class in its #children list.
That instance was however present when looked up with Registry.at('Wx::App') and the #namespace instance object of that object DID have an instance for 'Wx::App' in its #children list.
Comparing the object_id-s of the 'Wx' instance included in Registry.root and the #namespace instance showed these were different objects and both were NOT proxies but fully resolved objects which I had not expected to be the case.
The debug output from yardoc does not show any errors or other noticable messages.
I have a workaround by loading a template customization for 'templates/default/fulldoc/html/setup.rb' which contains this code:
# frozen_string_literal: true
def init
# It seems YARD messes things up so that a number of classes are not properly
# registered in their enclosing namespaces.
# This hack makes sure that if that is the case we fix that here.
all_classes = Registry.all(:class)
all_classes.each do |c|
if (ns = c.namespace)
unless ns.children.any? { |nsc| nsc.path == c.path }
ns.children << c # class missing from child list of enclosing namespace -> add here
end
end
if (ns = Registry[c.namespace.path])
unless ns.children.any? { |nsc| nsc.path == c.path }
ns.children << c # class missing from child list of enclosing namespace -> add here
end
end
end
super
end
I don't think the first if ... end block is really necessary but the second definitely is.
This currently solves the problem for me but I do not much like having to maintain this horrible hack.
Does anyone have an idea what is causing this problem?
Steps to reproduce
I cannot reproduce with a minimal sample. Seems to be somehow related to larger, more complex documenting setups.
The project I am generating for is https://github.com/mcorino/wxRuby3.
Actual Output
Documented classes missing from generated class_list.html
Expected Output
A generated class_list.html including all documented classes.
I noticed today that several (17) classes (of a total of 749) were missing from the generated
class_list.html
while they were present in the generated alphabetical index as well as having a proper class .html generated which was also properly crosslinked. One class is my 'Wx::App' where 'Wx' is the topmost namespace of the library.Looking through the code and doing some debugging I found that at the point of the
classlist
method in 'templates/default/fulldoc/html/setup.rb' the object instance fromRegistry.root
representing the topmost 'Wx' module did not have an instance for the 'Wx::App' class in its#children
list. That instance was however present when looked up withRegistry.at('Wx::App')
and the#namespace
instance object of that object DID have an instance for 'Wx::App' in its#children
list. Comparing theobject_id
-s of the 'Wx' instance included inRegistry.root
and the#namespace
instance showed these were different objects and both were NOT proxies but fully resolved objects which I had not expected to be the case.The debug output from yardoc does not show any errors or other noticable messages.
I have a workaround by loading a template customization for 'templates/default/fulldoc/html/setup.rb' which contains this code:
I don't think the first
if ... end
block is really necessary but the second definitely is.This currently solves the problem for me but I do not much like having to maintain this horrible hack.
Does anyone have an idea what is causing this problem?
Steps to reproduce
I cannot reproduce with a minimal sample. Seems to be somehow related to larger, more complex documenting setups. The project I am generating for is https://github.com/mcorino/wxRuby3.
Actual Output
Documented classes missing from generated
class_list.html
Expected Output
A generated
class_list.html
including all documented classes.Environment details:
ruby -v
): 3.2.0yard -v
): 0.9.34I have read the Contributing Guide.