File tree 4 files changed +18
-23
lines changed
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|
6
6
t . verbose = false
7
7
end
8
8
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"
5
5
6
6
url_ignores = [
7
7
%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/" ,
12
12
]
13
13
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
19
20
) . run
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class << self
8
8
end
9
9
10
10
def source
11
- File . expand_path ( ' ../' , File . dirname ( __FILE__ ) )
11
+ File . expand_path ( " ../" , File . dirname ( __FILE__ ) )
12
12
end
13
13
14
14
def config
@@ -20,7 +20,7 @@ def docs
20
20
end
21
21
22
22
def pages
23
- docs . map { | doc | doc . to_liquid }
23
+ docs . map ( & : to_liquid)
24
24
end
25
25
26
26
def site
Original file line number Diff line number Diff line change 1
1
require_relative "./helper"
2
2
3
3
describe "lint test" do
4
-
5
4
pages . each do |page |
6
- next unless page [ "path" ] . match ( /\. md$/ )
5
+ next unless page [ "path" ] . match? ( /\. md$/ )
7
6
8
7
describe page [ "path" ] do
9
-
10
8
describe "frontmatter" do
11
-
12
9
before do
13
10
# Load raw metadata to skip defaults
14
11
@data = SafeYAML . load_file ( page [ "path" ] )
@@ -26,19 +23,16 @@ def assert_valid_fields(data, fields)
26
23
assert extra_fields . empty? , "Unexpected metadata: #{ extra_fields . inspect } "
27
24
28
25
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" ]
32
27
33
28
if attrs [ "type" ] && @data [ name ]
34
29
assert_kind_of Kernel . const_get ( attrs [ "type" ] ) , @data [ name ]
35
30
end
36
31
37
32
# 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" ] )
42
36
end
43
37
end
44
38
end
You can’t perform that action at this time.
0 commit comments