whitesmith / whitesmith/rubycritic

RubyCritic::RakeTask problem with bundler+rails+heroku

Open
#227 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
Ruby
Stars
3.5k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

When deploying a Rails app on Heroku that:

  • uses the rubycritic rake task
  • Gemfile declares rubycritic gem in the development / test groups

we get:

rake aborted!
LoadError: cannot load such file -- rubycritic/rake_task

This happens because of:

bundle install --without development:test 
rake -P

I managed to work with

if defined?(Rails) && (Rails.env.development? || Rails.env.test?)
  require 'rubycritic/rake_task'
  RubyCritic::RakeTask.new do |task|
  ....

Not sure what to do here.
I do think that this gem does not make sense to be used in a production environment, so I'd like to place it in dev/test groups. I'd also expect for this to work "out of the box".

Do we just update the documentation to specify this use case?
Do we drop the rake task and instead supply a generator or simple example?
The rake task is extremely simple, just a RubyCritic::Cli::Application.new(options).
If we properly document options people should have no problems with it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with bundle install --without development:test followed by rake -P, then inspect the RubyCritic rake task and the documented CLI options. Resolve whether the intended outcome is documentation or a code change, and verify that a Rails app keeping RubyCritic in development/test does not fail during production task loading.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.