Raise when the `:singleton-method:` directive can't extract the name?
p8 opened this issue · 2 comments
p8 commented
The :singleton-method:
directive can't extract the name of accessors defined with singleton_class.attr_accessor :name
.
Instead the method name will be set to unknown
, see: rails/rails#50836
RDoc will show a warning if the method can't be extracted when RDoc is run in verbose mode.
But maybe this should raise an error instead?
Examples of warnings when running RDoc on Rails:
...
Duplicate method ActiveRecord::unknown in file activerecord/lib/active_record.rb
activerecord/lib/active_record.rb:457:18: unknown name token #<struct RDoc::Parser::RipperStateLex::Token line_no=457, char_no=17, kind=:on_period, text=".", state=DOT> for meta-method 'singleton_class'
Duplicate method ActiveRecord::unknown in file activerecord/lib/active_record.rb
activerecord/lib/active_record.rb:487:18: unknown name token #<struct RDoc::Parser::RipperStateLex::Token line_no=487, char_no=17, kind=:on_period, text=".", state=DOT> for meta-method 'singleton_class'
Duplicate method ActiveRecord::unknown in file activerecord/lib/active_record.rb
Duplicate method ActiveRecord::Coders::YAMLColumn::SafeCoder#dump in file activerecord/lib/active_record/coders/yaml_column.rb
Duplicate method ActiveRecord::Coders::YAMLColumn::SafeCoder#load in file activerecord/lib/active_record/coders/yaml_column.rb
Duplicate method ActiveRecord::LogSubscriber#query_source_location in file activerecord/lib/active_record/log_subscriber.rb
...
The duplicate method warnings are for methods defined separately for different Ruby versions.
Or maybe we should have a lint task?
zzak commented
There isn't really an RDoc linter afaik, I think making it configurable to raise that we can run with --dry-run
in another job to get the same effect