dart-decimate 0.0.28 → 0.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/README.md +36 -60
  4. package/npm/bin/runner.js +26 -14
  5. package/npm/scripts/postinstall.js +89 -63
  6. package/package.json +6 -5
  7. package/src/baseline.rs +38 -0
  8. package/src/cli/health_args.rs +36 -7
  9. package/src/cli/html_open.rs +4 -0
  10. package/src/cli/issue_filter_args.rs +1 -0
  11. package/src/cli/security_summary_run.rs +1 -0
  12. package/src/config/health.rs +22 -2
  13. package/src/config/rule_aliases.rs +43 -0
  14. package/src/config/rules.rs +46 -1
  15. package/src/config.rs +2 -1
  16. package/src/dart_parser/test_support.rs +51 -0
  17. package/src/dart_parser.rs +8 -0
  18. package/src/dependencies/analyze.rs +3 -1
  19. package/src/dependencies/tests.rs +111 -7
  20. package/src/dependencies/usage.rs +5 -1
  21. package/src/dependencies.rs +7 -3
  22. package/src/explain/flutter_style.rs +43 -0
  23. package/src/explain/misc.rs +72 -0
  24. package/src/explain.rs +23 -67
  25. package/src/flutter_style/scanner.rs +883 -0
  26. package/src/flutter_style/types.rs +90 -0
  27. package/src/flutter_style/usage.rs +349 -0
  28. package/src/flutter_style.rs +72 -0
  29. package/src/generated.rs +154 -0
  30. package/src/health/large_units.rs +49 -0
  31. package/src/health/tests.rs +212 -1
  32. package/src/health/threshold_types.rs +31 -1
  33. package/src/health/thresholds.rs +49 -0
  34. package/src/health/types.rs +35 -0
  35. package/src/health.rs +72 -6
  36. package/src/inspect.rs +8 -0
  37. package/src/lib.rs +17 -5
  38. package/src/manifest.rs +7 -3
  39. package/src/output/dependency_findings.rs +14 -1
  40. package/src/output/flutter_style.rs +189 -0
  41. package/src/output/health_findings.rs +93 -10
  42. package/src/output/health_inventory.rs +121 -0
  43. package/src/output/html/tests.rs +20 -0
  44. package/src/output/html.rs +10 -1
  45. package/src/output/human.rs +85 -1
  46. package/src/output/human_details.rs +93 -12
  47. package/src/output/scope.rs +62 -2
  48. package/src/output/security_findings.rs +101 -76
  49. package/src/output/security_sarif.rs +24 -13
  50. package/src/output/suppressions.rs +4 -0
  51. package/src/output/types.rs +38 -2
  52. package/src/output/verdict.rs +12 -0
  53. package/src/output.rs +77 -74
  54. package/src/report_schema/inventory.rs +268 -4
  55. package/src/report_schema.rs +94 -60
  56. package/src/security/catalogue.rs +103 -0
  57. package/src/security/detect/weak_randomness.rs +762 -0
  58. package/src/security/detect.rs +1535 -221
  59. package/src/security/security_matchers.toml +172 -0
  60. package/src/security/tests.rs +336 -2
  61. package/src/security.rs +292 -56
  62. package/src/security_gate.rs +28 -0
  63. package/src/semantic.rs +276 -0
  64. package/src/symbols/semantic_evidence.rs +342 -0
  65. package/src/symbols.rs +20 -10
  66. package/src/trace/rendering.rs +54 -0
  67. package/src/trace/semantic.rs +126 -0
  68. package/src/trace.rs +54 -62
  69. package/src/widgets/inheritance.rs +63 -0
  70. package/src/widgets.rs +33 -3
@@ -5,10 +5,10 @@ use serde::{Deserialize, Serialize};
5
5
  use super::format::display_path;
6
6
  use super::{Finding, FindingAction, FindingKind, Severity};
7
7
  use crate::{
8
- ComplexityContribution, ComplexityFinding, ComplexityRule, CoverageGapFinding,
9
- CoverageGapReason, CrapFinding, EffectiveThresholds, FileCoverageStatus, FileHealthScore,
10
- HealthHotspot, HealthReport, HealthThresholdOverrideReport, HealthThresholdOverrideStatus,
11
- RefactoringTarget, ThresholdSource,
8
+ ComplexityContribution, ComplexityFinding, ComplexityFunctionKind, ComplexityRule,
9
+ CoverageGapFinding, CoverageGapReason, CrapFinding, EffectiveThresholds, FileCoverageStatus,
10
+ FileHealthScore, HealthHotspot, HealthReport, HealthThresholdOverrideReport,
11
+ HealthThresholdOverrideStatus, LargeFunction, RefactoringTarget, ThresholdSource,
12
12
  };
13
13
 
14
14
  /// Complexity finding serialized in JSON reports.
@@ -53,6 +53,37 @@ pub struct JsonComplexityFinding {
53
53
  pub contributions: Vec<JsonComplexityContribution>,
54
54
  }
55
55
 
56
+ /// Advisory large function serialized in JSON reports.
57
+ #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
58
+ pub struct JsonLargeFunction {
59
+ /// Stable advisory identifier.
60
+ pub rule_id: String,
61
+ /// Dart file path, root-relative where possible.
62
+ pub path: String,
63
+ /// Function-like declaration name.
64
+ pub symbol: String,
65
+ /// Function-like declaration kind.
66
+ pub kind: String,
67
+ /// 1-based start line.
68
+ pub line: usize,
69
+ /// 0-based byte column.
70
+ pub column: usize,
71
+ /// Inclusive 1-based ending line.
72
+ pub end_line: usize,
73
+ /// Inclusive physical line count.
74
+ pub line_count: usize,
75
+ /// Effective inclusive physical-line ceiling.
76
+ pub max_unit_size: usize,
77
+ /// Source of the effective threshold when overridden.
78
+ #[serde(skip_serializing_if = "Option::is_none")]
79
+ pub threshold_source: Option<String>,
80
+ /// Configured reason for the threshold override.
81
+ #[serde(skip_serializing_if = "Option::is_none")]
82
+ pub threshold_reason: Option<String>,
83
+ /// Refactoring guidance appropriate to the declaration kind.
84
+ pub guidance: String,
85
+ }
86
+
56
87
  /// Effective thresholds serialized in JSON reports.
57
88
  #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
58
89
  pub struct JsonEffectiveThresholds {
@@ -65,6 +96,9 @@ pub struct JsonEffectiveThresholds {
65
96
  /// CRAP ceiling used for this function.
66
97
  #[serde(skip_serializing_if = "Option::is_none")]
67
98
  pub max_crap: Option<usize>,
99
+ /// Inclusive physical-line ceiling used for this function.
100
+ #[serde(skip_serializing_if = "Option::is_none")]
101
+ pub max_unit_size: Option<usize>,
68
102
  }
69
103
 
70
104
  /// Threshold override state serialized in JSON reports.
@@ -82,6 +116,8 @@ pub struct JsonThresholdOverride {
82
116
  pub max_cognitive: Option<usize>,
83
117
  /// Local CRAP ceiling.
84
118
  pub max_crap: Option<usize>,
119
+ /// Local inclusive physical-line ceiling.
120
+ pub max_unit_size: Option<usize>,
85
121
  /// Configured reason.
86
122
  pub reason: Option<String>,
87
123
  /// Whether this override currently changes or explains threshold output.
@@ -221,6 +257,9 @@ pub(super) fn add_health_findings(root: &Path, report: &HealthReport, findings:
221
257
  .iter()
222
258
  .map(|finding| refactoring_target_finding(root, finding)),
223
259
  );
260
+ if let Some(style) = &report.flutter_style {
261
+ super::flutter_style::add_flutter_style_findings(root, style, findings);
262
+ }
224
263
  }
225
264
 
226
265
  pub(super) fn json_complexity(root: &Path, report: &HealthReport) -> Vec<JsonComplexityFinding> {
@@ -238,6 +277,14 @@ pub(super) fn json_complexity(root: &Path, report: &HealthReport) -> Vec<JsonCom
238
277
  findings
239
278
  }
240
279
 
280
+ pub(super) fn json_large_functions(root: &Path, report: &HealthReport) -> Vec<JsonLargeFunction> {
281
+ report
282
+ .large_functions
283
+ .iter()
284
+ .map(|function| json_large_function(root, function))
285
+ .collect()
286
+ }
287
+
241
288
  pub(super) fn json_file_scores(root: &Path, report: &HealthReport) -> Vec<JsonFileHealthScore> {
242
289
  report
243
290
  .file_scores
@@ -473,9 +520,7 @@ fn json_complexity_finding(root: &Path, finding: &ComplexityFinding) -> JsonComp
473
520
  rule_id: finding.rule.rule_id().to_owned(),
474
521
  path: display_path(root, &finding.path),
475
522
  symbol: finding.symbol.clone(),
476
- kind: format!("{:?}", finding.kind)
477
- .to_ascii_lowercase()
478
- .replace('_', "-"),
523
+ kind: function_kind(finding.kind).to_owned(),
479
524
  line: finding.location.line,
480
525
  column: finding.location.column,
481
526
  cyclomatic_complexity: finding.cyclomatic_complexity,
@@ -507,9 +552,7 @@ fn json_crap_finding(root: &Path, finding: &CrapFinding) -> JsonComplexityFindin
507
552
  rule_id: "dart-decimate/high-crap-score".to_owned(),
508
553
  path: display_path(root, &finding.path),
509
554
  symbol: finding.symbol.clone(),
510
- kind: format!("{:?}", finding.kind)
511
- .to_ascii_lowercase()
512
- .replace('_', "-"),
555
+ kind: function_kind(finding.kind).to_owned(),
513
556
  line: finding.location.line,
514
557
  column: finding.location.column,
515
558
  cyclomatic_complexity: finding.cyclomatic_complexity,
@@ -532,11 +575,37 @@ fn json_crap_finding(root: &Path, finding: &CrapFinding) -> JsonComplexityFindin
532
575
  }
533
576
  }
534
577
 
578
+ fn json_large_function(root: &Path, function: &LargeFunction) -> JsonLargeFunction {
579
+ let flutter_build = function.kind == crate::ComplexityFunctionKind::FlutterBuildMethod;
580
+ JsonLargeFunction {
581
+ rule_id: "dart-decimate/large-function".to_owned(),
582
+ path: display_path(root, &function.path),
583
+ symbol: function.symbol.clone(),
584
+ kind: function_kind(function.kind).to_owned(),
585
+ line: function.location.line,
586
+ column: function.location.column,
587
+ end_line: function.end_line,
588
+ line_count: function.line_count,
589
+ max_unit_size: function.max_unit_size,
590
+ threshold_source: function
591
+ .threshold_source
592
+ .map(threshold_source)
593
+ .map(str::to_owned),
594
+ threshold_reason: function.threshold_reason.clone(),
595
+ guidance: if flutter_build {
596
+ "Split the Flutter build method into focused widgets or helper owners".to_owned()
597
+ } else {
598
+ "Extract cohesive responsibilities into smaller functions or owning modules".to_owned()
599
+ },
600
+ }
601
+ }
602
+
535
603
  fn json_effective_thresholds(thresholds: &EffectiveThresholds) -> JsonEffectiveThresholds {
536
604
  JsonEffectiveThresholds {
537
605
  max_cyclomatic: thresholds.max_cyclomatic,
538
606
  max_cognitive: thresholds.max_cognitive,
539
607
  max_crap: thresholds.max_crap,
608
+ max_unit_size: thresholds.max_unit_size,
540
609
  }
541
610
  }
542
611
 
@@ -548,6 +617,7 @@ fn json_threshold_override(report: &HealthThresholdOverrideReport) -> JsonThresh
548
617
  max_cyclomatic: report.max_cyclomatic,
549
618
  max_cognitive: report.max_cognitive,
550
619
  max_crap: report.max_crap,
620
+ max_unit_size: report.max_unit_size,
551
621
  reason: report.reason.clone(),
552
622
  active: report.status == HealthThresholdOverrideStatus::Active,
553
623
  stale: report.status == HealthThresholdOverrideStatus::Stale,
@@ -562,6 +632,19 @@ const fn threshold_source(source: ThresholdSource) -> &'static str {
562
632
  }
563
633
  }
564
634
 
635
+ const fn function_kind(kind: ComplexityFunctionKind) -> &'static str {
636
+ match kind {
637
+ ComplexityFunctionKind::Function => "function",
638
+ ComplexityFunctionKind::Getter => "getter",
639
+ ComplexityFunctionKind::Setter => "setter",
640
+ ComplexityFunctionKind::Method => "method",
641
+ ComplexityFunctionKind::FlutterBuildMethod => "flutter-build-method",
642
+ ComplexityFunctionKind::Constructor => "constructor",
643
+ ComplexityFunctionKind::Operator => "operator",
644
+ ComplexityFunctionKind::Closure => "closure",
645
+ }
646
+ }
647
+
565
648
  fn json_file_score(root: &Path, score: &FileHealthScore) -> JsonFileHealthScore {
566
649
  JsonFileHealthScore {
567
650
  path: display_path(root, &score.path),
@@ -0,0 +1,121 @@
1
+ use std::collections::BTreeSet;
2
+
3
+ use super::flutter_style::json_flutter_style;
4
+ use super::health_findings::{json_complexity, json_large_functions, json_threshold_overrides};
5
+ use super::runtime_coverage::{JsonRuntimeCoverage, json_runtime_coverage};
6
+ use super::scope::{scope_complexity, scope_flutter_style, scope_large_functions, scope_semantic};
7
+ use super::{
8
+ AnalysisResults, JsonAttackSurfaceEntry, JsonCloneGroup, JsonComplexityFinding,
9
+ JsonFeatureFlag, JsonFileHealthScore, JsonFlutterStyleFinding, JsonHealthHotspot,
10
+ JsonLargeFunction, JsonRefactoringTarget, JsonSecurityBlindSpot, JsonSecurityCandidate,
11
+ JsonThresholdOverride, ReportSummary,
12
+ };
13
+ use crate::ScannedProject;
14
+
15
+ pub(super) fn health_and_semantic_inventories(
16
+ project: &ScannedProject,
17
+ results: &AnalysisResults,
18
+ scope: Option<&BTreeSet<String>>,
19
+ ) -> (
20
+ Vec<JsonComplexityFinding>,
21
+ Vec<JsonLargeFunction>,
22
+ Vec<JsonFlutterStyleFinding>,
23
+ Option<crate::SemanticReport>,
24
+ ) {
25
+ let (complexity, large_functions, flutter_style) = results.health.as_ref().map_or_else(
26
+ || (Vec::new(), Vec::new(), Vec::new()),
27
+ |report| {
28
+ (
29
+ scope_complexity(json_complexity(&project.root, report), scope),
30
+ scope_large_functions(json_large_functions(&project.root, report), scope),
31
+ scope_flutter_style(json_flutter_style(&project.root, report), scope),
32
+ )
33
+ },
34
+ );
35
+ let semantic = scope_semantic(
36
+ results
37
+ .symbols
38
+ .as_ref()
39
+ .map(|report| report.semantic.clone()),
40
+ scope,
41
+ );
42
+ (complexity, large_functions, flutter_style, semantic)
43
+ }
44
+
45
+ pub(super) fn apply_semantic_summary(
46
+ summary: &mut ReportSummary,
47
+ semantic: Option<&crate::SemanticReport>,
48
+ ) {
49
+ summary.semantic_evidence = semantic.map_or(0, |report| report.evidence.len());
50
+ summary.type_couplings = semantic.map_or(0, |report| report.type_couplings.len());
51
+ }
52
+
53
+ pub(super) fn apply_flutter_style_summary(
54
+ summary: &mut ReportSummary,
55
+ findings: &[JsonFlutterStyleFinding],
56
+ ) {
57
+ summary.raw_flutter_style_values = findings
58
+ .iter()
59
+ .filter(|finding| finding.kind == "raw-flutter-style-value")
60
+ .count();
61
+ summary.near_duplicate_theme_tokens = findings
62
+ .iter()
63
+ .filter(|finding| finding.kind == "near-duplicate-theme-token")
64
+ .count();
65
+ summary.unused_theme_extension_tokens = findings
66
+ .iter()
67
+ .filter(|finding| finding.kind == "unused-theme-extension-token")
68
+ .count();
69
+ }
70
+
71
+ pub(super) fn apply_health_inventory_summary(
72
+ summary: &mut ReportSummary,
73
+ clone_groups: &[JsonCloneGroup],
74
+ file_scores: &[JsonFileHealthScore],
75
+ hotspots: &[JsonHealthHotspot],
76
+ targets: &[JsonRefactoringTarget],
77
+ ) {
78
+ summary.code_duplications = clone_groups.len();
79
+ summary.file_scores = file_scores.len();
80
+ summary.hotspots = hotspots.len();
81
+ summary.refactoring_targets = targets.len();
82
+ }
83
+
84
+ pub(super) fn apply_aux_inventory_summary(
85
+ summary: &mut ReportSummary,
86
+ flags: &[JsonFeatureFlag],
87
+ security: &[JsonSecurityCandidate],
88
+ blind_spots: &[JsonSecurityBlindSpot],
89
+ attack_surface: &[JsonAttackSurfaceEntry],
90
+ ) {
91
+ summary.feature_flags = flags.len();
92
+ summary.feature_flag_occurrences = flags.iter().map(|flag| flag.occurrences.len()).sum();
93
+ summary.security_candidates = security.len();
94
+ summary.security_candidate_occurrences = security
95
+ .iter()
96
+ .map(|candidate| candidate.occurrences.len())
97
+ .sum();
98
+ summary.security_blind_spots = blind_spots.len();
99
+ summary.attack_surface = attack_surface.len();
100
+ }
101
+
102
+ pub(super) fn json_runtime_coverage_for(
103
+ project: &ScannedProject,
104
+ results: &AnalysisResults,
105
+ ) -> Option<JsonRuntimeCoverage> {
106
+ results.health.as_ref().and_then(|report| {
107
+ report
108
+ .runtime_coverage
109
+ .as_ref()
110
+ .map(|runtime| json_runtime_coverage(&project.root, runtime))
111
+ })
112
+ }
113
+
114
+ pub(super) fn json_threshold_overrides_for(
115
+ results: &AnalysisResults,
116
+ ) -> Vec<JsonThresholdOverride> {
117
+ results
118
+ .health
119
+ .as_ref()
120
+ .map_or_else(Vec::new, json_threshold_overrides)
121
+ }
@@ -49,12 +49,16 @@ fn renders_browser_ready_report_with_escaped_evidence() {
49
49
  }],
50
50
  clone_groups: Vec::new(),
51
51
  complexity: Vec::new(),
52
+ large_functions: Vec::new(),
53
+ flutter_style: Vec::new(),
54
+ semantic: None,
52
55
  file_scores: Vec::new(),
53
56
  hotspots: Vec::new(),
54
57
  refactoring_targets: Vec::new(),
55
58
  threshold_overrides: Vec::new(),
56
59
  feature_flags: Vec::new(),
57
60
  security_candidates: Vec::new(),
61
+ security_blind_spots: Vec::new(),
58
62
  attack_surface: Vec::new(),
59
63
  runtime_coverage: None,
60
64
  next_steps: Vec::new(),
@@ -109,12 +113,16 @@ fn groups_findings_by_type_with_search_and_type_controls() {
109
113
  ],
110
114
  clone_groups: Vec::new(),
111
115
  complexity: Vec::new(),
116
+ large_functions: Vec::new(),
117
+ flutter_style: Vec::new(),
118
+ semantic: None,
112
119
  file_scores: Vec::new(),
113
120
  hotspots: Vec::new(),
114
121
  refactoring_targets: Vec::new(),
115
122
  threshold_overrides: Vec::new(),
116
123
  feature_flags: Vec::new(),
117
124
  security_candidates: Vec::new(),
125
+ security_blind_spots: Vec::new(),
118
126
  attack_surface: Vec::new(),
119
127
  runtime_coverage: None,
120
128
  next_steps: Vec::new(),
@@ -193,12 +201,16 @@ fn group_headers_render_unique_rule_ids_only_when_concise() {
193
201
  ],
194
202
  clone_groups: Vec::new(),
195
203
  complexity: Vec::new(),
204
+ large_functions: Vec::new(),
205
+ flutter_style: Vec::new(),
206
+ semantic: None,
196
207
  file_scores: Vec::new(),
197
208
  hotspots: Vec::new(),
198
209
  refactoring_targets: Vec::new(),
199
210
  threshold_overrides: Vec::new(),
200
211
  feature_flags: Vec::new(),
201
212
  security_candidates: Vec::new(),
213
+ security_blind_spots: Vec::new(),
202
214
  attack_surface: Vec::new(),
203
215
  runtime_coverage: None,
204
216
  next_steps: Vec::new(),
@@ -333,12 +345,16 @@ fn escapes_control_characters_from_user_values() {
333
345
  }],
334
346
  clone_groups: Vec::new(),
335
347
  complexity: Vec::new(),
348
+ large_functions: Vec::new(),
349
+ flutter_style: Vec::new(),
350
+ semantic: None,
336
351
  file_scores: Vec::new(),
337
352
  hotspots: Vec::new(),
338
353
  refactoring_targets: Vec::new(),
339
354
  threshold_overrides: Vec::new(),
340
355
  feature_flags: Vec::new(),
341
356
  security_candidates: Vec::new(),
357
+ security_blind_spots: Vec::new(),
342
358
  attack_surface: Vec::new(),
343
359
  runtime_coverage: None,
344
360
  next_steps: vec![NextStep {
@@ -373,12 +389,16 @@ fn renders_omitted_details_for_summary_only_failures() {
373
389
  findings: Vec::new(),
374
390
  clone_groups: Vec::new(),
375
391
  complexity: Vec::new(),
392
+ large_functions: Vec::new(),
393
+ flutter_style: Vec::new(),
394
+ semantic: None,
376
395
  file_scores: Vec::new(),
377
396
  hotspots: Vec::new(),
378
397
  refactoring_targets: Vec::new(),
379
398
  threshold_overrides: Vec::new(),
380
399
  feature_flags: Vec::new(),
381
400
  security_candidates: Vec::new(),
401
+ security_blind_spots: Vec::new(),
382
402
  attack_surface: Vec::new(),
383
403
  runtime_coverage: None,
384
404
  next_steps: Vec::new(),
@@ -220,7 +220,16 @@ fn render_findings(html: &mut String, report: &JsonReport) {
220
220
  let _ = writeln!(html, "<section>");
221
221
  let _ = writeln!(html, "<h2>Findings</h2>");
222
222
  if report.findings.is_empty() {
223
- if report.summary.findings == 0 && report.verdict == Verdict::Pass {
223
+ if report.summary.findings == 0
224
+ && report.verdict == Verdict::Pass
225
+ && report.summary.security_blind_spots > 0
226
+ {
227
+ let _ = writeln!(
228
+ html,
229
+ "<article class=\"finding\"><p>No verified security candidates, but {} bounded blind spot(s) require review; this is not clean security proof.</p></article>",
230
+ report.summary.security_blind_spots
231
+ );
232
+ } else if report.summary.findings == 0 && report.verdict == Verdict::Pass {
224
233
  let _ = writeln!(
225
234
  html,
226
235
  "<article class=\"finding\"><p>No findings. The selected Dart graph checks passed.</p></article>"
@@ -82,9 +82,24 @@ fn render_human_report_with_style(report: &JsonReport, style: Style) -> String {
82
82
  let mut rendered = String::new();
83
83
  render_header(&mut rendered, report, style);
84
84
  render_issue_summary(&mut rendered, &report.summary, style);
85
+ render_semantic_evidence(&mut rendered, report, style);
86
+ render_large_functions(&mut rendered, report, style);
87
+ render_flutter_style(&mut rendered, report, style);
85
88
 
86
89
  if report.findings.is_empty() {
87
- if report.summary.findings == 0 && report.verdict == Verdict::Pass {
90
+ if report.summary.findings == 0
91
+ && report.verdict == Verdict::Pass
92
+ && report.summary.security_blind_spots > 0
93
+ {
94
+ let _ = writeln!(
95
+ rendered,
96
+ "\n{}",
97
+ style.cyan(&format!(
98
+ "No verified security candidates, but {} bounded blind spot(s) require review; this is not clean security proof.",
99
+ report.summary.security_blind_spots
100
+ ))
101
+ );
102
+ } else if report.summary.findings == 0 && report.verdict == Verdict::Pass {
88
103
  let _ = writeln!(
89
104
  rendered,
90
105
  "\n{}",
@@ -125,6 +140,71 @@ fn render_human_report_with_style(report: &JsonReport, style: Style) -> String {
125
140
  rendered
126
141
  }
127
142
 
143
+ fn render_semantic_evidence(rendered: &mut String, report: &JsonReport, style: Style) {
144
+ let Some(semantic) = report.semantic.as_ref() else {
145
+ return;
146
+ };
147
+ if semantic.candidate_count == 0 {
148
+ return;
149
+ }
150
+ let status = semantic.completeness.as_str();
151
+ let _ = writeln!(rendered, "\n{}", style.bold("Semantic Evidence"));
152
+ let _ = writeln!(
153
+ rendered,
154
+ " Status: {status} | Processed: {}/{} | Omitted: {} | Capacity: {}",
155
+ semantic.processed_candidates,
156
+ semantic.candidate_count,
157
+ semantic.omitted_candidates,
158
+ semantic.capacity
159
+ );
160
+ }
161
+
162
+ fn render_large_functions(rendered: &mut String, report: &JsonReport, style: Style) {
163
+ if report.large_functions.is_empty() {
164
+ return;
165
+ }
166
+
167
+ let _ = writeln!(rendered, "\n{}", style.bold("Large Functions (advisory)"));
168
+ for function in &report.large_functions {
169
+ let _ = writeln!(
170
+ rendered,
171
+ " {}:{} {} [{}] — {} lines (max {})",
172
+ terminal_text(&function.path),
173
+ function.line,
174
+ terminal_text(&function.symbol),
175
+ function.kind,
176
+ function.line_count,
177
+ function.max_unit_size
178
+ );
179
+ let _ = writeln!(
180
+ rendered,
181
+ " Guidance: {}",
182
+ terminal_text(&function.guidance)
183
+ );
184
+ }
185
+ }
186
+
187
+ fn render_flutter_style(rendered: &mut String, report: &JsonReport, style: Style) {
188
+ if report.flutter_style.is_empty() {
189
+ return;
190
+ }
191
+ let _ = writeln!(rendered, "\n{}", style.bold("Flutter Style (advisory)"));
192
+ for finding in &report.flutter_style {
193
+ let nearest = finding
194
+ .nearest_token
195
+ .as_ref()
196
+ .map_or("none", |token| token.name.as_str());
197
+ let _ = writeln!(
198
+ rendered,
199
+ " {}:{} {} — nearest token: {}",
200
+ terminal_text(&finding.path),
201
+ finding.line,
202
+ finding.kind,
203
+ terminal_text(nearest)
204
+ );
205
+ }
206
+ }
207
+
128
208
  fn render_header(rendered: &mut String, report: &JsonReport, style: Style) {
129
209
  let verdict = match report.verdict {
130
210
  Verdict::Pass => style.green("PASS"),
@@ -472,12 +552,16 @@ mod tests {
472
552
  findings: vec![finding],
473
553
  clone_groups: Vec::new(),
474
554
  complexity: Vec::new(),
555
+ large_functions: Vec::new(),
556
+ flutter_style: Vec::new(),
557
+ semantic: None,
475
558
  file_scores: Vec::new(),
476
559
  hotspots: Vec::new(),
477
560
  refactoring_targets: Vec::new(),
478
561
  threshold_overrides: Vec::new(),
479
562
  feature_flags: Vec::new(),
480
563
  security_candidates: Vec::new(),
564
+ security_blind_spots: Vec::new(),
481
565
  attack_surface: Vec::new(),
482
566
  runtime_coverage: None,
483
567
  next_steps: Vec::new(),
@@ -106,6 +106,12 @@ fn dependency_items(summary: &ReportSummary) -> Vec<String> {
106
106
  "unused dev dependency",
107
107
  "unused dev dependencies",
108
108
  );
109
+ push_count(
110
+ &mut items,
111
+ summary.dev_dependencies_in_production,
112
+ "dev dependency used in production",
113
+ "dev dependencies used in production",
114
+ );
109
115
  push_count(
110
116
  &mut items,
111
117
  summary.test_only_dependencies,
@@ -193,6 +199,24 @@ fn quality_items(summary: &ReportSummary) -> Vec<String> {
193
199
  "complex function",
194
200
  "complex functions",
195
201
  );
202
+ push_count(
203
+ &mut items,
204
+ summary.large_functions,
205
+ "large function",
206
+ "large functions",
207
+ );
208
+ push_count(
209
+ &mut items,
210
+ summary.semantic_evidence,
211
+ "semantic evidence row",
212
+ "semantic evidence rows",
213
+ );
214
+ push_count(
215
+ &mut items,
216
+ summary.type_couplings,
217
+ "type coupling",
218
+ "type couplings",
219
+ );
196
220
  push_count(
197
221
  &mut items,
198
222
  summary.coverage_gaps,
@@ -247,6 +271,24 @@ fn flutter_items(summary: &ReportSummary) -> Vec<String> {
247
271
  "missing context.mounted guard",
248
272
  "missing context.mounted guards",
249
273
  );
274
+ push_count(
275
+ &mut items,
276
+ summary.raw_flutter_style_values,
277
+ "raw Flutter style value",
278
+ "raw Flutter style values",
279
+ );
280
+ push_count(
281
+ &mut items,
282
+ summary.near_duplicate_theme_tokens,
283
+ "near-duplicate theme token",
284
+ "near-duplicate theme tokens",
285
+ );
286
+ push_count(
287
+ &mut items,
288
+ summary.unused_theme_extension_tokens,
289
+ "unused ThemeExtension token",
290
+ "unused ThemeExtension tokens",
291
+ );
250
292
  items
251
293
  }
252
294
 
@@ -258,6 +300,12 @@ fn security_items(summary: &ReportSummary) -> Vec<String> {
258
300
  "security candidate",
259
301
  "security candidates",
260
302
  );
303
+ push_count(
304
+ &mut items,
305
+ summary.security_blind_spots,
306
+ "security blind spot",
307
+ "security blind spots",
308
+ );
261
309
  push_count(
262
310
  &mut items,
263
311
  summary.feature_flags,
@@ -313,6 +361,7 @@ pub(super) const fn kind_label(kind: FindingKind) -> &'static str {
313
361
  FindingKind::PartOfViolation => "Part-of violation",
314
362
  FindingKind::UnusedDependency => "Unused dependency",
315
363
  FindingKind::UnusedDevDependency => "Unused dev dependency",
364
+ FindingKind::DevDependencyInProduction => "Dev dependency used in production",
316
365
  FindingKind::TestOnlyDependency => "Test-only production dependency",
317
366
  FindingKind::UnusedDependencyOverride => "Unused dependency override",
318
367
  FindingKind::MisconfiguredDependencyOverride => "Misconfigured dependency override",
@@ -326,6 +375,9 @@ pub(super) const fn kind_label(kind: FindingKind) -> &'static str {
326
375
  FindingKind::HighCrapScore => "High CRAP score",
327
376
  FindingKind::HealthHotspot => "Health hotspot",
328
377
  FindingKind::RefactoringTarget => "Refactoring target",
378
+ FindingKind::RawFlutterStyleValue => "Raw Flutter style value",
379
+ FindingKind::NearDuplicateThemeToken => "Near-duplicate theme token",
380
+ FindingKind::UnusedThemeExtensionToken => "Unused ThemeExtension token",
329
381
  FindingKind::FeatureFlag => "Feature flag",
330
382
  FindingKind::SecurityCandidate => "Security candidate",
331
383
  FindingKind::StaleSuppression => "Stale suppression",
@@ -334,6 +386,9 @@ pub(super) const fn kind_label(kind: FindingKind) -> &'static str {
334
386
  }
335
387
 
336
388
  pub(super) const fn why_text(kind: FindingKind) -> &'static str {
389
+ if let Some(text) = quality_why_text(kind) {
390
+ return text;
391
+ }
337
392
  match kind {
338
393
  FindingKind::CircularDependency => {
339
394
  "These files import or export each other in a loop. That couples builds, tests, ownership, and refactors across the whole component."
@@ -367,6 +422,7 @@ pub(super) const fn why_text(kind: FindingKind) -> &'static str {
367
422
  }
368
423
  FindingKind::UnusedDependency
369
424
  | FindingKind::UnusedDevDependency
425
+ | FindingKind::DevDependencyInProduction
370
426
  | FindingKind::TestOnlyDependency
371
427
  | FindingKind::UnusedDependencyOverride
372
428
  | FindingKind::MisconfiguredDependencyOverride
@@ -396,18 +452,14 @@ pub(super) const fn why_text(kind: FindingKind) -> &'static str {
396
452
  }
397
453
  FindingKind::HighCyclomaticComplexity
398
454
  | FindingKind::HighCognitiveComplexity
399
- | FindingKind::HighComplexity => {
400
- "The function has enough branch or nesting decisions to raise review and change risk."
401
- }
402
- FindingKind::CoverageGap => {
403
- "Runtime coverage data found no covered executable lines for this Dart file."
404
- }
405
- FindingKind::HighCrapScore => {
406
- "The function combines high branching complexity with low test coverage."
407
- }
408
- FindingKind::HealthHotspot | FindingKind::RefactoringTarget => {
409
- "Size, complexity, duplication, coupling, coverage, or ownership signals make this file expensive to change."
410
- }
455
+ | FindingKind::HighComplexity
456
+ | FindingKind::CoverageGap
457
+ | FindingKind::HighCrapScore
458
+ | FindingKind::HealthHotspot
459
+ | FindingKind::RefactoringTarget
460
+ | FindingKind::RawFlutterStyleValue
461
+ | FindingKind::NearDuplicateThemeToken
462
+ | FindingKind::UnusedThemeExtensionToken => unreachable!(),
411
463
  FindingKind::FeatureFlag => {
412
464
  "Feature flag usage is present and should be traceable before cleanup or rollout work."
413
465
  }
@@ -433,6 +485,35 @@ pub(super) const fn why_text(kind: FindingKind) -> &'static str {
433
485
  }
434
486
  }
435
487
 
488
+ const fn quality_why_text(kind: FindingKind) -> Option<&'static str> {
489
+ match kind {
490
+ FindingKind::HighCyclomaticComplexity
491
+ | FindingKind::HighCognitiveComplexity
492
+ | FindingKind::HighComplexity => Some(
493
+ "The function has enough branch or nesting decisions to raise review and change risk.",
494
+ ),
495
+ FindingKind::CoverageGap => {
496
+ Some("Runtime coverage data found no covered executable lines for this Dart file.")
497
+ }
498
+ FindingKind::HighCrapScore => {
499
+ Some("The function combines high branching complexity with low test coverage.")
500
+ }
501
+ FindingKind::HealthHotspot | FindingKind::RefactoringTarget => Some(
502
+ "Size, complexity, duplication, coupling, coverage, or ownership signals make this file expensive to change.",
503
+ ),
504
+ FindingKind::RawFlutterStyleValue => Some(
505
+ "A raw Flutter style value has a resolvable theme token that can preserve design-system consistency.",
506
+ ),
507
+ FindingKind::NearDuplicateThemeToken => Some(
508
+ "Two custom theme colors differ only slightly and may represent an accidental duplicate semantic role.",
509
+ ),
510
+ FindingKind::UnusedThemeExtensionToken => {
511
+ Some("No syntax-confirmed member access consumes this custom ThemeExtension field.")
512
+ }
513
+ _ => None,
514
+ }
515
+ }
516
+
436
517
  pub(super) fn best_text(finding: &Finding, action: &FindingAction) -> String {
437
518
  match finding.kind {
438
519
  FindingKind::CircularDependency => {