Skip to content

Use "require: false" with rubocop in Gemfile #362

@dcki

Description

@dcki

Is it possible to make rails_apps_composer add "require: false" for rubocop when adding it to a Gemfile?

A Rails app I work on was built a couple of months ago using this gem. I'm not sure exactly how the gem was used to create the project.

The resulting Gemfile checked in by a collaborator included the rubocop gem without specifying "require: false". In rubocop's README.md it says to specify "require: false" for rubocop if you put it in a Gemfile. Since this didn't happen there were "NameError: uninitialized constant Net::HTTP" errors in the production environment. (Fortunately this app has not been deployed to production yet.)

This is how the error occurred:

  • rubocop requires net/http.
  • rubocop is only in the development and test groups in the Gemfile created using rails_apps_composer, so rubocop and net/http were required in the development environment but not in the production environment.
  • Some code in the app referenced Net::HTTP without requiring it, and it worked in development so it was assumed it was correct.

This seems like a cool project, thanks for your work on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions