File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 3
3
4
4
# Standard
5
5
import argparse
6
+ import glob
6
7
import os
7
8
import pathlib
9
+ import re
8
10
import sys
9
11
10
12
# Third Party
@@ -49,8 +51,30 @@ def check(self) -> int:
49
51
"The \" %s\" file must be non-empty" ,
50
52
taxonomy .path .with_name (attribution_path .name ),
51
53
)
54
+ # NOTE: The following three warnings are intended for the beta only, at the moment, and only to flag
55
+ # issues for maintainers to address rather than block on them. We will revisit when other content is
56
+ # allowed.
57
+ qna_file_contents = parser .parse (taxonomy .rel_path .with_name ("qna.yaml" )).contents
58
+ for element in qna_file_contents ["document" ]["patterns" ]:
59
+ if not re .match ('.*.md' , element ):
60
+ taxonomy .warning (
61
+ "The document \" %s\" should be a markdown file." ,
62
+ element
63
+ )
64
+ if not re .match ('https://github\.com\/.*' ,qna_file_contents ["document" ]["repo" ]):
65
+ taxonomy .warning (
66
+ "The document repo \" %s\" needs to be a GitHub-based repository." ,
67
+ qna_file_contents ["document" ]["repo" ]
68
+ )
69
+ if not re .match ('[0-9a-f]{40}' , qna_file_contents ["document" ]["commit" ]):
70
+ taxonomy .warning (
71
+ "The document commit \" %s\" needs to be an alphanumeric value that represents a commit. \Please check with the reviewers for help." ,
72
+ qna_file_contents ["document" ]["commit" ]
73
+ )
52
74
if taxonomy .errors > 0 :
53
75
exit_code = 1
76
+ if taxonomy .warnings > 0 :
77
+ exit_code = 0
54
78
if not self .yaml_files :
55
79
print ("No yaml files specified." )
56
80
return exit_code
You can’t perform that action at this time.
0 commit comments