You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I stumbled across this strange edge-case while refactoring an old project. If you have a class called Foo::Bar defined in lib/foo/bar.rb, but also have an older file laying around which defines Foo::Bar as a module in lib/foo/bar/old_file.rband you have another sub-module named Foo::Bar::OtherModule defined in lib/foo/bar/other_module.rb, it someshow shadows the Foo::Bar class and causes it's generated documentation to be completely empty.
If I rename lib/foo/bar/other_module.rb to lib/foo/bar/baz.rb, the documentation for Foo::Bar in lib/foo/bar/old_file.rb suddenly appears, which implies the order of the files within lib/foo/bar/ matter.
The challenge here is that this Ruby code is fairly undefined in the larger context of the full codebase.
I'd say the only reasonable approach would be to have a warning for this type of use-case. YARD cannot really make a choice on your behalf, so it's pretty much for the end-user to resolve. A warning would at least surface the issue.
I will note, however, that given the extreme rarity of this case, this is likely not a high priority to resolve in the project. For that reason, this is likely going to be closed as a WontFix, with the following caveat/notice:
I stumbled across this strange edge-case while refactoring an old project. If you have a class called
Foo::Bar
defined inlib/foo/bar.rb
, but also have an older file laying around which definesFoo::Bar
as a module inlib/foo/bar/old_file.rb
and you have another sub-module namedFoo::Bar::OtherModule
defined inlib/foo/bar/other_module.rb
, it someshow shadows theFoo::Bar
class and causes it's generated documentation to be completely empty.Steps to reproduce
Gemfile
:lib/foo/bar.rb
:lib/foo/bar/old_file.rb
:lib/foo/bar/other_module.rb
:bundle install
bundle exec yardoc
doc/Foo/Bar.html
in the browser.Actual Output
Expected Output
A warning that
Foo::Bar
was defined as a class then re-defined as a module would be helpful.Environment details:
The text was updated successfully, but these errors were encountered: