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

Function routeComment

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

Source from the content-addressed store, hash-verified

1506// category or severity has no rank and no enum membership, so it falls through
1507// to the normal inline path (visible), never dropped.
1508function routeComment(comment, policy) {
1509 if (!policy || (!policy.routeBySeverity && !policy.routeByCategory)) {
1510 return { routed: false };
1511 }
1512 const catRaw = comment && comment.category != null ? String(comment.category).trim().toLowerCase() : "";
1513 const sevRaw = comment && comment.severity != null ? String(comment.severity).trim().toLowerCase() : "";
1514 const catKnown = catRaw !== "" && CATEGORIES.includes(catRaw);
1515 const sevKnown = sevRaw !== "" && SEVERITY_RANK.has(sevRaw);
1516
1517 if (policy.routeBySeverity && sevKnown && SEVERITY_RANK.get(sevRaw) <= policy.severityRank) {
1518 return { routed: true, reason: `Routed to summary (severity ${sevRaw}${catKnown ? ` · category ${catRaw}` : ""})` };
1519 }
1520 if (policy.routeByCategory && catKnown && policy.categories.has(catRaw)) {
1521 return { routed: true, reason: `Routed to summary (category ${catRaw}${sevKnown ? ` · severity ${sevRaw}` : ""})` };
1522 }
1523 return { routed: false };
1524}
1525
1526// ---- Formatting helpers (ported verbatim) ----
1527

Calls

no outgoing calls