Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.yardopts refuses filenames containing non-ASCII characters #1517

Closed
noraj opened this issue Nov 5, 2023 · 5 comments
Closed

.yardopts refuses filenames containing non-ASCII characters #1517

noraj opened this issue Nov 5, 2023 · 5 comments

Comments

@noraj
Copy link

noraj commented Nov 5, 2023

.yardopts refuses filenames containing non-ASCII characters

Steps to reproduce

Taking the following file:

module Test
  VERSION = '0.0.1'
end

Name it testé.rb and run yard doc testé.rb --no-yardopts: everything is fine.

Now create a file named .yardopts with the following content

testé.rb

It gives the following error (see Actual Output).

Actual Output

/home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/logging.rb:104:in `block in progress': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError)
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/logging.rb:103:in `synchronize'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/logging.rb:103:in `progress'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/logging.rb:81:in `capture'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/parser/source_parser.rb:45:in `parse'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/parser/source_parser.rb:371:in `parse_in_order'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/parser/source_parser.rb:114:in `block in parse'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/logging.rb:182:in `enter_level'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/parser/source_parser.rb:113:in `parse'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard.rb:20:in `parse'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/cli/yardoc.rb:259:in `block in run'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/serializers/yardoc_serializer.rb:56:in `lock_for_writing'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/registry_store.rb:202:in `lock_for_writing'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/registry.rb:210:in `lock_for_writing'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/cli/yardoc.rb:258:in `run'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/cli/command.rb:14:in `run'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/cli/command_parser.rb:72:in `run'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/lib/yard/cli/command_parser.rb:54:in `run'
        from /home/noraj/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/yard-0.9.34/bin/yard:13:in `<top (required)>'
        from /home/noraj/.asdf/installs/ruby/3.2.2/bin/yard:25:in `load'
        from /home/noraj/.asdf/installs/ruby/3.2.2/bin/yard:25:in `<main>'

Expected Output

No error.

Environment details:

  • OS: ArchLinux
  • Ruby version: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
  • YARD version: yard 0.9.34

(Un)related issues

All issues I found for that error are from Ruby 1.9.3 from 2013. But since Ruby 2.0 there is no need to provide an encoding comment to specify the source encoding. Generally there is no issue with encoding with yard even if my files are full of non-ASCII characters in the comments, content and file names. There only issue is when the file name contains non-ASCII chars in .yardopts.

Debug

This where yard seems to crash

print("\e[2K\e[?25l\e[1m#{icon}#{msg}\e[0m\r")

However, running print("\e[2K\e[?25l\e[1mtesté\e[0m\r") does not seem to crash.

noraj added a commit to IDLFAC/CyberMots-ILC that referenced this issue Nov 5, 2023
corrige le fait que la documentation sur rubydoc.info soit vide car le chemin de la bibliothèque n'est pas standard

cependant plante .yardopts ne supporte pas les caractères non-ASCII lsegal/yard#1517
@noraj
Copy link
Author

noraj commented Nov 5, 2023

Weird, I pushed this .yardopts file https://github.com/IDLFAC/CyberMots-ILC/blob/a16e3a4f4df91c3a1d4d4e883f873cc616a10034/.yardopts that makes yard crash locally with ruby 3.2.2 and yard 0.9.34 but I gave my github repository to rubydoc.info https://www.rubydoc.info/github/IDLFAC/CyberMots-ILC/ and it successfully built it with the same version Generated on Sun Nov 5 19:25:34 2023 by [yard](http://yardoc.org/) 0.9.34 (ruby-3.2.2)..

Is yard info using a special / patched version of yard? A different configuration? Using last commit from master and not the release? It must take my .yardopts file into consideration because for the gem when there was no .yardopts the documentation was blank https://www.rubydoc.info/gems/cybermots because the library folder is non standard.

@lsegal
Copy link
Owner

lsegal commented Aug 26, 2024

I can't seem to reproduce the issue in ruby 3.3.0 on my machine. Given that rubydoc.info also does not have the issue you're reporting, could there be something in your environment? I'm thinking about marking this as closed given the failure to repro.

@noraj
Copy link
Author

noraj commented Sep 1, 2024

I can reproduce on ruby 3.3.0, both the minimal example and running bundle exec yard doc on my project.

@noraj
Copy link
Author

noraj commented Sep 1, 2024

I made a minimal repository to reproduce: https://github.com/noraj/yard-issue-1517

@lsegal lsegal closed this as completed in fb08c6c Sep 3, 2024
@lsegal
Copy link
Owner

lsegal commented Sep 3, 2024

Thanks for the repro. This is now fixed and will be in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants