File tree Expand file tree Collapse file tree 4 files changed +18
-23
lines changed
Expand file tree Collapse file tree 4 files changed +18
-23
lines changed Original file line number Diff line number Diff line change @@ -6,4 +6,4 @@ Rake::TestTask.new do |t|
66 t . verbose = false
77end
88
9- task : default => :test
9+ task default : :test
Original file line number Diff line number Diff line change @@ -5,15 +5,16 @@ require "html-proofer"
55
66url_ignores = [
77 %r{^https://github.com/github/opensource.guide} ,
8- ' https://karissa.github.io/post/okf-de' ,
9- ' https://this-week-in-rust.org/' ,
10- ' https://www.vagrantup.com/' ,
11- ' https://www.quora.com/'
8+ " https://karissa.github.io/post/okf-de" ,
9+ " https://this-week-in-rust.org/" ,
10+ " https://www.vagrantup.com/" ,
11+ " https://www.quora.com/" ,
1212]
1313
14- HTMLProofer ::Runner . new ( [ "_site" ] ,
15- :type => :directory ,
16- :url_ignore => url_ignores ,
17- :verbose => !!ENV [ "VERBOSE" ] ,
18- :check_html => true
14+ HTMLProofer ::Runner . new (
15+ [ "_site" ] ,
16+ type : :directory ,
17+ url_ignore : url_ignores ,
18+ verbose : !!ENV [ "VERBOSE" ] ,
19+ check_html : true
1920) . run
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class << self
88end
99
1010def source
11- File . expand_path ( ' ../' , File . dirname ( __FILE__ ) )
11+ File . expand_path ( " ../" , File . dirname ( __FILE__ ) )
1212end
1313
1414def config
@@ -20,7 +20,7 @@ def docs
2020end
2121
2222def pages
23- docs . map { | doc | doc . to_liquid }
23+ docs . map ( & : to_liquid)
2424end
2525
2626def site
Original file line number Diff line number Diff line change 11require_relative "./helper"
22
33describe "lint test" do
4-
54 pages . each do |page |
6- next unless page [ "path" ] . match ( /\. md$/ )
5+ next unless page [ "path" ] . match? ( /\. md$/ )
76
87 describe page [ "path" ] do
9-
108 describe "frontmatter" do
11-
129 before do
1310 # Load raw metadata to skip defaults
1411 @data = SafeYAML . load_file ( page [ "path" ] )
@@ -26,19 +23,16 @@ def assert_valid_fields(data, fields)
2623 assert extra_fields . empty? , "Unexpected metadata: #{ extra_fields . inspect } "
2724
2825 fields . each do |name , attrs |
29- if attrs [ "required" ]
30- assert data . key? ( name ) , "#{ name } is required"
31- end
26+ assert data . key? ( name ) , "#{ name } is required" if attrs [ "required" ]
3227
3328 if attrs [ "type" ] && @data [ name ]
3429 assert_kind_of Kernel . const_get ( attrs [ "type" ] ) , @data [ name ]
3530 end
3631
3732 # Check subfields
38- if attrs [ "fields" ] && @data [ name ]
39- @data [ name ] . each do |d |
40- assert_valid_fields ( d , attrs [ "fields" ] )
41- end
33+ next unless attrs [ "fields" ] && @data [ name ]
34+ @data [ name ] . each do |d |
35+ assert_valid_fields ( d , attrs [ "fields" ] )
4236 end
4337 end
4438 end
You can’t perform that action at this time.
0 commit comments