Rails_best_practices passes on CircleCI 1.0, but not on 2.0

rails
ruby
2.0

#1

I have rails_best_practices set up as part of my build.

While is works on CircleCI 1.0, it won’t pass on 2.0.

The log displays app/controllers/concerns/transactions_reports, but says the problem is in ConfirmationsController.

It doesn’t make any sense, the concern is not even included in that controller.
Besides, it runs properly when I run it locally (and also on Circle Ci 1.0).

Any thoughts on how to solve this on CircleCI 2.0?


#2

My guess would be that this is related to a different version of Ruby or Rails. I don’t use either though, it’s just a guess. Can you print out the version of both Ruby and Rails in your 1.0 and 2.0 environments?

At a further guess, your two warnings are not CircleCI specific, and I wonder if you could put them in a search engine? With that in mind, I myself cannot do that, since the build log above is an image. If you can supply such logs as text, that can really help readers who want to assist.


#3

Thanks @halfer, but it’s not that. I’m using the exact same version of Ruby, Rails, gems, etc. All of versions are locked on Gemfile and/or Gemfile.lock files.


My bad. This is the plan text version:

$ bundle exec rails_best_practices

Source Code: |=================================================================|

/home/circleci/project/app/controllers/concerns/transactions_reports.rb:6 - remove unused methods (ConfirmationsController#set_balance_report)
/home/circleci/project/app/controllers/concerns/filterable.rb:6 - remove unused methods (ConfirmationsController#set_period)

Found 2 warnings.
Exited with code 1

Thanks.


#4

My thoughts would be that it’s not a CircleCI issue per se, just an issue related to the changed environment. At a guess, there is a Ruby parser that examines whether a method is used, and reports a warning if it believes it is not. I’d treat this as a debugging issue - find out what binary/library does that scan, and dig into it using SSH and a console editor.

I found other folks with this issue too, is this link any good?


#5

Those issues from the link you sent aren’t related.

I’ve opened an issue on rails_best_practices but I’m sure there’s nothing wrong with it really:

I believe my problem is related to CircleCI 2.0, because it works fine locally and on CircleCi 1.0.

Thanks anyway.


#6

As a general rule, I don’t tend to agree with this logic. At its heart, CircleCI is just a Docker container (or virtual server for the Machine executor). There may be some CircleCI tools in it, but broadly, it is just Linux. So, what has changed from 1.0 to 2.0 is not “CircleCI stuff”, it is “Linux stuff”. The environment will certainly have changed, and in some cases that presents a debugging need.

If you can get help from CircleCI staff via a bug report that’d be awesome, but I’d guess they’d regard this as a problem with the repo you’ve linked (not dissimilar to a LAMP host being wary of helping folks debug their WordPress problems).


#7

With a brand new Ubuntu Server installation, the issue doesn’t happen.


#8

I was able to replicate it in a very simple app:
https://circleci.com/gh/lucascaton/rails_best_practices-issue-329/3


#9

Good work. That’s most strange - it is raising warnings about unused warnings that do not exist. Are you able to dig into the Ruby library itself (e.g. in an SSH session) to discover why it is making these wrong detections?


#10

Are your files being loaded in a different order on AUFS?


#11

Hi @rohara, how can I check that? Thanks.


#13

This has been solved.

The issue was related to the rails_best_practices gem itself.
More info: https://github.com/flyerhzm/rails_best_practices/issues/329


#14

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.