From 3bd10b4f82ca23413df08c66620c7447147b20d6 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Thu, 15 Aug 2019 00:26:43 +0900 Subject: [PATCH] [Fix #104] Exclude Rails-independent `bin/bundle` by default Resolves #104. `bin/bundle` was generated by Bundler. And Bundler doesn't depend on Active Support (Rails). This PR prevents the following error. ```console % cd path/to/new-rails-app % bin/rails -v Rails 6.0.0.rc2 % bundle exec rubocop -a --only Rails/Present % g diff diff --git a/bin/bundle b/bin/bundle index 4f5e057..fa7b83b 100755 --- a/bin/bundle +++ b/bin/bundle @@ -39,7 +39,7 @@ m = Module.new do def gemfile gemfile = ENV["BUNDLE_GEMFILE"] - return gemfile if gemfile && !gemfile.empty? + return gemfile if gemfile.present? File.expand_path("../../Gemfile", __FILE__) end % ./bin/bundle Traceback (most recent call last): 2: from ./bin/bundle:101:in `
' 1: from ./bin/bundle:71:in `load_bundler!' ./bin/bundle:42:in `gemfile': undefined method `present?' for nil:NilClass (NoMethodError) ``` --- CHANGELOG.md | 4 ++++ config/default.yml | 2 ++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55aca228c5..65902ed464 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## master (unreleased) +### Bug fixes + +* [#104](https://github.com/rubocop-hq/rubocop-rails/issues/104): Exclude Rails-independent `bin/bundle` by default. ([@koic][]) + ## 2.3.0 (2019-08-13) ### New features diff --git a/config/default.yml b/config/default.yml index bf9e24d8e0..5f076ea140 100644 --- a/config/default.yml +++ b/config/default.yml @@ -1,6 +1,8 @@ # Common configuration. AllCops: + Exclude: + - bin/bundle # What version of Rails is the inspected code using? If a value is specified # for TargetRailsVersion then it is used. Acceptable values are specificed # as a float (i.e. 5.1); the patch version of Rails should not be included.