Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix #104] Exclude Rails-independent bin/bundle by default #108

Merged
merged 1 commit into from
Aug 19, 2019

Conversation

koic
Copy link
Member

@koic koic commented Aug 16, 2019

Resolves #104.

bin/bundle was generated by Bundler. And Bundler doesn't depend on Active Support (Rails).

This PR prevents the following error.

% 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 `<main>'
        1: from ./bin/bundle:71:in `load_bundler!'
./bin/bundle:42:in `gemfile': undefined method `present?' for
   nil:NilClass (NoMethodError)

Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

Resolves rubocop#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 `<main>'
        1: from ./bin/bundle:71:in `load_bundler!'
./bin/bundle:42:in `gemfile': undefined method `present?' for
   nil:NilClass (NoMethodError)
```
@koic koic merged commit 1c993c3 into rubocop:master Aug 19, 2019
@koic koic deleted the exclude_bin_bundle branch August 19, 2019 07:42
koic added a commit to koic/rubocop-rails that referenced this pull request Jan 17, 2020
Fixes rubocop#122.

`Exclude` defined in RuboCop core was not inherited.
https://github.com/rubocop-hq/rubocop/blob/v0.79.0/config/default.yml#L60-L64

This PR fixes `Exclude` paths that were not inherited.
This bug was caused by rubocop#108.
koic added a commit to koic/rubocop-rails that referenced this pull request Jan 17, 2020
Fixes rubocop#122.

`Exclude` defined in RuboCop core was not inherited.
https://github.com/rubocop-hq/rubocop/blob/v0.79.0/config/default.yml#L60-L64

This PR fixes `Exclude` paths that were not inherited.
This bug was caused by rubocop#108.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rails/Present Autocorrect breaks bin/bundle
2 participants