Fix remaining RuboCop issues#3765
Conversation
In case of multiple Rake tasks, the default tasks would look something like this: `task default: [:spec, :rubocop]` Instead, they should use %i and look something like this: `task default: %i[spec rubocop]` Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
If the blank lines aren't used, then rubocop tries to sort them in alphabetical order within their section. Thus, adding lines so rubocop considers them as different sections and doesn't try to sort them. Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
deivid-rodriguez
left a comment
There was a problem hiding this comment.
Test failures seem legit. To make sure the gems are in different groups, but inside the conditionals. Otherwise they add up regardless of options and we'll end up with multiple blank lines when, for example, config[:rubocop] is true and either config[:test] or config[:ext] is false.
So do somethin like the following instead:
diff --git a/bundler/lib/bundler/templates/newgem/Gemfile.tt b/bundler/lib/bundler/templates/newgem/Gemfile.tt
index 82504f92d4..1d55fd7a90 100644
--- a/bundler/lib/bundler/templates/newgem/Gemfile.tt
+++ b/bundler/lib/bundler/templates/newgem/Gemfile.tt
@@ -7,13 +7,14 @@ gemspec
gem "rake", "~> 13.0"
<%- if config[:ext] -%>
+
gem "rake-compiler"
<%- end -%>
-
<%- if config[:test] -%>
+
gem "<%= config[:test] %>", "~> <%= config[:test_framework_version] %>"
<%- end -%>
-
<%- if config[:rubocop] -%>
+
gem "rubocop", "~> 0.80"
<%- end -%>The Gemfile wasn't properly put in the last commit. As a result, Layout/EmptyLines inspected an offense in the Gemfile. This also fixes the spec w.r.t change in the task default. Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
Hi @deivid-rodriguez, |
Since this PR was made because we missed checking RuboCop offenses with different flags, therefore adding tests so that all flag combinations are tested. Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
b42562c to
d08250e
Compare
The newly added specs needs to be tagged as :readline, otherwise they fail on Windows with the backtrace: `ZeroDivisionError: divided by 0`. Such issues are already being skipped on Windows. Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
deivid-rodriguez
left a comment
There was a problem hiding this comment.
Looks great, thanks!
With #3731 and #3740 merged, this covers up the
remaining part of the issues.
This was discovered when one tries to create a gem
with a different framework.
Could be reproduced with:
bundle gem foo --ext --test=minitest --rubocopSigned-off-by: Utkarsh Gupta <utkarsh@debian.org>
Tasks:
I will abide by the code of conduct.