Installing rubocop fails due to error while parsing the documentation. This began to fail for me yesterday, which lines up with the 0.69.0 release.
The error is as follows:
Parsing documentation for rubocop-0.69.0
RDoc::Parser::Ruby failure around line 16 of
lib/rubocop/cop/generator.rb
Before reporting this, could you check that the file you're documenting
has proper syntax:
/usr/bin/ruby2.3 -c lib/rubocop/cop/generator.rb
RDoc is not a full Ruby parser and will fail when fed invalid ruby programs.
The internal error was:
(NoMethodError) undefined method `name' for {TkSTRING 481, 16:19 "%Q<department>"}:RDoc::RubyToken::TkSTRING
ERROR: While executing gem ... (NoMethodError)
undefined method `name' for {TkSTRING 481, 16:19 "%Q<department>"}:RDoc::RubyToken::TkSTRING
Installing rubocop succeeds.
Installing rubocop fails.
Here's an easy way to reproduce this:
docker run --rm -ti ubuntu:16.04 bash -c 'apt-get update && apt-get install -y gcc make ruby-dev && gem install rubocop'
0.69.0 (using Parser 2.6.3.0, running on ruby 2.3.1 x86_64-linux-gnu)
NOTE: as a workaround, I'm currently using gem install --no-rdoc --no-ri rubocop
Also note that this is only an issue on Ubuntu 16.04 (ruby version ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]) but not on Ubuntu 18.04 (ruby version: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu])
In other words, this works:
docker run --rm -ti ubuntu:18.04 bash -c 'apt-get update && apt-get install -y gcc make ruby-dev && gem install rubocop'
Possibly related to this commit - https://github.com/rubocop-hq/rubocop/pull/7026/commits/05f25f30935b032650924e89ae336572df6998d6
PS: Installation works fine on MacOS Mojave.
I confirmed that and I opened a PR #7047.