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

ruby_parser.rb - add void_stmt to insert_comments loop #1290

Merged
merged 1 commit into from Nov 26, 2019

Conversation

@MSP-Greg
Copy link
Contributor

MSP-Greg commented Nov 19, 2019

Description

While running YARD with Ruby 2.7, the following comment is not added to class B:

module A
  # comment
  # ...
  # end comment
  class B

but, if a blank line is added between module A and the comment, it parses fine.

Tests passed in my fork, but 2.7/trunk is not tested against. I checked the issue locally.

I could add Actions testing on Windows (Ruby 2.4 thru trunk), which I assume would show the issue.

Completed Tasks

  • I have read the Contributing Guide.
  • The pull request is complete (implemented / written).
  • Git commits have been cleaned up (squash WIP / revert commits).
  • I wrote tests and ran bundle exec rake locally (if code is attached to PR).
@coveralls

This comment has been minimized.

Copy link

coveralls commented Nov 19, 2019

Coverage Status

Coverage decreased (-1.8%) to 91.933% when pulling 10a2e5b on MSP-Greg:void-stmt into 4b5c875 on lsegal:master.

@koic

This comment has been minimized.

Copy link
Contributor

koic commented Nov 25, 2019

Superfantastic!

@koic

This comment has been minimized.

Copy link
Contributor

koic commented Nov 25, 2019

@lsegal This PR will resolve the following repositories CI failures related to RuboCop when using Ruby 2.7.0-dev.

Could you release a new version of YARD gem? I'm happy when it is released :-)

@MSP-Greg

This comment has been minimized.

Copy link
Contributor Author

MSP-Greg commented Nov 25, 2019

@koic

Thanks for testing. Over the weekend some changes were made to irb (see ruby/ruby@efbca15), and it broke YARD, specifically the code here:

require "e2mmap"
require "irb/slex"
module YARD
module Parser::Ruby::Legacy
# Legacy lexical tokenizer module.
module RubyToken

A simple fix is to add gem 'irb', '1.1.0' somewhere, but I think a more permanent fix is needed...

@aycabta

This comment has been minimized.

Copy link
Contributor

aycabta commented Nov 26, 2019

The ruby-token.rb was also removed at ruby/ruby@45bb6f2 but the class, RubyToken was copied and pasted to lib/yard/parser/ruby/legacy/ruby_lex.rb of YARD.

RubyLex in lib/irb/ruby-lex.rb was big-bang changed at ruby/ruby@94b740b#diff-80fbffd8d3dfc72fb539e0c03a8f0581 and also copied and pasted to the same file (lib/yard/parser/ruby/legacy/ruby_lex.rb).

I think SLex should be also copied from lib/irb/slex.rb and be pasted to the same file (lib/yard/parser/ruby/legacy/ruby_lex.rb).

@lsegal

This comment has been minimized.

Copy link
Owner

lsegal commented Nov 26, 2019

Another option is to remove legacy given that YARD has officially dropped support for the 1.8 parser a while ago. If Ruby is going in the same direction, I don't see a reason to keep such old outdated code.

@lsegal
lsegal approved these changes Nov 26, 2019
@lsegal lsegal merged commit 27874ee into lsegal:master Nov 26, 2019
1 of 2 checks passed
1 of 2 checks passed
coverage/coveralls Coverage decreased (-1.8%) to 91.933%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@MSP-Greg MSP-Greg deleted the MSP-Greg:void-stmt branch Nov 26, 2019
@MSP-Greg

This comment has been minimized.

Copy link
Contributor Author

MSP-Greg commented Nov 28, 2019

@lsegal

Another option is to remove legacy

I briefly looked at this. The following overload statement parses with the legacy parser, but a Ripper based parser may not allow it, since the parameters aren't valid Ruby code:

module YARD::Handlers::Ruby::DecoratorHandlerMethods
# @overload process_decorator(*nodes, opts = {}, &block)

Thoughts?

koic added a commit to koic/rubocop-rails that referenced this pull request Dec 6, 2019
This PR solves the following "The manual directory is out of sync" error.

```console
% ruby -v
ruby 2.7.0dev (2019-12-03T05:51:14Z master e42d9d8df8) [x86_64-darwin17]
% CI=true bundle exec rake

(snip)

The manual directory is out of sync. Run `rake
generate_cops_documentation` and commit the results.
```

https://circleci.com/gh/rubocop-hq/rubocop-rails/2180

This issue will be resolved with the release of YARD 0.9.21 or higher,
which includes the following changes:
lsegal/yard#1290
@koic koic mentioned this pull request Dec 6, 2019
5 of 8 tasks complete
koic added a commit to koic/rubocop-performance that referenced this pull request Dec 6, 2019
This PR solves the following "The manual directory is out of sync" error
when using Ruby 2.7.0-dev.

```console
% ruby -v
ruby 2.7.0dev (2019-12-03T05:51:14Z master e42d9d8df8) [x86_64-darwin17]
% CI=true bundle exec rake

(snip)

The manual directory is out of sync. Run `rake
generate_cops_documentation` and commit the results.
```

https://circleci.com/gh/rubocop-hq/rubocop-performance/869

This issue will be resolved with the release of YARD 0.9.21 or higher,
which includes the following changes:
lsegal/yard#1290
koic added a commit to koic/rubocop-minitest that referenced this pull request Dec 6, 2019
This PR solves the following "The manual directory is out of sync" error
when using Ruby 2.7.0-dev.

```console
% ruby -v
ruby 2.7.0dev (2019-12-03T05:51:14Z master e42d9d8df8) [x86_64-darwin17]
% CI=true bundle exec rake

(snip)

The manual directory is out of sync. Run `rake
generate_cops_documentation` and commit the results.
```

https://circleci.com/gh/rubocop-hq/rubocop-minitest/968

This issue will be resolved with the release of YARD 0.9.21 or higher,
which includes the following changes:
lsegal/yard#1290
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.