Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only call Object#taint when the taint method exists #1419

Merged
merged 1 commit into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/yard/cli/stats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ def general_options(opts)
end

opts.on('--query QUERY', "Only includes objects that match a specific query") do |query|
options[:verifier].add_expressions(query.taint)
query.taint if query.respond_to?(:taint)
options[:verifier].add_expressions(query)
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/yard/cli/yardoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,8 @@ def output_options(opts)

opts.on('--query QUERY', "Only show objects that match a specific query") do |query|
next if YARD::Config.options[:safe_mode]
options.verifier.add_expressions(query.taint)
query.taint if query.respond_to?(:taint)
options.verifier.add_expressions(query)
end

opts.on('--title TITLE', 'Add a specific title to HTML documents') do |title|
Expand Down
4 changes: 3 additions & 1 deletion lib/yard/templates/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ def include_inherited(full_paths)
def load_setup_rb
setup_file = File.join(full_path, 'setup.rb')
if File.file? setup_file
module_eval(File.read(setup_file).taint, setup_file, 1)
setup_code = File.read(setup_file)
setup_code.taint if setup_code.respond_to?(:taint)
module_eval(setup_code, setup_file, 1)
end
end
end
Expand Down