Skip to content

Rails/RakeEnvironment should not be autocorrectable #1550

@pezholio

Description

@pezholio

Is your feature request related to a problem? Please describe.

We've recently hit on a problem where a Rake task that we only use locally was causing our application to choke when we attempted to run it in production, because the Rake task was being autoloaded on boot. The task does not use anything from the Rails app, so we don't actually need the environment to be in place.

Describe the solution you'd like

Having this as autocorrectable encourages bad habits because developers will just let the autocorrect run without thinking about if they actually need the environment to be preloaded. In the worst cases, this will result in errors, in the best cases this means that Rake tasks that don't need the Rails environment are more slow to run.

Describe alternatives you've considered

There could possibly be an improvement to the check where we check if anything inside the Rails app is used within the Rake task, but this seems like overkill for a linter.

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