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

Function render_intent

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

Source from the content-addressed store, hash-verified

337}
338
339fn render_intent(intent: &IntentReport) -> String {
340 let conform = if intent.conforms {
341 "conforms".to_string()
342 } else {
343 format!("{} violation(s)", intent.gate_violations.len())
344 };
345 let conform_class = if intent.conforms { "ok" } else { "bad" };
346 let mut d = String::new();
347 d.push_str("<details class=\"intent\">\n");
348 d.push_str(&format!(
349 "<summary><span class=\"intent-id\">{}</span> <span class=\"badge {conform_class}\">{}</span></summary>\n",
350 html_escape(&intent.id),
351 html_escape(&conform)
352 ));
353 if let Some(reviewer) = &intent.reviewed_by {
354 d.push_str(&format!(
355 "<div class=\"reviewed-by\">reviewed by {}</div>\n",
356 html_escape(reviewer)
357 ));
358 }
359 if let Some(why) = &intent.why {
360 d.push_str(&format!("<p class=\"why\">{}</p>\n", html_escape(why)));
361 }
362 if !intent.gate_violations.is_empty() {
363 d.push_str("<ul class=\"violations\">\n");
364 for v in &intent.gate_violations {
365 d.push_str(&format!("<li>{}</li>\n", html_escape(v)));
366 }
367 d.push_str("</ul>\n");
368 }
369 if !intent.criteria.is_empty() {
370 d.push_str("<ul class=\"criteria\">\n");
371 for c in &intent.criteria {
372 d.push_str(&render_criterion(c));
373 }
374 d.push_str("</ul>\n");
375 }
376 d.push_str("</details>\n");
377 d
378}
379
380fn render_criterion(c: &CriterionReport) -> String {
381 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