#[non_exhaustive]pub struct Finding {
pub message: String,
pub tone: Tone,
pub location: Option<Location>,
pub rule_id: Option<String>,
pub remedy: Option<String>,
pub confidence: Option<Confidence>,
pub badge: Option<Badge>,
}Expand description
An individual finding entry within a report.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.message: String§tone: Tone§location: Option<Location>§rule_id: Option<String>§remedy: Option<String>§confidence: Option<Confidence>§badge: Option<Badge>Implementations§
Source§impl Finding
impl Finding
Sourcepub fn new(tone: Tone, message: impl Into<String>) -> Self
pub fn new(tone: Tone, message: impl Into<String>) -> Self
Creates a basic finding.
Examples found in repository?
examples/report_demo.rs (line 46)
6fn main() {
7 let console = Console::stdout(ColorMode::Auto);
8
9 println!("=== 1. Verdict & Status ===");
10 println!(
11 "{}",
12 Verdict::Passed.render(console, "Configuration validated cleanly")
13 );
14 println!(
15 "{}",
16 Verdict::Warning.render(console, "3 non-critical findings detected")
17 );
18 println!(
19 "{}",
20 Verdict::Failed.render(console, "Build failed: 2 errors")
21 );
22 println!();
23
24 println!("=== 2. Error / Prerequisite Block ===");
25 let err_block = ErrorBlock::new("Required toolchain is unavailable")
26 .with_explanation("The configured version is not installed.")
27 .with_remedy("Install the required toolchain:")
28 .add_command("toolchain install stable");
29 print!("{}", err_block.render(console));
30
31 println!("=== 3. Decision-Oriented Report (Compact) ===");
32 let report = Report::new("Site audit v1.2.0", Verdict::Warning)
33 .add_scope_note(ScopeNote::new(
34 "Scope warnings",
35 vec![
36 "Git history partial".to_string(),
37 "1 file skipped".to_string(),
38 ],
39 ))
40 .add_metric(Metric::new("Errors", "0"))
41 .add_metric(Metric::new("Warnings", "4").with_trend(runemark::Trend::Negative, "+2"))
42 .add_metric(Metric::new("Score", "94/100").with_trend(runemark::Trend::Positive, "+5%"))
43 .add_group(
44 FindingGroup::new("Accessibility Violations")
45 .add_finding(
46 Finding::new(runemark::Tone::Warning, "Image missing alt attribute")
47 .with_rule_id("a11y/img-alt")
48 .with_badge(runemark::Badge::quick_win())
49 .with_confidence(runemark::Confidence::High)
50 .with_location(Location::file_line_col("src/pages/index.astro", 42, 10))
51 .with_remedy("Add alt=\"...\" description to <img> tag"),
52 )
53 .add_finding(
54 Finding::new(runemark::Tone::Warning, "Low contrast ratio on hero button")
55 .with_rule_id("a11y/contrast")
56 .with_location(Location::file_line("src/components/Hero.astro", 18)),
57 ),
58 )
59 .add_next_step(
60 NextStep::new("Run auto-fixer for formatting issues").with_command("audit --fix"),
61 );
62
63 print!("{}", report.render(console));
64
65 println!("=== 4. Detailed Report View ===");
66 let detailed_report = report.with_detail_level(DetailLevel::Detailed);
67 print!("{}", detailed_report.render(console));
68
69 println!("=== 5. Generator Diff View ===");
70 let diff = DiffBlock::new()
71 .add_change(
72 FileChange::new(FileAction::Added, "src/components/Footer.astro").with_delta("+1.2 kB"),
73 )
74 .add_change(FileChange::new(
75 FileAction::Modified,
76 "src/layouts/Layout.astro",
77 ))
78 .add_change(FileChange::new(
79 FileAction::Deleted,
80 "src/legacy/Footer.jsx",
81 ));
82 print!("{}", diff.render(console));
83}Sourcepub fn with_location(self, location: Location) -> Self
pub fn with_location(self, location: Location) -> Self
Attaches a location to this finding.
Examples found in repository?
examples/report_demo.rs (line 50)
6fn main() {
7 let console = Console::stdout(ColorMode::Auto);
8
9 println!("=== 1. Verdict & Status ===");
10 println!(
11 "{}",
12 Verdict::Passed.render(console, "Configuration validated cleanly")
13 );
14 println!(
15 "{}",
16 Verdict::Warning.render(console, "3 non-critical findings detected")
17 );
18 println!(
19 "{}",
20 Verdict::Failed.render(console, "Build failed: 2 errors")
21 );
22 println!();
23
24 println!("=== 2. Error / Prerequisite Block ===");
25 let err_block = ErrorBlock::new("Required toolchain is unavailable")
26 .with_explanation("The configured version is not installed.")
27 .with_remedy("Install the required toolchain:")
28 .add_command("toolchain install stable");
29 print!("{}", err_block.render(console));
30
31 println!("=== 3. Decision-Oriented Report (Compact) ===");
32 let report = Report::new("Site audit v1.2.0", Verdict::Warning)
33 .add_scope_note(ScopeNote::new(
34 "Scope warnings",
35 vec![
36 "Git history partial".to_string(),
37 "1 file skipped".to_string(),
38 ],
39 ))
40 .add_metric(Metric::new("Errors", "0"))
41 .add_metric(Metric::new("Warnings", "4").with_trend(runemark::Trend::Negative, "+2"))
42 .add_metric(Metric::new("Score", "94/100").with_trend(runemark::Trend::Positive, "+5%"))
43 .add_group(
44 FindingGroup::new("Accessibility Violations")
45 .add_finding(
46 Finding::new(runemark::Tone::Warning, "Image missing alt attribute")
47 .with_rule_id("a11y/img-alt")
48 .with_badge(runemark::Badge::quick_win())
49 .with_confidence(runemark::Confidence::High)
50 .with_location(Location::file_line_col("src/pages/index.astro", 42, 10))
51 .with_remedy("Add alt=\"...\" description to <img> tag"),
52 )
53 .add_finding(
54 Finding::new(runemark::Tone::Warning, "Low contrast ratio on hero button")
55 .with_rule_id("a11y/contrast")
56 .with_location(Location::file_line("src/components/Hero.astro", 18)),
57 ),
58 )
59 .add_next_step(
60 NextStep::new("Run auto-fixer for formatting issues").with_command("audit --fix"),
61 );
62
63 print!("{}", report.render(console));
64
65 println!("=== 4. Detailed Report View ===");
66 let detailed_report = report.with_detail_level(DetailLevel::Detailed);
67 print!("{}", detailed_report.render(console));
68
69 println!("=== 5. Generator Diff View ===");
70 let diff = DiffBlock::new()
71 .add_change(
72 FileChange::new(FileAction::Added, "src/components/Footer.astro").with_delta("+1.2 kB"),
73 )
74 .add_change(FileChange::new(
75 FileAction::Modified,
76 "src/layouts/Layout.astro",
77 ))
78 .add_change(FileChange::new(
79 FileAction::Deleted,
80 "src/legacy/Footer.jsx",
81 ));
82 print!("{}", diff.render(console));
83}Sourcepub fn with_rule_id(self, rule_id: impl Into<String>) -> Self
pub fn with_rule_id(self, rule_id: impl Into<String>) -> Self
Attaches a rule identifier.
Examples found in repository?
examples/report_demo.rs (line 47)
6fn main() {
7 let console = Console::stdout(ColorMode::Auto);
8
9 println!("=== 1. Verdict & Status ===");
10 println!(
11 "{}",
12 Verdict::Passed.render(console, "Configuration validated cleanly")
13 );
14 println!(
15 "{}",
16 Verdict::Warning.render(console, "3 non-critical findings detected")
17 );
18 println!(
19 "{}",
20 Verdict::Failed.render(console, "Build failed: 2 errors")
21 );
22 println!();
23
24 println!("=== 2. Error / Prerequisite Block ===");
25 let err_block = ErrorBlock::new("Required toolchain is unavailable")
26 .with_explanation("The configured version is not installed.")
27 .with_remedy("Install the required toolchain:")
28 .add_command("toolchain install stable");
29 print!("{}", err_block.render(console));
30
31 println!("=== 3. Decision-Oriented Report (Compact) ===");
32 let report = Report::new("Site audit v1.2.0", Verdict::Warning)
33 .add_scope_note(ScopeNote::new(
34 "Scope warnings",
35 vec![
36 "Git history partial".to_string(),
37 "1 file skipped".to_string(),
38 ],
39 ))
40 .add_metric(Metric::new("Errors", "0"))
41 .add_metric(Metric::new("Warnings", "4").with_trend(runemark::Trend::Negative, "+2"))
42 .add_metric(Metric::new("Score", "94/100").with_trend(runemark::Trend::Positive, "+5%"))
43 .add_group(
44 FindingGroup::new("Accessibility Violations")
45 .add_finding(
46 Finding::new(runemark::Tone::Warning, "Image missing alt attribute")
47 .with_rule_id("a11y/img-alt")
48 .with_badge(runemark::Badge::quick_win())
49 .with_confidence(runemark::Confidence::High)
50 .with_location(Location::file_line_col("src/pages/index.astro", 42, 10))
51 .with_remedy("Add alt=\"...\" description to <img> tag"),
52 )
53 .add_finding(
54 Finding::new(runemark::Tone::Warning, "Low contrast ratio on hero button")
55 .with_rule_id("a11y/contrast")
56 .with_location(Location::file_line("src/components/Hero.astro", 18)),
57 ),
58 )
59 .add_next_step(
60 NextStep::new("Run auto-fixer for formatting issues").with_command("audit --fix"),
61 );
62
63 print!("{}", report.render(console));
64
65 println!("=== 4. Detailed Report View ===");
66 let detailed_report = report.with_detail_level(DetailLevel::Detailed);
67 print!("{}", detailed_report.render(console));
68
69 println!("=== 5. Generator Diff View ===");
70 let diff = DiffBlock::new()
71 .add_change(
72 FileChange::new(FileAction::Added, "src/components/Footer.astro").with_delta("+1.2 kB"),
73 )
74 .add_change(FileChange::new(
75 FileAction::Modified,
76 "src/layouts/Layout.astro",
77 ))
78 .add_change(FileChange::new(
79 FileAction::Deleted,
80 "src/legacy/Footer.jsx",
81 ));
82 print!("{}", diff.render(console));
83}Sourcepub fn with_remedy(self, remedy: impl Into<String>) -> Self
pub fn with_remedy(self, remedy: impl Into<String>) -> Self
Attaches a remedy hint.
Examples found in repository?
examples/report_demo.rs (line 51)
6fn main() {
7 let console = Console::stdout(ColorMode::Auto);
8
9 println!("=== 1. Verdict & Status ===");
10 println!(
11 "{}",
12 Verdict::Passed.render(console, "Configuration validated cleanly")
13 );
14 println!(
15 "{}",
16 Verdict::Warning.render(console, "3 non-critical findings detected")
17 );
18 println!(
19 "{}",
20 Verdict::Failed.render(console, "Build failed: 2 errors")
21 );
22 println!();
23
24 println!("=== 2. Error / Prerequisite Block ===");
25 let err_block = ErrorBlock::new("Required toolchain is unavailable")
26 .with_explanation("The configured version is not installed.")
27 .with_remedy("Install the required toolchain:")
28 .add_command("toolchain install stable");
29 print!("{}", err_block.render(console));
30
31 println!("=== 3. Decision-Oriented Report (Compact) ===");
32 let report = Report::new("Site audit v1.2.0", Verdict::Warning)
33 .add_scope_note(ScopeNote::new(
34 "Scope warnings",
35 vec![
36 "Git history partial".to_string(),
37 "1 file skipped".to_string(),
38 ],
39 ))
40 .add_metric(Metric::new("Errors", "0"))
41 .add_metric(Metric::new("Warnings", "4").with_trend(runemark::Trend::Negative, "+2"))
42 .add_metric(Metric::new("Score", "94/100").with_trend(runemark::Trend::Positive, "+5%"))
43 .add_group(
44 FindingGroup::new("Accessibility Violations")
45 .add_finding(
46 Finding::new(runemark::Tone::Warning, "Image missing alt attribute")
47 .with_rule_id("a11y/img-alt")
48 .with_badge(runemark::Badge::quick_win())
49 .with_confidence(runemark::Confidence::High)
50 .with_location(Location::file_line_col("src/pages/index.astro", 42, 10))
51 .with_remedy("Add alt=\"...\" description to <img> tag"),
52 )
53 .add_finding(
54 Finding::new(runemark::Tone::Warning, "Low contrast ratio on hero button")
55 .with_rule_id("a11y/contrast")
56 .with_location(Location::file_line("src/components/Hero.astro", 18)),
57 ),
58 )
59 .add_next_step(
60 NextStep::new("Run auto-fixer for formatting issues").with_command("audit --fix"),
61 );
62
63 print!("{}", report.render(console));
64
65 println!("=== 4. Detailed Report View ===");
66 let detailed_report = report.with_detail_level(DetailLevel::Detailed);
67 print!("{}", detailed_report.render(console));
68
69 println!("=== 5. Generator Diff View ===");
70 let diff = DiffBlock::new()
71 .add_change(
72 FileChange::new(FileAction::Added, "src/components/Footer.astro").with_delta("+1.2 kB"),
73 )
74 .add_change(FileChange::new(
75 FileAction::Modified,
76 "src/layouts/Layout.astro",
77 ))
78 .add_change(FileChange::new(
79 FileAction::Deleted,
80 "src/legacy/Footer.jsx",
81 ));
82 print!("{}", diff.render(console));
83}Sourcepub fn with_confidence(self, confidence: Confidence) -> Self
pub fn with_confidence(self, confidence: Confidence) -> Self
Attaches a confidence level rating.
Examples found in repository?
examples/report_demo.rs (line 49)
6fn main() {
7 let console = Console::stdout(ColorMode::Auto);
8
9 println!("=== 1. Verdict & Status ===");
10 println!(
11 "{}",
12 Verdict::Passed.render(console, "Configuration validated cleanly")
13 );
14 println!(
15 "{}",
16 Verdict::Warning.render(console, "3 non-critical findings detected")
17 );
18 println!(
19 "{}",
20 Verdict::Failed.render(console, "Build failed: 2 errors")
21 );
22 println!();
23
24 println!("=== 2. Error / Prerequisite Block ===");
25 let err_block = ErrorBlock::new("Required toolchain is unavailable")
26 .with_explanation("The configured version is not installed.")
27 .with_remedy("Install the required toolchain:")
28 .add_command("toolchain install stable");
29 print!("{}", err_block.render(console));
30
31 println!("=== 3. Decision-Oriented Report (Compact) ===");
32 let report = Report::new("Site audit v1.2.0", Verdict::Warning)
33 .add_scope_note(ScopeNote::new(
34 "Scope warnings",
35 vec![
36 "Git history partial".to_string(),
37 "1 file skipped".to_string(),
38 ],
39 ))
40 .add_metric(Metric::new("Errors", "0"))
41 .add_metric(Metric::new("Warnings", "4").with_trend(runemark::Trend::Negative, "+2"))
42 .add_metric(Metric::new("Score", "94/100").with_trend(runemark::Trend::Positive, "+5%"))
43 .add_group(
44 FindingGroup::new("Accessibility Violations")
45 .add_finding(
46 Finding::new(runemark::Tone::Warning, "Image missing alt attribute")
47 .with_rule_id("a11y/img-alt")
48 .with_badge(runemark::Badge::quick_win())
49 .with_confidence(runemark::Confidence::High)
50 .with_location(Location::file_line_col("src/pages/index.astro", 42, 10))
51 .with_remedy("Add alt=\"...\" description to <img> tag"),
52 )
53 .add_finding(
54 Finding::new(runemark::Tone::Warning, "Low contrast ratio on hero button")
55 .with_rule_id("a11y/contrast")
56 .with_location(Location::file_line("src/components/Hero.astro", 18)),
57 ),
58 )
59 .add_next_step(
60 NextStep::new("Run auto-fixer for formatting issues").with_command("audit --fix"),
61 );
62
63 print!("{}", report.render(console));
64
65 println!("=== 4. Detailed Report View ===");
66 let detailed_report = report.with_detail_level(DetailLevel::Detailed);
67 print!("{}", detailed_report.render(console));
68
69 println!("=== 5. Generator Diff View ===");
70 let diff = DiffBlock::new()
71 .add_change(
72 FileChange::new(FileAction::Added, "src/components/Footer.astro").with_delta("+1.2 kB"),
73 )
74 .add_change(FileChange::new(
75 FileAction::Modified,
76 "src/layouts/Layout.astro",
77 ))
78 .add_change(FileChange::new(
79 FileAction::Deleted,
80 "src/legacy/Footer.jsx",
81 ));
82 print!("{}", diff.render(console));
83}Sourcepub fn with_badge(self, badge: Badge) -> Self
pub fn with_badge(self, badge: Badge) -> Self
Attaches a status badge.
Examples found in repository?
examples/report_demo.rs (line 48)
6fn main() {
7 let console = Console::stdout(ColorMode::Auto);
8
9 println!("=== 1. Verdict & Status ===");
10 println!(
11 "{}",
12 Verdict::Passed.render(console, "Configuration validated cleanly")
13 );
14 println!(
15 "{}",
16 Verdict::Warning.render(console, "3 non-critical findings detected")
17 );
18 println!(
19 "{}",
20 Verdict::Failed.render(console, "Build failed: 2 errors")
21 );
22 println!();
23
24 println!("=== 2. Error / Prerequisite Block ===");
25 let err_block = ErrorBlock::new("Required toolchain is unavailable")
26 .with_explanation("The configured version is not installed.")
27 .with_remedy("Install the required toolchain:")
28 .add_command("toolchain install stable");
29 print!("{}", err_block.render(console));
30
31 println!("=== 3. Decision-Oriented Report (Compact) ===");
32 let report = Report::new("Site audit v1.2.0", Verdict::Warning)
33 .add_scope_note(ScopeNote::new(
34 "Scope warnings",
35 vec![
36 "Git history partial".to_string(),
37 "1 file skipped".to_string(),
38 ],
39 ))
40 .add_metric(Metric::new("Errors", "0"))
41 .add_metric(Metric::new("Warnings", "4").with_trend(runemark::Trend::Negative, "+2"))
42 .add_metric(Metric::new("Score", "94/100").with_trend(runemark::Trend::Positive, "+5%"))
43 .add_group(
44 FindingGroup::new("Accessibility Violations")
45 .add_finding(
46 Finding::new(runemark::Tone::Warning, "Image missing alt attribute")
47 .with_rule_id("a11y/img-alt")
48 .with_badge(runemark::Badge::quick_win())
49 .with_confidence(runemark::Confidence::High)
50 .with_location(Location::file_line_col("src/pages/index.astro", 42, 10))
51 .with_remedy("Add alt=\"...\" description to <img> tag"),
52 )
53 .add_finding(
54 Finding::new(runemark::Tone::Warning, "Low contrast ratio on hero button")
55 .with_rule_id("a11y/contrast")
56 .with_location(Location::file_line("src/components/Hero.astro", 18)),
57 ),
58 )
59 .add_next_step(
60 NextStep::new("Run auto-fixer for formatting issues").with_command("audit --fix"),
61 );
62
63 print!("{}", report.render(console));
64
65 println!("=== 4. Detailed Report View ===");
66 let detailed_report = report.with_detail_level(DetailLevel::Detailed);
67 print!("{}", detailed_report.render(console));
68
69 println!("=== 5. Generator Diff View ===");
70 let diff = DiffBlock::new()
71 .add_change(
72 FileChange::new(FileAction::Added, "src/components/Footer.astro").with_delta("+1.2 kB"),
73 )
74 .add_change(FileChange::new(
75 FileAction::Modified,
76 "src/layouts/Layout.astro",
77 ))
78 .add_change(FileChange::new(
79 FileAction::Deleted,
80 "src/legacy/Footer.jsx",
81 ));
82 print!("{}", diff.render(console));
83}Trait Implementations§
impl Eq for Finding
impl StructuralPartialEq for Finding
Auto Trait Implementations§
impl Freeze for Finding
impl RefUnwindSafe for Finding
impl Send for Finding
impl Sync for Finding
impl Unpin for Finding
impl UnsafeUnpin for Finding
impl UnwindSafe for Finding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more