Merge pull request #46969 from skipkayhil/eval-location-followup
Enable Style/EvalWithLocation
This commit is contained in:
commit
da73378244
@ -239,6 +239,11 @@ Lint/UselessAssignment:
|
||||
Lint/DeprecatedClassMethods:
|
||||
Enabled: true
|
||||
|
||||
Style/EvalWithLocation:
|
||||
Enabled: true
|
||||
Exclude:
|
||||
- '**/test/**/*'
|
||||
|
||||
Style/ParenthesesAroundCondition:
|
||||
Enabled: true
|
||||
|
||||
|
@ -102,7 +102,7 @@ def atom_feed(options = {}, &block)
|
||||
options[:schema_date] = "2005" # The Atom spec copyright date
|
||||
end
|
||||
|
||||
xml = options.delete(:xml) || eval("xml", block.binding)
|
||||
xml = options.delete(:xml) || block.binding.local_variable_get(:xml)
|
||||
xml.instruct!
|
||||
if options[:instruct]
|
||||
options[:instruct].each do |target, attrs|
|
||||
|
@ -16,7 +16,7 @@ def ==(other)
|
||||
end
|
||||
|
||||
%w(insert insert_all insert! insert_all! upsert upsert_all).each do |method|
|
||||
class_eval <<~RUBY
|
||||
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
||||
def #{method}(attributes, **kwargs)
|
||||
if @association.reflection.through_reflection?
|
||||
raise ArgumentError, "Bulk insert or upsert is currently not supported for has_many through association"
|
||||
|
@ -23,7 +23,7 @@ def quietly(&block)
|
||||
def capture(stream)
|
||||
stream = stream.to_s
|
||||
captured_stream = Tempfile.new(stream)
|
||||
stream_io = eval("$#{stream}")
|
||||
stream_io = eval("$#{stream}", binding, __FILE__, __LINE__)
|
||||
origin_stream = stream_io.dup
|
||||
stream_io.reopen(captured_stream)
|
||||
|
||||
|
@ -57,13 +57,12 @@ def migration_template(source, destination, config = {})
|
||||
source = File.expand_path(find_in_source_paths(source.to_s))
|
||||
|
||||
set_migration_assigns!(destination)
|
||||
context = instance_eval("binding")
|
||||
|
||||
dir, base = File.split(destination)
|
||||
numbered_destination = File.join(dir, ["%migration_number%", base].join("_"))
|
||||
|
||||
file = create_migration numbered_destination, nil, config do
|
||||
ERB.new(::File.binread(source), trim_mode: "-", eoutvar: "@output_buffer").result(context)
|
||||
ERB.new(::File.binread(source), trim_mode: "-", eoutvar: "@output_buffer").result(binding)
|
||||
end
|
||||
Rails::Generators.add_generated_file(file)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user