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

Function routeComment

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

Source from the content-addressed store, hash-verified

2352// category or severity has no rank and no enum membership, so it falls through
2353// to the normal inline path (visible), never dropped.
2354function routeComment(comment, policy) {
2355 if (!policy || (!policy.routeBySeverity && !policy.routeByCategory)) {
2356 return { routed: false };
2357 }
2358 const catRaw = comment && comment.category != null ? String(comment.category).trim().toLowerCase() : "";
2359 const sevRaw = comment && comment.severity != null ? String(comment.severity).trim().toLowerCase() : "";
2360 const catKnown = catRaw !== "" && CATEGORIES.includes(catRaw);
2361 const sevKnown = sevRaw !== "" && SEVERITY_RANK.has(sevRaw);
2362
2363 if (policy.routeBySeverity && sevKnown && SEVERITY_RANK.get(sevRaw) <= policy.severityRank) {
2364 return { routed: true, reason: `Routed to summary (severity ${sevRaw}${catKnown ? ` · category ${catRaw}` : ""})` };
2365 }
2366 if (policy.routeByCategory && catKnown && policy.categories.has(catRaw)) {
2367 return { routed: true, reason: `Routed to summary (category ${catRaw}${sevKnown ? ` · severity ${sevRaw}` : ""})` };
2368 }
2369 return { routed: false };
2370}
2371
2372// ---- Formatting helpers (ported verbatim) ----
2373

Calls 1

getMethod · 0.45