Skip to content

Commit

Permalink
Replace eval with require
Browse files Browse the repository at this point in the history
  • Loading branch information
exoego committed Jan 5, 2024
1 parent 1e08676 commit f391238
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/rspec/openapi/result_recorder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ def record_results!
@path_records.each do |path, records|
# Look for a path-specific config file and run it.
config_file = File.join(File.dirname(path), RSpec::OpenAPI.config_filename)
eval(File.read(config_file)) if File.exist?(config_file)
begin
require config_file if File.exist?(config_file)
rescue => e

Check notice

Code scanning / Rubocop

Avoid rescuing without specifying an error class. Note

Style/RescueStandardError: Avoid rescuing without specifying an error class.
puts "WARNING: Unable to load #{config_file}: #{e}"

Check warning on line 16 in lib/rspec/openapi/result_recorder.rb

View check run for this annotation

Codecov / codecov/patch

lib/rspec/openapi/result_recorder.rb#L16

Added line #L16 was not covered by tests
end

title = RSpec::OpenAPI.title
RSpec::OpenAPI::SchemaFile.new(path).edit do |spec|
Expand Down

0 comments on commit f391238

Please sign in to comment.