Unable to parse RuboCop response in Rubymine 2019.3 - bundler

Rubymine reports that it's unable to parse the output from rubocop in my project.
When I click the details link, this is what it shows:
Error:Bundle complete! 13 Gemfile dependencies, 68 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
{"metadata":{"rubocop_version":"0.80.1","ruby_engine":"ruby","ruby_version":"2.6.3","ruby_patchlevel":"62","ruby_platform":"x86_64-darwin18"},"files":[{"path":"db/seeds.rb","offenses":[{"severity":"convention","message":"Missing frozen string literal comment.","cop_name":"Style/FrozenStringLiteralComment","corrected":false,"correctable":true,"location":{"start_line":1,"start_column":1,"last_line":1,"last_column":1,"length":1,"line":1,"column":1}},{"severity":"convention","message":"Line is too long. [103/80]","cop_name":"Layout/LineLength","corrected":false,"correctable":true,"location":{"start_line":1,"start_column":81,"last_line":1,"last_column":103,"length":23,"line":1,"column":81}},{"severity":"convention","message":"Line is too long. [111/80]","cop_name":"Layout/LineLength","corrected":false,"correctable":true,"location":{"start_line":2,"start_column":81,"last_line":2 ...
I'm assuming the problem is related to the extra bundler output that is getting parsed, in addition to the JSON. Any ideas of how I can fix this?

Some people say if you upgrade Rubocop to 0.88 or later, it fixes. I tested myself and can confirm.
See the discussion: https://youtrack.jetbrains.com/issue/RUBY-26861

Related

How to disable ruby bundler text output?

Whenever I run a ruby script through bundler it always gives me output similar to:
Fetching gem metadata from https://foo.bar.com/........
...
Using ...
Fetching ...
Installing ...
....
Bundle complete! 19 Gemfile dependencies, 145 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
How can I disable this in bundler so that it just shows the output of the actual script being run?
Easy way is to tell it to keep quiet about what it's doing:
bundle install --quiet
You may want to redirect it to a file in case something happens and it couldn't install gems:
bundle install > /tmp/bundle-install.out
Where you can inspect that if things go awry.

Can I control the version of rubygems that IntelliJ uses?

I'm trying to start a rails application in IntelliJ with the Ruby plugin.
I've imported the application and set up the run configuration as best I can. When I try to run it I get the error:
NoMethodError: undefined method `version_requirements' for #<Gem::Dependency:0x7de21f45>
When looking for an answer I found this page saying that I should do this:
$ gem install rubygems-update -v='1.4.2'
$ gem uninstall rubygems-update -v='1.5.0'
$ update_rubygems
Since it's IntelliJ's ruby plugin that is managing the gems, I assume that I have to change the version of rubygems-update that the plugin is using.
Is this the right approach to take? And if so, can anyone tell me how to go about it?
I tried listing the gems but that gem is not shows so I must not be listing the gems in the right place, but I don't know where to look.
Many thanks :)
IntelliJ IDEA cannot handle it, you will need to install the appropriate rubygems version from the command line.
Note that your current rubygems-update version may be different, verify it with gem list and use the reported version when uninstalling.

error when update_rubygems

When I try to update gem I gave this:
4 bug fixes:
Use Psych API to emit more compatible YAML
Download and write inside gem fetch directly. Fixes #289
Honor sysconfdir on 1.8. Fixes #291
Search everywhere for a spec for gem spec. Fixes #288
Fix Gem.all_load_path. Fixes #171
Help me fix it please :D
That appears to be valid output from updating RubyGems. Did you run this command?
gem update --system
If so, and you saw that output, you should be able to run this and get the version number.
gem --version
It should be something along the lines of 1.8.17, which is the latest version.

Could not find gem 'rubytree (~> 0.5.2) ruby' while installing ChiliProject on Debian

I am trying to install chiliproject on a server, following the -well done- documentation I am hitting this error
Could not find gem 'rubytree (~> 0.5.2) ruby' in any of the gem sources listed in your Gemfile.
I did a gem install rubytree
I get this message
========================================================================
Thank you for installing rubytree.
WARNING: SIGNIFICANT API CHANGE in 0.8.0 !
------------------------------------------
Please note that as of 0.8.0 the CamelCase method names are DEPRECATED.
The new method names follow the ruby_convention (separated by '_').
The old CamelCase methods still work (a warning will be displayed),
but may go away in the future.
Details of the API changes are documented in the API-CHANGES file.
========================================================================
Successfully installed rubytree-0.8.1
1 gem installed
Installing ri documentation for rubytree-0.8.1...
file 'COPYING,API-CHANGES' not found
Installing RDoc documentation for rubytree-0.8.1...
file 'COPYING,API-CHANGES' not found
That is saying the installation was succesful. So why do I get the error ?
If the error is from the API change how can I request version 0.5.2 of the rubytree gem ?
When I do a gem list --local | grep 'rubytree'
I have this output rubytree (0.8.1)
So why is the system saying could not find gem 'rubytree' ?
thank you for any help,
Depending on what version of rails you are using (and it sounds like you are using a relatively newer one, if it's prompting you for your Gemfile), then you need to use Bundler to manage your gems.
Try editing your Gemfile, adding a new line that reads:
gem "rubytree", "< 0.6"
Then open up a console, and type this command
bundle install
This should fix your problems, but if you still get errors when running a command, then try typing bundle exec prior to the command (i.e. rails server becomes bundle exec rails server).
Currently, we require rubytree exactly in version 0.5.2 or 0.5.3, as specified in our Gemfile, the 0.8.1. version you installed by hand will not suffice that requirement, which is exactly what the error message states.
What seems a bit odd is the literal ruby in the error message. Could you please make sure that you have the exact unchanged Gemfile from the source on your system? Also, could you please remove any user-installed plugins and try again? Also, which ruby (type and version) on which operating system are you using?

How to safely fix "invalid date format in specification" for webrobots-0.0.10.gemspec

For every gem execution I am receiving the following error:
Invalid gemspec in [...rvm/gems/ruby-1.9.2-p136/specifications/webrobots-0.0.10.gemspec]: invalid date format in specification: "2011-07-01 00:00:00.000000000Z"
I am not the webrobots maintainer and I can't uninstall that gem.
There is any safe action to fix this problem on a production server?
These days with Github and Bundler you don't have to be a maintainer in order to fix issues in the gems you're using. Just fork the project on Github, fix whatever issue is there, and them simply point Bundler at your fork. If it is a handy extension to the gem rather than just a hack for yourself you might also consider making a pull request to the original maintainer to roll your changes into the official gem.
Having said all of that, the issue that might cause this problem doesn't seem to be present in the gemspec of the 0.0.10 version of webrobots. This issue can occur when the date in the gemspec is in the format that you have in your error e.g.:
"2011-07-01 00:00:00.000000000Z"
Looking at a snippet of gemspec though we have:
s.authors = [%q{Akinori MUSHA}]
s.date = %q{2011-07-01}
s.description = %q{This library helps write robots.txt compliant web robots in Ruby.
So that seems to be correct. Another issue that has been known to cause this problem is a YAML parser issue, to fix you need to force the use of a particular YAML parser (psych). You need to define the following somewhere:
require 'yaml'
YAML::ENGINE.yamler = 'syck'
Lastly you might want to clean your local installation and then do a redeploy which may sort you out. Once again if you're using Bundler something like this:
gem update --system
rvm gemset empty mygemset
gem install bundler
gem install
Here is the way I fix the "invalid date format in specification" error:
1.) Go to the specifications folder located at:
/usr/local/lib/ruby/gems/1.8/specifications/
2.) Find the spec that is causing the problem.
3.) Change "s.date = %q{2011-05-21 00:00:00.000000000Z}" to "s.date = %q{2011-05-21}"
That's a WIN for me! Good Luck
You may be using old version of gem. See you current version gem -v.
Upgrade you gem to latest
gem update --system
And install you gem file again with new gem. gem install <gem-name> or bundle install

Resources