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

Function routeComment

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

Source from the content-addressed store, hash-verified

1332// category or severity has no rank and no enum membership, so it falls through
1333// to the normal inline path (visible), never dropped.
1334function routeComment(comment, policy) {
1335 if (!policy || (!policy.routeBySeverity && !policy.routeByCategory)) {
1336 return { routed: false };
1337 }
1338 const catRaw = comment && comment.category != null ? String(comment.category).trim().toLowerCase() : "";
1339 const sevRaw = comment && comment.severity != null ? String(comment.severity).trim().toLowerCase() : "";
1340 const catKnown = catRaw !== "" && CATEGORIES.includes(catRaw);
1341 const sevKnown = sevRaw !== "" && SEVERITY_RANK.has(sevRaw);
1342
1343 if (policy.routeBySeverity && sevKnown && SEVERITY_RANK.get(sevRaw) <= policy.severityRank) {
1344 return { routed: true, reason: `Routed to summary (severity ${sevRaw}${catKnown ? ` · category ${catRaw}` : ""})` };
1345 }
1346 if (policy.routeByCategory && catKnown && policy.categories.has(catRaw)) {
1347 return { routed: true, reason: `Routed to summary (category ${catRaw}${sevKnown ? ` · severity ${sevRaw}` : ""})` };
1348 }
1349 return { routed: false };
1350}
1351
1352// ---- Formatting helpers (ported verbatim) ----
1353

Calls

no outgoing calls