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 #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-hq:master Aug 19, 2019
6 checks passed
6 checks passed
ci/circleci: JRuby 9.2 Your tests passed on CircleCI!
Details
ci/circleci: Ruby 2.3 Your tests passed on CircleCI!
Details
ci/circleci: Ruby 2.4 Your tests passed on CircleCI!
Details
ci/circleci: Ruby 2.5 Your tests passed on CircleCI!
Details
ci/circleci: Ruby 2.6 Your tests passed on CircleCI!
Details
ci/circleci: Ruby HEAD Your tests passed on CircleCI!
Details
@koic koic deleted the koic:exclude_bin_bundle branch Aug 19, 2019
koic added a commit to koic/rubocop-rails that referenced this pull request Jan 17, 2020
Fixes rubocop-hq#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-hq#108.
koic added a commit to koic/rubocop-rails that referenced this pull request Jan 17, 2020
Fixes rubocop-hq#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-hq#108.
@koic koic mentioned this pull request Jan 17, 2020
8 of 8 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.