mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Ship default .rubocop.yml
Currently, there is no `.rubocop.yml` shipped by default. So when a user runs `rubocop` after creating a new gem via `bundle gem foo`, it throws a bunch of offenses. With the default `.rubocop.yml` present, the number of those offenses significantly reduce by 25. Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
This commit is contained in:
parent
d9c888d394
commit
ec98d56153
Notes:
git
2020-06-18 19:15:01 +09:00
3 changed files with 15 additions and 0 deletions
|
@ -79,6 +79,7 @@ module Bundler
|
|||
]
|
||||
|
||||
templates.merge!("gitignore.tt" => ".gitignore") if Bundler.git_present?
|
||||
templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
|
||||
|
||||
if test_framework = ask_and_set_test_framework
|
||||
config[:test] = test_framework
|
||||
|
|
7
lib/bundler/templates/newgem/rubocop.yml.tt
Normal file
7
lib/bundler/templates/newgem/rubocop.yml.tt
Normal file
|
@ -0,0 +1,7 @@
|
|||
Style/StringLiterals:
|
||||
Enabled: true
|
||||
EnforcedStyle: double_quotes
|
||||
|
||||
Style/StringLiteralsInInterpolation:
|
||||
Enabled: true
|
||||
EnforcedStyle: double_quotes
|
|
@ -326,6 +326,7 @@ RSpec.describe "bundle gem" do
|
|||
expect(bundled_app("#{gem_name}/lib/#{require_path}.rb")).to exist
|
||||
expect(bundled_app("#{gem_name}/lib/#{require_path}/version.rb")).to exist
|
||||
expect(bundled_app("#{gem_name}/.gitignore")).to exist
|
||||
expect(bundled_app("#{gem_name}/.rubocop.yml")).to exist
|
||||
|
||||
expect(bundled_app("#{gem_name}/bin/setup")).to exist
|
||||
expect(bundled_app("#{gem_name}/bin/console")).to exist
|
||||
|
@ -384,6 +385,12 @@ RSpec.describe "bundle gem" do
|
|||
expect(bundled_app("#{gem_name}/lib/#{require_path}.rb").read).to match(/class Error < StandardError; end$/)
|
||||
end
|
||||
|
||||
it "creates a default .rubocop.yml" do
|
||||
bundle "gem #{gem_name}"
|
||||
|
||||
expect(bundled_app("#{gem_name}/.rubocop.yml")).to exist
|
||||
end
|
||||
|
||||
it "runs rake without problems" do
|
||||
bundle "gem #{gem_name}"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue