MCPcopy Create free account
hub / github.com/alibaba/open-code-review / routeComment

Function routeComment

scripts/github-actions/post-review-comments.js:1626–1642  ·  view source on GitHub ↗
(comment, policy)

Source from the content-addressed store, hash-verified

1624// category or severity has no rank and no enum membership, so it falls through
1625// to the normal inline path (visible), never dropped.
1626function routeComment(comment, policy) {
1627 if (!policy || (!policy.routeBySeverity && !policy.routeByCategory)) {
1628 return { routed: false };
1629 }
1630 const catRaw = comment && comment.category != null ? String(comment.category).trim().toLowerCase() : "";
1631 const sevRaw = comment && comment.severity != null ? String(comment.severity).trim().toLowerCase() : "";
1632 const catKnown = catRaw !== "" && CATEGORIES.includes(catRaw);
1633 const sevKnown = sevRaw !== "" && SEVERITY_RANK.has(sevRaw);
1634
1635 if (policy.routeBySeverity && sevKnown && SEVERITY_RANK.get(sevRaw) <= policy.severityRank) {
1636 return { routed: true, reason: `Routed to summary (severity ${sevRaw}${catKnown ? ` · category ${catRaw}` : ""})` };
1637 }
1638 if (policy.routeByCategory && catKnown && policy.categories.has(catRaw)) {
1639 return { routed: true, reason: `Routed to summary (category ${catRaw}${sevKnown ? ` · severity ${sevRaw}` : ""})` };
1640 }
1641 return { routed: false };
1642}
1643
1644// ---- Formatting helpers (ported verbatim) ----
1645

Calls

no outgoing calls