Skip to main content
bundle install uses one of the flags Bundler 2.x deprecated in favor of BUNDLE_* env vars and bundle config set.

Description

Bundler 2.x deprecated three bundle install flags in favor of BUNDLE_* env vars and the bundle config set command: The flags still work but emit a deprecation notice on every CI run, and are slated for removal in Bundler 3. The corpus shows only a handful of files using these (3 with --without, 1 with --deployment), but they keep showing up in copy-pasted Dockerfile snippets from blog posts written before Bundler 2’s release. This rule fires on each deprecated flag in a bundle install invocation. Multiple flags in the same command produce separate violations. Stages explicitly named dev/development/test/testing/ci/debug are skipped.

Examples

Before

After

The env-var form is functionally equivalent (and the Rails generator’s preferred shape) — and it survives across multiple bundle install invocations in the same stage.

Auto-fix

  • --without <groups>FixSafe. The env-var form is a strict equivalent.
  • --deploymentFixSafe. Same — BUNDLE_DEPLOYMENT="1" is the env-var form of --deployment.
  • --path <dir>FixSuggestion. The user may have downstream BUNDLE_PATH expectations (other RUNs reading from the path) that the env-var version may interact with differently.
The fix is non-edit (description-only) — rewriting the RUN’s flag and inserting an ENV at the right location is too easy to get wrong on multi-line RUN chains. The user applies the rewrite manually.

References