Rubucop gem complaint


#1

Hello all, I’m new to IDEs and to programming so forgive me if this should be obvious. I installed Rubocop and when I ran the rubcop --format offenses command I got the error below:

warning: 2.2.3-compliant syntax, but you are running 2.2.1
It seems that I’m not up to date on Ruby(?), if this is the case, how can i fix this?

Thank you in advance!
Ingrid


#2

What version of Ruby is specified in your Gemfile?


#3

Thank you BigChief45 for helping out!
Below are the gems that were installed with rubocop…I didn’t see Ruby as being one of them. However, when I run ruby -v on my terminal, the output is ruby 2.2.1p85.
Thanks again for your help!
Ingrid

russygrl:~/workspace/launch_zoom (master) $ gem install rubocop
Fetching: ast-2.2.0.gem (100%)
Successfully installed ast-2.2.0
Fetching: parser-2.2.3.0.gem (100%)
Successfully installed parser-2.2.3.0
Fetching: astrolabe-1.3.1.gem (100%)
Successfully installed astrolabe-1.3.1
Fetching: powerpack-0.1.1.gem (100%)
Successfully installed powerpack-0.1.1
Fetching: rainbow-2.0.0.gem (100%)
Successfully installed rainbow-2.0.0
Fetching: ruby-progressbar-1.7.5.gem (100%)
Successfully installed ruby-progressbar-1.7.5
Fetching: tins-1.6.0.gem (100%)
Successfully installed tins-1.6.0
Fetching: rubocop-0.35.1.gem (100%)
Successfully installed rubocop-0.35.1
8 gems installed


#4

I am not sure exactly what Rubcop is, but…

Running ruby -v on your terminal will indicate which Ruby version you are currently running in your machine. To see which ruby version you are using in your application, check the 1st lines of your Gemfile. For example:

source 'https://rubygems.org' ruby '2.2.1'

Now, the error you are getting is:
warning: 2.2.3-compliant syntax, but you are running 2.2.1

So it seems you are running 2.2.1, but you need to be using Ruby 2.2.3.

To do this, try the following:

  1. Use RVM (Ruby Version Manager) already installed in your machine to install Ruby version 2.2.3 (if not already installed).

  2. Check if it’s already installed: rvm list. This will give you a list of currently installed Ruby versions using RVM.

  3. If version 2.2.3 is already installed, use this command to switch to this version: rvm use 2.2.3

  4. If version 2.2.23 is not already installed, install it by running the following: rvm install 2.2.3. This might take some time to finish, after it is done switch to the new version using the command on step #3.

  5. When you have switched to the new version, change the ruby version specification on your Gemfile and try everything again.

Let us know if you keep having problems.


#5

Oh my goodness Andres, thanks for your help…it worked!!!
Thank you so very much, much appreciate it, have a wonderful evening!!


#6

Glad it worked! Happy coding :slight_smile: