@@ -32,30 +32,30 @@ validator.addValidation(async (tutorials) => {
32
32
tutorials . forEach ( tutorial => {
33
33
let jsonData = tutorial . metadata ;
34
34
if ( ! jsonData ) {
35
- const errorMessage = "No metadata file found" ;
36
- errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . metadataPath ) ) ;
35
+ const errorMessage = "No metadata found" ;
36
+ errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . path ) ) ;
37
37
return ;
38
38
}
39
39
40
40
try {
41
41
if ( ! jsonData . coverImage ) {
42
42
const errorMessage = "No cover image found" ;
43
- errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . metadataPath ) ) ;
43
+ errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . path ) ) ;
44
44
} else if ( jsonData . coverImage . indexOf ( ".svg" ) == - 1 ) {
45
45
const errorMessage = "Cover image is not in SVG format." ;
46
- errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . metadataPath ) ) ;
46
+ errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . path ) ) ;
47
47
}
48
48
49
49
let jsonSchema = JSON . parse ( fs . readFileSync ( config . metadataSchema ) ) ;
50
50
let validationResult = validate ( jsonData , jsonSchema ) ;
51
51
if ( validationResult . errors . length != 0 ) {
52
52
const errorMessage = `An error occurred while validating the metadata ${ validationResult } ` ;
53
- errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . metadataPath ) ) ;
53
+ errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . path ) ) ;
54
54
}
55
55
56
56
} catch ( error ) {
57
57
const errorMessage = "An error occurred while parsing the metadata" ;
58
- errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . metadataPath ) ) ;
58
+ errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . path ) ) ;
59
59
}
60
60
} ) ;
61
61
return errorsOccurred ;
@@ -96,8 +96,8 @@ validator.addValidation(async (tutorials) => {
96
96
let image = htmlDoc . querySelector ( "image" )
97
97
// Detect if there are embedded images that are actually rendered
98
98
if ( image . attributes . width || image . attributes . height ) {
99
- const errorMessage = path + " containes embedded binary images" ;
100
- errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . path ) ) ;
99
+ const errorMessage = path + " contains embedded binary images. " ;
100
+ errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . path , "warning" ) ) ;
101
101
}
102
102
}
103
103
} ) ;
0 commit comments