Enable `Lint/ErbNewArguments` cop to avoid the deprecated arguments warning
Related 5754a29a97
.
And follows Ruby standard library style https://github.com/ruby/ruby/commit/3406c5d.
This commit is contained in:
parent
6127b8d920
commit
7ebfb319ff
|
@ -179,6 +179,9 @@ Layout/TrailingWhitespace:
|
||||||
Style/UnneededPercentQ:
|
Style/UnneededPercentQ:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Lint/ErbNewArguments:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
||||||
Lint/RequireParentheses:
|
Lint/RequireParentheses:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
|
@ -63,8 +63,7 @@ module Rails
|
||||||
numbered_destination = File.join(dir, ["%migration_number%", base].join("_"))
|
numbered_destination = File.join(dir, ["%migration_number%", base].join("_"))
|
||||||
|
|
||||||
create_migration numbered_destination, nil, config do
|
create_migration numbered_destination, nil, config do
|
||||||
match = ERB.version.match(/\Aerb\.rb \[(?<version>[^ ]+) /)
|
if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
|
||||||
if match && match[:version] >= "2.2.0" # Ruby 2.6+
|
|
||||||
ERB.new(::File.binread(source), trim_mode: "-", eoutvar: "@output_buffer").result(context)
|
ERB.new(::File.binread(source), trim_mode: "-", eoutvar: "@output_buffer").result(context)
|
||||||
else
|
else
|
||||||
ERB.new(::File.binread(source), nil, "-", "@output_buffer").result(context)
|
ERB.new(::File.binread(source), nil, "-", "@output_buffer").result(context)
|
||||||
|
|
|
@ -314,8 +314,7 @@ task :announce do
|
||||||
require "erb"
|
require "erb"
|
||||||
template = File.read("../tasks/release_announcement_draft.erb")
|
template = File.read("../tasks/release_announcement_draft.erb")
|
||||||
|
|
||||||
match = ERB.version.match(/\Aerb\.rb \[(?<version>[^ ]+) /)
|
if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
|
||||||
if match && match[:version] >= "2.2.0" # Ruby 2.6+
|
|
||||||
puts ERB.new(template, trim_mode: "<>").result(binding)
|
puts ERB.new(template, trim_mode: "<>").result(binding)
|
||||||
else
|
else
|
||||||
puts ERB.new(template, nil, "<>").result(binding)
|
puts ERB.new(template, nil, "<>").result(binding)
|
||||||
|
|
Loading…
Reference in New Issue