Skip to content

Commit b4c2c34

Browse files
Merge pull request #1787 from jyotish6699/improve/registry-validator-summary-status
feat: improve RegistryValidator validation summary with execution status
2 parents 26d16fa + 214624f commit b4c2c34

1 file changed

Lines changed: 25 additions & 7 deletions

File tree

utils/registry_validator.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def __init__(self, registry_path: str = "projects_registry.json"):
4343
self.errors = []
4444
self.warnings = []
4545
self.projects = []
46+
self.validation_status = "PENDING"
4647

4748
def load_registry(self):
4849
"""Load registry JSON."""
@@ -180,6 +181,7 @@ def validate(self):
180181
"""Run all validation checks."""
181182

182183
if not self.load_registry():
184+
self.validation_status = "ABORTED"
183185
return
184186

185187
self.validate_required_fields()
@@ -191,6 +193,11 @@ def validate(self):
191193
self.validate_project_paths()
192194
self.validate_keywords()
193195

196+
if self.errors:
197+
self.validation_status = "FAILED"
198+
else:
199+
self.validation_status = "PASSED"
200+
194201
def report(self, json_output=False):
195202
if json_output:
196203
print(
@@ -199,11 +206,7 @@ def report(self, json_output=False):
199206
"projects": len(self.projects),
200207
"errors": len(self.errors),
201208
"warnings": len(self.warnings),
202-
"status": (
203-
"passed"
204-
if not self.errors
205-
else "failed"
206-
),
209+
"status": self.validation_status.lower(),
207210
},
208211
indent=2,
209212
)
@@ -214,10 +217,25 @@ def report(self, json_output=False):
214217

215218
print("\n========== Registry Validation ==========\n")
216219

217-
print(f"Projects scanned : {len(self.projects)}")
220+
print(f"Status : {self.validation_status}")
221+
print(f"Registry : {self.registry_path}")
222+
223+
projects_scanned = (
224+
"N/A"
225+
if self.validation_status == "ABORTED"
226+
else len(self.projects)
227+
)
228+
229+
print(f"Projects scanned : {projects_scanned}")
218230
print(f"Errors : {len(self.errors)}")
219231
print(f"Warnings : {len(self.warnings)}")
220232

233+
if self.validation_status == "ABORTED":
234+
print(
235+
"\nValidation aborted because "
236+
"the registry could not be loaded."
237+
)
238+
221239
if self.errors:
222240
print("\nErrors:")
223241
for error in self.errors:
@@ -228,7 +246,7 @@ def report(self, json_output=False):
228246
for warning in self.warnings:
229247
print(f" - {warning}")
230248

231-
if not self.errors and not self.warnings:
249+
if self.validation_status == "PASSED" and not self.warnings:
232250
print("\n✓ Registry validation passed successfully.")
233251

234252
if __name__ == "__main__":

0 commit comments

Comments
 (0)