Skip to content

Commit 5711a3e

Browse files
committed
add parser check
1 parent aadfcfb commit 5711a3e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

site/xls_parser.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,20 @@ def validate_xls_documents(root_dir: Path) -> bool:
193193
validation_errors.append(
194194
f"Error: {doc.folder} is missing required authors metadata"
195195
)
196+
elif any(not name for name, _ in doc.authors):
197+
validation_errors.append(
198+
f"Error: {doc.folder} has an author with missing name"
199+
)
200+
elif any(link == "" for _, link in doc.authors):
201+
validation_errors.append(
202+
f"Error: {doc.folder} has an author with missing link"
203+
)
204+
196205
if not doc.status or doc.status == "Unknown":
197206
validation_errors.append(
198207
f"Error: {doc.folder} is missing required status metadata"
199208
)
209+
200210
if not doc.category or doc.category == "Unknown":
201211
validation_errors.append(
202212
f"Error: {doc.folder} is missing required category metadata"
@@ -205,20 +215,22 @@ def validate_xls_documents(root_dir: Path) -> bool:
205215
validation_errors.append(
206216
f"Error: {doc.folder} has an invalid category: {doc.category}"
207217
)
218+
208219
if not doc.created or doc.created == "Unknown":
209220
validation_errors.append(
210221
f"Error: {doc.folder} is missing required created metadata"
211222
)
212223

213224
if validation_errors:
225+
print("\n")
214226
for error in validation_errors:
215227
print(error)
216228
print(
217229
f"Validation failed: {len(validation_errors)} document(s) missing required metadata"
218230
)
219231
return False
220232

221-
print(f"Successfully validated {len(docs)} XLS documents")
233+
print(f"\nSuccessfully validated {len(docs)} XLS documents")
222234
return True
223235

224236
except Exception as e:

0 commit comments

Comments
 (0)