class SiteHealth::HTMLProoferConfiguration

Holds HTMLProofer configuration data

Constants

ERROR_SORTS

Valid error sorts

LOG_LEVELS

Valid log levels

Attributes

assume_extension[RW]
check_external_hash[RW]
check_favicon[RW]
check_html[RW]
check_img_http[RW]
check_opengraph[RW]
empty_alt_ignore[RW]
enforce_https[RW]
error_sort[R]
log_level[R]
report_invalid_tags[RW]
report_missing_names[RW]

Public Class Methods

new() click to toggle source
# File lib/site_health/configuration/html_proofer_configuration.rb, line 32
def initialize
  @log_level = :fatal
  @check_opengraph = true
  @check_html = true
  @check_external_hash = true
  @check_img_http = false
  @empty_alt_ignore = false
  @error_sort = :path
  @enforce_https = false
  @assume_extension = true
  @report_missing_names = true
  @report_invalid_tags = true
  @check_favicon = true
  @ignore_missing_internal_links = true
end

Public Instance Methods

error_sort=(sort) click to toggle source

@param [Symbol] sort desired error sorting @return [Symbol] current error sorting @raise [ArgumentError] raises if invalid error sorting

# File lib/site_health/configuration/html_proofer_configuration.rb, line 62
def error_sort=(sort)
  unless ERROR_SORTS.include?(sort.to_sym)
    raise ArgumentError, "unknown sort order :#{sort}, must be one of: #{ERROR_SORTS.join(',')}" # rubocop:disable Metrics/LineLength
  end

  @error_sort = sort
end
log_level=(level) click to toggle source

@param [Symbol] level desired log level @return [Symbol] current log level @raise [ArgumentError] raises if invalid log level

# File lib/site_health/configuration/html_proofer_configuration.rb, line 51
def log_level=(level)
  unless LOG_LEVELS.include?(level.to_sym)
    raise ArgumentError, "unknown log level :#{level}, must be one of: #{LOG_LEVELS.join(',')}" # rubocop:disable Metrics/LineLength
  end

  @log_level = level
end
to_h() click to toggle source

@return [Hash] config as hash, only contains keys for ::HTMLProofer config

# File lib/site_health/configuration/html_proofer_configuration.rb, line 71
def to_h
  {
    log_level: log_level,
    check_opengraph: check_opengraph,
    check_html: check_html,
    check_external_hash: check_external_hash,
    empty_alt_ignore: empty_alt_ignore,
    check_img_http: check_img_http,
    error_sort: error_sort,
    enforce_https: enforce_https,
    assume_extension: assume_extension,
    report_missing_names: report_missing_names,
    report_invalid_tags: report_invalid_tags,
    check_favicon: check_favicon,
  }
end