quality.py 577 B

12345678910111213141516
  1. from cyber_agent.application.quality import QualityCheckOutcome
  2. class PlaceholderQualityProvider:
  3. async def check(self, request):
  4. text = str(request.material.content.get("text", ""))
  5. failed = "{{placeholder}}" in text
  6. return [
  7. QualityCheckOutcome(
  8. rule_id=rule.rule_id,
  9. rule_version=rule.version,
  10. status="failed" if failed else "passed",
  11. issue="candidate still contains placeholder text" if failed else None,
  12. )
  13. for rule in request.rules
  14. ]