annotaterb icon indicating copy to clipboard operation
annotaterb copied to clipboard

Yard format broken?

Open miguno opened this issue 8 months ago • 3 comments

First, thanks for your work on this gem!

I am trying to annotate models in yard format:

$ bin/bundle exec annotaterb models --format yard

This fails with:

bundler: failed to load command: annotaterb (/Users/miguno/.local/share/mise/installs/ruby/3.4.3/bin/annotaterb)
/Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/annotaterb-4.14.0/lib/annotate_rb/model_annotator/annotation/annotation_builder.rb:39:in 'A
rray#map': undefined method 'to_yard' for an instance of AnnotateRb::ModelAnnotator::IndexAnnotation::Annotation (NoMethodError)

              components.map(&:to_yard).compact.join("\n")
                        ^^^^
Did you mean?  to_yaml
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/annotaterb-4.14.0/lib/annotate_rb/model_annotator/annotation/annotation_builder.rb
:39:in 'AnnotateRb::ModelAnnotator::Annotation::AnnotationBuilder::Annotation#build'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/annotaterb-4.14.0/lib/annotate_rb/model_annotator/annotation/annotation_builder.rb
:79:in 'AnnotateRb::ModelAnnotator::Annotation::AnnotationBuilder#build'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/annotaterb-4.14.0/lib/annotate_rb/model_annotator/project_annotator.rb:42:in 'Anno
tateRb::ModelAnnotator::ProjectAnnotator#build_instructions_for_file'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/annotaterb-4.14.0/lib/annotate_rb/model_annotator/project_annotator.rb:17:in 'bloc
k in AnnotateRb::ModelAnnotator::ProjectAnnotator#annotate'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/annotaterb-4.14.0/lib/annotate_rb/model_annotator/project_annotator.rb:13:in 'Arra
y#map'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/annotaterb-4.14.0/lib/annotate_rb/model_annotator/project_annotator.rb:13:in 'Anno
tateRb::ModelAnnotator::ProjectAnnotator#annotate'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/annotaterb-4.14.0/lib/annotate_rb/model_annotator/annotator.rb:21:in 'AnnotateRb::
ModelAnnotator::Annotator#do_annotations'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/annotaterb-4.14.0/lib/annotate_rb/model_annotator/annotator.rb:8:in 'AnnotateRb::M
odelAnnotator::Annotator.do_annotations'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/annotaterb-4.14.0/lib/annotate_rb/commands/annotate_models.rb:17:in 'AnnotateRb::C
ommands::AnnotateModels#call'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/annotaterb-4.14.0/lib/annotate_rb/runner.rb:24:in 'AnnotateRb::Runner#run'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/annotaterb-4.14.0/lib/annotate_rb/runner.rb:7:in 'AnnotateRb::Runner.run'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/annotaterb-4.14.0/exe/annotaterb:18:in '<top (required)>'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/bin/annotaterb:25:in 'Kernel#load'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/bin/annotaterb:25:in '<top (required)>'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/3.4.0/bundler/cli/exec.rb:59:in 'Kernel.load'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/3.4.0/bundler/cli/exec.rb:59:in 'Bundler::CLI::Exec#kernel_load'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/3.4.0/bundler/cli/exec.rb:23:in 'Bundler::CLI::Exec#run'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/3.4.0/bundler/cli.rb:452:in 'Bundler::CLI#exec'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/command.rb:28:in 'Bundler::Thor::Command#run'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in 'Bundler::Thor::Invocation#invoke_command'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor.rb:538:in 'Bundler::Thor.dispatch'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/3.4.0/bundler/cli.rb:35:in 'Bundler::CLI.dispatch'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/base.rb:584:in 'Bundler::Thor::Base::ClassMethods#start'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/3.4.0/bundler/cli.rb:29:in 'Bundler::CLI.start'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/bundler-2.6.7/exe/bundle:28:in 'block in <top (required)>'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/3.4.0/bundler/friendly_errors.rb:117:in 'Bundler.with_friendly_errors'
    from /Users/miguno/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/bundler-2.6.7/exe/bundle:20:in '<top (required)>'
    from bin/bundle:108:in 'Kernel#load'
    from bin/bundle:108:in '<main>'

Environment

  • Rails 8.0.2
  • Ruby 3.4.3 (installed via mise)
  • yard 0.9.37
  • annotaterb 4.14.0
  • macOS 15.3.2 as well as Debian 12 Bookworm

Possibly related issues

I have not found any directly related issue. And there is only one yard-related issues open currently: https://github.com/drwl/annotaterb/issues/162 (last updated in February 2025)

miguno avatar Apr 19 '25 23:04 miguno

Same here for:

  • Rails 7.2.2.1
  • Ruby 3.4.1
  • Linux
  • yard 0.9.37
  • annotaterb 4.14.0

n-at-han-k avatar May 25 '25 14:05 n-at-han-k

I see the same type of error with both rdoc and yard

sirwolfgang avatar Sep 09 '25 21:09 sirwolfgang

This change allowed annotations to be added https://github.com/drwl/annotaterb/pull/266/files, but I don't have time to be more thorough than checking that files were updated and the annotating didn't crash.

jdart avatar Sep 12 '25 18:09 jdart