mlibrary / hydra-prototype

4 stars 6 forks source link

Add Rubocop capability #33

Closed njaffer closed 9 years ago

gordonleacock commented 9 years ago

RuboCop is a Ruby static code analyzer. Out of the box it will enforce many of the guidelines outlined in the community Ruby Style Guide.

from: https://github.com/bbatsov/rubocop#installation

As you'll see below rubocop is very strict! [Actually, this comment box wouldn't hold all the errors]

Okay, here's what I tried.

  1. Installed a new hydra-prototype on tang in /l1/dev/gordonl
  2. Adjusted .yml files
  3. Added rubocop under "development:" in Gemfile
  4. Ran bundle update

Tried running rubocop from the command line. That didn't work until I did a "gem install rubocop" on the command line.

The a "rubocop -R" yielded the errors below. The "-R" invokes rules for rails.

I'm still exploring what rubocop could do for us but won't update hydra-prototype with anything that triggers rubocop automatically.

Gordon

gordonleacock commented 9 years ago

I was unable to get the rails web server running using rubocop and the current Gemfile cloned from hydra-prototype (specifically, problems with yml files for redis and resque). Following up on some clues on Hydra-Tech I changed this line in the Gemfile:

gem 'curation_concerns' to gem 'curation_concerns', '0.1'

And rubocop was back in business.

Is this change a problem for anyone? Do you want to discuss it?

Thanks,

Gordon

njaffer commented 9 years ago

The problem with hard coding 0.1 version of curation concerns is that we will not be able to get the new updates even when we do 'bundle update' so I think we should look into the errors for rubocop+ latest version of curation concerns. Please share the gist of errors.

respinos commented 9 years ago

There are a host of operators for the Gemfile --- I don't think you ever want to just grab the latest gem, but lock it to a minimum release. Maybe that ~> operator that I'm still trying to grok.

On Tue, Oct 27, 2015 at 9:53 AM, Nabeela Jaffer notifications@github.com wrote:

The problem with hard coding 0.1 version of curation concerns is that we will not be able to get the new updates even when we do 'bundle update' so I think we should look into the errors for rubocop+ latest version of curation concerns

— Reply to this email directly or view it on GitHub https://github.com/mlibrary/hydra-prototype/issues/33#issuecomment-151503049 .

njaffer commented 9 years ago

Until you run bundle update, you are not getting the latest updates. The ~> operator is good for keeping a range of updates (like ~> 2.0 would be good for all versions form 2.0.0 to 2.0.9)

respinos commented 9 years ago

Right --- but without the version, "bundle update" will pick up 0.2 which has conflicting hydra requirements than what we've specified elsewhere in the Gemfile. Which I think is what rubucop is grousing about.

On Tue, Oct 27, 2015 at 10:36 AM, Nabeela Jaffer notifications@github.com wrote:

Until you run bundle update, you are not getting the latest updates. The ~> operator is good for keeping a range of updates (like ~> 2.0 would be good for all versions form 2.0.0 to 2.0.9)

— Reply to this email directly or view it on GitHub https://github.com/mlibrary/hydra-prototype/issues/33#issuecomment-151520144 .

njaffer commented 9 years ago

Thats true , I ran into the same issue even without the rubocop. As soon as you run bundle update, you would see all kinds of errors. One option is to only install the new gems individually instead of running 'bundle update' or 'bundle install' .

gordonleacock commented 9 years ago

Let's discuss this in our meeting today. What I did was remove the cc 0.1 after getting rubocop working but before rebasing and issuing the pull request.