MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / render_intent

Function render_intent

atomic-cli/src/commands/triage/output.rs:459–498  ·  view source on GitHub ↗
(intent: &IntentReport)

Source from the content-addressed store, hash-verified

457}
458
459fn render_intent(intent: &IntentReport) -> String {
460 let conform = if intent.conforms {
461 "conforms".to_string()
462 } else {
463 format!("{} violation(s)", intent.gate_violations.len())
464 };
465 let conform_class = if intent.conforms { "ok" } else { "bad" };
466 let mut d = String::new();
467 d.push_str("<details class=\"intent\">\n");
468 d.push_str(&format!(
469 "<summary><span class=\"intent-id\">{}</span> <span class=\"badge {conform_class}\">{}</span></summary>\n",
470 html_escape(&intent.id),
471 html_escape(&conform)
472 ));
473 if let Some(reviewer) = &intent.reviewed_by {
474 d.push_str(&format!(
475 "<div class=\"reviewed-by\">reviewed by {}</div>\n",
476 html_escape(reviewer)
477 ));
478 }
479 if let Some(why) = &intent.why {
480 d.push_str(&format!("<p class=\"why\">{}</p>\n", html_escape(why)));
481 }
482 if !intent.gate_violations.is_empty() {
483 d.push_str("<ul class=\"violations\">\n");
484 for v in &intent.gate_violations {
485 d.push_str(&format!("<li>{}</li>\n", html_escape(v)));
486 }
487 d.push_str("</ul>\n");
488 }
489 if !intent.criteria.is_empty() {
490 d.push_str("<ul class=\"criteria\">\n");
491 for c in &intent.criteria {
492 d.push_str(&render_criterion(c));
493 }
494 d.push_str("</ul>\n");
495 }
496 d.push_str("</details>\n");
497 d
498}
499
500fn render_criterion(c: &CriterionReport) -> String {
501 let met = c.status == "met";

Callers 1

render_htmlFunction · 0.85

Calls 2

render_criterionFunction · 0.85
is_emptyMethod · 0.45

Tested by

no test coverage detected