-
Notifications
You must be signed in to change notification settings - Fork 0
/
Checks
36 lines (30 loc) · 928 Bytes
/
Checks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env ruby
check :no_unprocessed_erb do
self.output_filenames.each do |fn|
if fn =~ /html$/ && File.read(fn).match(/<%/)
self.add_issue("erb detected", subject: fn)
end
end
end
check :valid_sitemap do
require 'nokogiri'
sitemap = self.output_filenames.grep(/sitemap\.xml$/).first
xsd = Nokogiri::XML::Schema(File.read('misc/sitemap.xsd'))
doc = Nokogiri::XML(File.read(sitemap))
unless xsd.valid?(doc)
self.add_issue("sitemap does not adhere to XML schema", subject: sitemap)
end
end
check :no_smartness_in_kbd do
self.output_filenames.each do |fn|
if fn =~ /html$/ && File.read(fn).match(/<kbd>[^<]*[–—][^<]*<\/kbd>/)
self.add_issue("smartness in kbd elem detected", subject: fn)
end
end
end
deploy_check :ilinks
deploy_check :stale
deploy_check :no_unprocessed_erb
deploy_check :valid_sitemap
deploy_check :no_smartness_in_kbd
deploy_check :mixed_content