Skip to content

Commit

Permalink
Don't set blank hash values
Browse files Browse the repository at this point in the history
This overwrites the defaults the proofer later attempts to merge in
  • Loading branch information
gjtorikian committed Jul 17, 2019
1 parent 86180ac commit 64d9a42
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions bin/htmlproofer
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,24 @@ Mercenary.program(:htmlproofer) do |p|
options[:error_sort] = opts['error-sort'].to_sym unless opts['error-sort'].nil?
options[:log_level] = opts['log_level'].to_sym unless opts['log_level'].nil?

# FIXME: this is gross
options[:validation] = {}
options[:validation][:report_script_embeds] = opts['report_script_embeds']
options[:validation][:report_missing_names] = opts['report_missing_names']
options[:validation][:report_invalid_tags] = opts['report_invalid_tags']

options[:typhoeus] = {}
options[:typhoeus] = HTMLProofer::Configuration.parse_json_option('typhoeus_config', opts['typhoeus_config'])

options[:cache] = {}
options[:cache][:timeframe] = opts['timeframe'] unless opts['timeframe'].nil?
options[:cache][:storage_dir] = opts['storage_dir'] unless opts['storage_dir'].nil?
options[:validation] = HTMLProofer::Configuration::VALIDATION_DEFAULTS.clone
options[:validation][:report_script_embeds] = opts['report_script_embeds'] unless opts['report_script_embeds'] .nil?
options[:validation][:report_missing_names] = opts['report_missing_names'] unless opts['report_missing_names'] .nil?
options[:validation][:report_invalid_tags] = opts['report_invalid_tags'] unless opts['report_invalid_tags'] .nil?

unless opts['typhoeus_config'].nil?
options[:typhoeus] = HTMLProofer::Configuration.parse_json_option('typhoeus_config', opts['typhoeus_config'])
end

unless opts['timeframe'].nil?
options[:cache] ||= {}
options[:cache][:timeframe] = opts['timeframe'] unless opts['timeframe'].nil?
end

unless opts['storage_dir'].nil?
options[:cache] ||= {}
options[:cache][:storage_dir] = opts['storage_dir'] unless opts['storage_dir'].nil?
end

options[:http_status_ignore] = Array(options[:http_status_ignore]).map(&:to_i)

Expand Down

0 comments on commit 64d9a42

Please sign in to comment.