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
@@ -3,9 +3,10 @@ use std::collections::BTreeSet;
3
3
  use super::format;
4
4
  use super::{
5
5
  Finding, JsonAttackSurfaceEntry, JsonCloneGroup, JsonComplexityFinding, JsonFeatureFlag,
6
- JsonFileHealthScore, JsonHealthHotspot, JsonRefactoringTarget, JsonSecurityCandidate,
6
+ JsonFileHealthScore, JsonFlutterStyleFinding, JsonHealthHotspot, JsonLargeFunction,
7
+ JsonRefactoringTarget, JsonSecurityCandidate,
7
8
  };
8
- use crate::{HealthReport, scan::ScannedProject};
9
+ use crate::{HealthReport, SemanticOmissionReason, SemanticReport, scan::ScannedProject};
9
10
 
10
11
  pub(super) fn file_scope(
11
12
  project: &ScannedProject,
@@ -57,6 +58,55 @@ pub(super) fn scope_complexity(
57
58
  .collect()
58
59
  }
59
60
 
61
+ pub(super) fn scope_large_functions(
62
+ functions: Vec<JsonLargeFunction>,
63
+ scope: Option<&BTreeSet<String>>,
64
+ ) -> Vec<JsonLargeFunction> {
65
+ functions
66
+ .into_iter()
67
+ .filter(|function| scope.is_none_or(|scope| scope.contains(&function.path)))
68
+ .collect()
69
+ }
70
+
71
+ pub(super) fn scope_flutter_style(
72
+ findings: Vec<JsonFlutterStyleFinding>,
73
+ scope: Option<&BTreeSet<String>>,
74
+ ) -> Vec<JsonFlutterStyleFinding> {
75
+ findings
76
+ .into_iter()
77
+ .filter(|finding| scope.is_none_or(|scope| scope.contains(&finding.path)))
78
+ .collect()
79
+ }
80
+
81
+ pub(super) fn scope_semantic(
82
+ mut semantic: Option<SemanticReport>,
83
+ scope: Option<&BTreeSet<String>>,
84
+ ) -> Option<SemanticReport> {
85
+ let Some(scope) = scope else {
86
+ return semantic;
87
+ };
88
+ let report = semantic.as_mut()?;
89
+ report
90
+ .evidence
91
+ .retain(|evidence| scope.contains(&evidence.subject.path));
92
+ report
93
+ .type_couplings
94
+ .retain(|coupling| scope.contains(&coupling.source.path));
95
+ report.processed_candidates = report
96
+ .evidence
97
+ .len()
98
+ .saturating_add(report.type_couplings.len());
99
+ report.candidate_count = report
100
+ .processed_candidates
101
+ .saturating_add(report.omitted_candidates);
102
+ if report.omitted_candidates == 0 {
103
+ report
104
+ .reasons
105
+ .retain(|reason| *reason != SemanticOmissionReason::Capacity);
106
+ }
107
+ semantic
108
+ }
109
+
60
110
  pub(super) fn scope_file_scores(
61
111
  scores: Vec<JsonFileHealthScore>,
62
112
  scope: Option<&BTreeSet<String>>,
@@ -120,6 +170,16 @@ pub(super) fn scope_security_candidates(
120
170
  .collect()
121
171
  }
122
172
 
173
+ pub(super) fn scope_security_blind_spots(
174
+ blind_spots: Vec<super::JsonSecurityBlindSpot>,
175
+ scope: Option<&BTreeSet<String>>,
176
+ ) -> Vec<super::JsonSecurityBlindSpot> {
177
+ blind_spots
178
+ .into_iter()
179
+ .filter(|blind_spot| scope.is_none_or(|scope| scope.contains(&blind_spot.path)))
180
+ .collect()
181
+ }
182
+
123
183
  pub(super) fn scope_attack_surface(
124
184
  entries: Vec<JsonAttackSurfaceEntry>,
125
185
  scope: Option<&BTreeSet<String>>,
@@ -5,9 +5,11 @@ use serde::ser::{SerializeStruct, Serializer};
5
5
  use serde::{Deserialize, Serialize};
6
6
 
7
7
  use super::format::display_path;
8
+ use super::scope::{scope_attack_surface, scope_security_blind_spots, scope_security_candidates};
8
9
  use super::{Finding, FindingAction, FindingKind, Severity};
9
10
  use crate::{
10
- AttackSurfaceEntry, SecurityCandidate, SecurityCategory, SecurityConfidence, SecurityReport,
11
+ AttackSurfaceEntry, SecurityBlindSpot, SecurityBlindSpotReason, SecurityCandidate,
12
+ SecurityCategory, SecurityConfidence, SecurityDefaultSeverity, SecurityReport,
11
13
  SecurityTaintConfidence,
12
14
  };
13
15
 
@@ -63,7 +65,10 @@ impl Serialize for JsonSecurityCandidate {
63
65
  occurrences: &self.occurrences,
64
66
  },
65
67
  )?;
66
- state.serialize_field("trace", &trace_steps(self.category, &self.occurrences))?;
68
+ state.serialize_field(
69
+ "trace",
70
+ &trace_steps(&self.candidate.trace_role, &self.occurrences),
71
+ )?;
67
72
  state.end()
68
73
  }
69
74
  }
@@ -77,6 +82,12 @@ pub struct JsonSecurityCandidateDetails {
77
82
  pub sink: String,
78
83
  /// Trust or platform boundary involved.
79
84
  pub boundary: String,
85
+ /// Expected security impact if the candidate is confirmed.
86
+ pub effect: String,
87
+ /// Evidence contract used to create this candidate.
88
+ pub evidence_template: String,
89
+ /// Trace role from the embedded matcher catalogue.
90
+ pub trace_role: String,
80
91
  }
81
92
 
82
93
  /// One security candidate occurrence serialized in JSON reports.
@@ -117,7 +128,7 @@ struct JsonSecurityEvidence<'a> {
117
128
 
118
129
  #[derive(Serialize)]
119
130
  struct JsonSecurityTraceStep<'a> {
120
- role: &'static str,
131
+ role: &'a str,
121
132
  path: &'a str,
122
133
  line: usize,
123
134
  column: usize,
@@ -142,6 +153,52 @@ pub struct JsonAttackSurfaceEntry {
142
153
  pub verification_prompt: String,
143
154
  }
144
155
 
156
+ /// Bounded security-analysis blind spot serialized in JSON reports.
157
+ #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
158
+ pub struct JsonSecurityBlindSpot {
159
+ /// Candidate category whose verification was incomplete.
160
+ pub category: SecurityCategory,
161
+ /// Dart file path, root-relative where possible.
162
+ pub path: String,
163
+ /// 1-based line.
164
+ pub line: usize,
165
+ /// 0-based byte column.
166
+ pub column: usize,
167
+ /// Sink or context family.
168
+ pub sink: String,
169
+ /// Stable bounded omission reason.
170
+ pub reason: SecurityBlindSpotReason,
171
+ /// Redacted source-line evidence.
172
+ pub evidence: String,
173
+ }
174
+
175
+ pub(super) struct JsonSecurityInventories {
176
+ pub(super) candidates: Vec<JsonSecurityCandidate>,
177
+ pub(super) blind_spots: Vec<JsonSecurityBlindSpot>,
178
+ pub(super) attack_surface: Vec<JsonAttackSurfaceEntry>,
179
+ }
180
+
181
+ pub(super) fn json_security_inventories(
182
+ root: &Path,
183
+ report: Option<&SecurityReport>,
184
+ scope: Option<&BTreeSet<String>>,
185
+ ) -> JsonSecurityInventories {
186
+ JsonSecurityInventories {
187
+ candidates: scope_security_candidates(
188
+ report.map_or_else(Vec::new, |report| json_security_candidates(root, report)),
189
+ scope,
190
+ ),
191
+ blind_spots: scope_security_blind_spots(
192
+ report.map_or_else(Vec::new, |report| json_security_blind_spots(root, report)),
193
+ scope,
194
+ ),
195
+ attack_surface: scope_attack_surface(
196
+ report.map_or_else(Vec::new, |report| json_attack_surface(root, report)),
197
+ scope,
198
+ ),
199
+ }
200
+ }
201
+
145
202
  pub(super) fn add_security_findings(
146
203
  root: &Path,
147
204
  report: &SecurityReport,
@@ -192,15 +249,15 @@ pub(super) fn json_security_candidates(
192
249
  finding_id: fingerprint.clone(),
193
250
  fingerprint,
194
251
  category: candidate.category,
195
- cwe: cwe_ids(candidate.category)
196
- .iter()
197
- .map(|cwe| (*cwe).to_owned())
198
- .collect(),
199
- severity: security_severity(candidate.category),
252
+ cwe: candidate.cwe.clone(),
253
+ severity: security_severity(candidate.default_severity),
200
254
  candidate: JsonSecurityCandidateDetails {
201
- source: source_label(candidate.category).to_owned(),
255
+ source: candidate.source.clone(),
202
256
  sink: candidate.sink.clone(),
203
- boundary: boundary_label(candidate.category).to_owned(),
257
+ boundary: candidate.boundary.clone(),
258
+ effect: candidate.effect.clone(),
259
+ evidence_template: candidate.evidence_template.clone(),
260
+ trace_role: candidate.trace_role.clone(),
204
261
  },
205
262
  sink: candidate.sink.clone(),
206
263
  confidence: candidate.confidence,
@@ -211,6 +268,29 @@ pub(super) fn json_security_candidates(
211
268
  .collect()
212
269
  }
213
270
 
271
+ pub(super) fn json_security_blind_spots(
272
+ root: &Path,
273
+ report: &SecurityReport,
274
+ ) -> Vec<JsonSecurityBlindSpot> {
275
+ report
276
+ .blind_spots
277
+ .iter()
278
+ .map(|blind_spot| json_security_blind_spot(root, blind_spot))
279
+ .collect()
280
+ }
281
+
282
+ fn json_security_blind_spot(root: &Path, blind_spot: &SecurityBlindSpot) -> JsonSecurityBlindSpot {
283
+ JsonSecurityBlindSpot {
284
+ category: blind_spot.category,
285
+ path: display_path(root, &blind_spot.path),
286
+ line: blind_spot.location.line,
287
+ column: blind_spot.location.column,
288
+ sink: blind_spot.sink.clone(),
289
+ reason: blind_spot.reason,
290
+ evidence: blind_spot.evidence.clone(),
291
+ }
292
+ }
293
+
214
294
  fn candidate_reachability(
215
295
  occurrences: &[JsonSecurityOccurrence],
216
296
  ) -> Option<JsonSecurityReachability> {
@@ -261,7 +341,7 @@ fn security_finding(root: &Path, candidate: &SecurityCandidate) -> Finding {
261
341
  rule_id: candidate.rule_id.clone(),
262
342
  fingerprint: Some(security_fingerprint(candidate)),
263
343
  kind: FindingKind::SecurityCandidate,
264
- severity: security_severity(candidate.category),
344
+ severity: security_severity(candidate.default_severity),
265
345
  message: format!(
266
346
  "Security review candidate for {} via {}",
267
347
  category_name(candidate.category),
@@ -287,19 +367,6 @@ fn security_finding(root: &Path, candidate: &SecurityCandidate) -> Finding {
287
367
  }
288
368
  }
289
369
 
290
- const fn security_severity(category: SecurityCategory) -> Severity {
291
- match category {
292
- SecurityCategory::FirebaseApiKey => Severity::Warning,
293
- SecurityCategory::HardcodedSecret
294
- | SecurityCategory::InsecureTransport
295
- | SecurityCategory::TlsBypass
296
- | SecurityCategory::WebViewRisk
297
- | SecurityCategory::ProcessExecution
298
- | SecurityCategory::RawSql
299
- | SecurityCategory::PlainSecretStorage => Severity::Error,
300
- }
301
- }
302
-
303
370
  fn attack_surface_entry(root: &Path, entry: &AttackSurfaceEntry) -> JsonAttackSurfaceEntry {
304
371
  JsonAttackSurfaceEntry {
305
372
  category: entry.category,
@@ -326,14 +393,14 @@ fn security_fingerprint(candidate: &SecurityCandidate) -> String {
326
393
  format!("sec:{:08x}", hash & 0xffff_ffff)
327
394
  }
328
395
 
329
- fn trace_steps(
330
- category: SecurityCategory,
331
- occurrences: &[JsonSecurityOccurrence],
332
- ) -> Vec<JsonSecurityTraceStep<'_>> {
396
+ fn trace_steps<'a>(
397
+ role: &'a str,
398
+ occurrences: &'a [JsonSecurityOccurrence],
399
+ ) -> Vec<JsonSecurityTraceStep<'a>> {
333
400
  occurrences
334
401
  .iter()
335
402
  .map(|occurrence| JsonSecurityTraceStep {
336
- role: trace_role(category),
403
+ role,
337
404
  path: &occurrence.path,
338
405
  line: occurrence.line,
339
406
  column: occurrence.column,
@@ -343,53 +410,10 @@ fn trace_steps(
343
410
  .collect()
344
411
  }
345
412
 
346
- const fn cwe_ids(category: SecurityCategory) -> &'static [&'static str] {
347
- match category {
348
- SecurityCategory::HardcodedSecret => &["CWE-798"],
349
- SecurityCategory::FirebaseApiKey => &["CWE-200"],
350
- SecurityCategory::InsecureTransport => &["CWE-319"],
351
- SecurityCategory::TlsBypass => &["CWE-295"],
352
- SecurityCategory::WebViewRisk => &["CWE-749"],
353
- SecurityCategory::ProcessExecution => &["CWE-78"],
354
- SecurityCategory::RawSql => &["CWE-89"],
355
- SecurityCategory::PlainSecretStorage => &["CWE-922"],
356
- }
357
- }
358
-
359
- const fn source_label(category: SecurityCategory) -> &'static str {
360
- match category {
361
- SecurityCategory::HardcodedSecret => "source-code-literal",
362
- SecurityCategory::FirebaseApiKey => "firebase-options-api-key",
363
- SecurityCategory::InsecureTransport => "http-url-literal",
364
- SecurityCategory::TlsBypass => "tls-callback-or-context",
365
- SecurityCategory::WebViewRisk => "webview-configuration",
366
- SecurityCategory::ProcessExecution => "process-call-arguments",
367
- SecurityCategory::RawSql => "query-text",
368
- SecurityCategory::PlainSecretStorage => "secret-named-value",
369
- }
370
- }
371
-
372
- const fn boundary_label(category: SecurityCategory) -> &'static str {
373
- match category {
374
- SecurityCategory::HardcodedSecret => "source-control",
375
- SecurityCategory::FirebaseApiKey => "firebase-client-config",
376
- SecurityCategory::InsecureTransport => "network-transport",
377
- SecurityCategory::TlsBypass => "tls-validation",
378
- SecurityCategory::WebViewRisk => "embedded-webview",
379
- SecurityCategory::ProcessExecution => "operating-system-process",
380
- SecurityCategory::RawSql => "database",
381
- SecurityCategory::PlainSecretStorage => "local-storage",
382
- }
383
- }
384
-
385
- const fn trace_role(category: SecurityCategory) -> &'static str {
386
- match category {
387
- SecurityCategory::HardcodedSecret | SecurityCategory::FirebaseApiKey => "source",
388
- SecurityCategory::TlsBypass | SecurityCategory::WebViewRisk => "boundary",
389
- SecurityCategory::InsecureTransport
390
- | SecurityCategory::ProcessExecution
391
- | SecurityCategory::RawSql
392
- | SecurityCategory::PlainSecretStorage => "sink",
413
+ const fn security_severity(severity: SecurityDefaultSeverity) -> Severity {
414
+ match severity {
415
+ SecurityDefaultSeverity::Warning => Severity::Warning,
416
+ SecurityDefaultSeverity::Error => Severity::Error,
393
417
  }
394
418
  }
395
419
 
@@ -403,5 +427,6 @@ const fn category_name(category: SecurityCategory) -> &'static str {
403
427
  SecurityCategory::ProcessExecution => "process execution",
404
428
  SecurityCategory::RawSql => "raw SQL",
405
429
  SecurityCategory::PlainSecretStorage => "plain secret storage",
430
+ SecurityCategory::WeakRandomness => "weak randomness",
406
431
  }
407
432
  }
@@ -9,7 +9,7 @@ const SARIF_SCHEMA: &str = "https://json.schemastore.org/sarif-2.1.0.json";
9
9
 
10
10
  pub(crate) fn render_sarif_report(report: &JsonReport) -> Value {
11
11
  let findings = report.findings.iter().collect::<Vec<_>>();
12
- let reachability_by_fingerprint = security_reachability_by_fingerprint(report);
12
+ let security_by_fingerprint = security_context_by_fingerprint(report);
13
13
 
14
14
  json!({
15
15
  "version": SARIF_VERSION,
@@ -24,7 +24,7 @@ pub(crate) fn render_sarif_report(report: &JsonReport) -> Value {
24
24
  },
25
25
  "results": sarif_results_with_reachability(
26
26
  &findings,
27
- &reachability_by_fingerprint
27
+ &security_by_fingerprint
28
28
  ),
29
29
  "properties": {
30
30
  "schemaVersion": &report.schema_version,
@@ -37,15 +37,19 @@ pub(crate) fn render_sarif_report(report: &JsonReport) -> Value {
37
37
  })
38
38
  }
39
39
 
40
- fn security_reachability_by_fingerprint(report: &JsonReport) -> BTreeMap<String, Value> {
40
+ fn security_context_by_fingerprint(report: &JsonReport) -> BTreeMap<String, Value> {
41
41
  report
42
42
  .security_candidates
43
43
  .iter()
44
- .filter_map(|candidate| {
45
- candidate
46
- .reachability
47
- .as_ref()
48
- .map(|reachability| (candidate.fingerprint.clone(), json!(reachability)))
44
+ .map(|candidate| {
45
+ (
46
+ candidate.fingerprint.clone(),
47
+ json!({
48
+ "cwe": candidate.cwe,
49
+ "effect": candidate.candidate.effect,
50
+ "reachability": candidate.reachability,
51
+ }),
52
+ )
49
53
  })
50
54
  .collect()
51
55
  }
@@ -85,12 +89,12 @@ fn sarif_rules(findings: &[&Finding]) -> Vec<Value> {
85
89
 
86
90
  fn sarif_results_with_reachability(
87
91
  findings: &[&Finding],
88
- reachability_by_fingerprint: &BTreeMap<String, Value>,
92
+ security_by_fingerprint: &BTreeMap<String, Value>,
89
93
  ) -> Vec<Value> {
90
94
  findings
91
95
  .iter()
92
96
  .map(|finding| {
93
- let properties = result_properties(finding, reachability_by_fingerprint);
97
+ let properties = result_properties(finding, security_by_fingerprint);
94
98
  json!({
95
99
  "ruleId": &finding.rule_id,
96
100
  "level": sarif_level(finding.severity),
@@ -119,7 +123,7 @@ fn sarif_results_with_reachability(
119
123
 
120
124
  fn result_properties(
121
125
  finding: &Finding,
122
- reachability_by_fingerprint: &BTreeMap<String, Value>,
126
+ security_by_fingerprint: &BTreeMap<String, Value>,
123
127
  ) -> Value {
124
128
  let mut properties = Map::new();
125
129
  properties.insert("kind".to_owned(), json!(finding.kind));
@@ -128,8 +132,15 @@ fn result_properties(
128
132
  properties.insert("files".to_owned(), json!(&finding.files));
129
133
  properties.insert("actions".to_owned(), json!(&finding.actions));
130
134
  if let Some(fingerprint) = &finding.fingerprint {
131
- if let Some(reachability) = reachability_by_fingerprint.get(fingerprint) {
132
- properties.insert("securityReachability".to_owned(), reachability.clone());
135
+ if let Some(security) = security_by_fingerprint.get(fingerprint) {
136
+ properties.insert("cwe".to_owned(), security["cwe"].clone());
137
+ properties.insert("effect".to_owned(), security["effect"].clone());
138
+ if !security["reachability"].is_null() {
139
+ properties.insert(
140
+ "securityReachability".to_owned(),
141
+ security["reachability"].clone(),
142
+ );
143
+ }
133
144
  }
134
145
  }
135
146
  Value::Object(properties)
@@ -368,6 +368,7 @@ const fn kind_key(kind: FindingKind) -> &'static str {
368
368
  FindingKind::PartOfViolation => "part-of-violation",
369
369
  FindingKind::UnusedDependency => "unused-dependency",
370
370
  FindingKind::UnusedDevDependency => "unused-dev-dependency",
371
+ FindingKind::DevDependencyInProduction => "dev-dependency-in-production",
371
372
  FindingKind::TestOnlyDependency => "test-only-dependency",
372
373
  FindingKind::UnusedDependencyOverride => "unused-dependency-override",
373
374
  FindingKind::MisconfiguredDependencyOverride => "misconfigured-dependency-override",
@@ -381,6 +382,9 @@ const fn kind_key(kind: FindingKind) -> &'static str {
381
382
  FindingKind::HighCrapScore => "high-crap-score",
382
383
  FindingKind::HealthHotspot => "health-hotspot",
383
384
  FindingKind::RefactoringTarget => "refactoring-target",
385
+ FindingKind::RawFlutterStyleValue => "raw-flutter-style-value",
386
+ FindingKind::NearDuplicateThemeToken => "near-duplicate-theme-token",
387
+ FindingKind::UnusedThemeExtensionToken => "unused-theme-extension-token",
384
388
  FindingKind::FeatureFlag => "feature-flag",
385
389
  FindingKind::SecurityCandidate => "security-candidate",
386
390
  FindingKind::StaleSuppression => "stale-suppression",
@@ -1,9 +1,12 @@
1
1
  use serde::{Deserialize, Serialize};
2
2
 
3
+ use crate::SemanticReport;
4
+
3
5
  use super::{
4
6
  JsonAttackSurfaceEntry, JsonCloneGroup, JsonComplexityFinding, JsonFeatureFlag,
5
- JsonFileHealthScore, JsonHealthHotspot, JsonRefactoringTarget, JsonRuntimeCoverage,
6
- JsonSecurityCandidate, JsonThresholdOverride,
7
+ JsonFileHealthScore, JsonFlutterStyleFinding, JsonHealthHotspot, JsonLargeFunction,
8
+ JsonRefactoringTarget, JsonRuntimeCoverage, JsonSecurityBlindSpot, JsonSecurityCandidate,
9
+ JsonThresholdOverride,
7
10
  };
8
11
 
9
12
  /// Command that produced a report.
@@ -147,6 +150,13 @@ pub struct JsonReport {
147
150
  pub clone_groups: Vec<JsonCloneGroup>,
148
151
  /// Complexity findings, populated by `check` and `health`.
149
152
  pub complexity: Vec<JsonComplexityFinding>,
153
+ /// Advisory large functions, populated by `check` and `health`.
154
+ pub large_functions: Vec<JsonLargeFunction>,
155
+ /// Opt-in advisory Flutter style rows.
156
+ pub flutter_style: Vec<JsonFlutterStyleFinding>,
157
+ /// Conservative Rust-native symbol evidence, populated when symbol analysis runs.
158
+ #[serde(skip_serializing_if = "Option::is_none")]
159
+ pub semantic: Option<SemanticReport>,
150
160
  /// File health scores, populated by `health --file-scores`.
151
161
  pub file_scores: Vec<JsonFileHealthScore>,
152
162
  /// Health hotspots, populated by `health --hotspots`.
@@ -159,6 +169,8 @@ pub struct JsonReport {
159
169
  pub feature_flags: Vec<JsonFeatureFlag>,
160
170
  /// Security review candidates, populated by `security`.
161
171
  pub security_candidates: Vec<JsonSecurityCandidate>,
172
+ /// Bounded sink-shaped expressions the security analyzer could not verify.
173
+ pub security_blind_spots: Vec<JsonSecurityBlindSpot>,
162
174
  /// Attack-surface inventory, populated by `security --surface`.
163
175
  pub attack_surface: Vec<JsonAttackSurfaceEntry>,
164
176
  /// Runtime coverage intelligence, populated by `--runtime-coverage`.
@@ -190,6 +202,8 @@ pub struct ReportSummary {
190
202
  pub unused_dependencies: usize,
191
203
  /// Declared dev dependencies not imported by Dart files.
192
204
  pub unused_dev_dependencies: usize,
205
+ /// Declared dev dependencies imported from production-owned Dart code.
206
+ pub dev_dependencies_in_production: usize,
193
207
  /// Runtime dependencies imported only from dev/test files.
194
208
  pub test_only_dependencies: usize,
195
209
  /// Dependency override findings across all override hygiene classes.
@@ -251,6 +265,18 @@ pub struct ReportSummary {
251
265
  pub functions: usize,
252
266
  /// Functions exceeding complexity thresholds.
253
267
  pub complex_functions: usize,
268
+ /// Function-like declarations exceeding the effective unit-size threshold.
269
+ pub large_functions: usize,
270
+ /// Raw Flutter style values with resolvable theme tokens.
271
+ pub raw_flutter_style_values: usize,
272
+ /// Near-duplicate custom theme token pairs.
273
+ pub near_duplicate_theme_tokens: usize,
274
+ /// Unused custom `ThemeExtension` fields.
275
+ pub unused_theme_extension_tokens: usize,
276
+ /// Retained symbol candidates with semantic reconciliation evidence.
277
+ pub semantic_evidence: usize,
278
+ /// Resolved advisory public-signature type edges.
279
+ pub type_couplings: usize,
254
280
  /// Highest cyclomatic complexity.
255
281
  pub max_cyclomatic_complexity: usize,
256
282
  /// Highest cognitive complexity.
@@ -277,6 +303,8 @@ pub struct ReportSummary {
277
303
  pub security_candidates: usize,
278
304
  /// Total security candidate occurrences detected before `--top` truncation.
279
305
  pub security_candidate_occurrences: usize,
306
+ /// Bounded sink-shaped expressions the security analyzer could not verify.
307
+ pub security_blind_spots: usize,
280
308
  /// Attack-surface inventory entries.
281
309
  pub attack_surface: usize,
282
310
  /// Missing requested entry points.
@@ -391,6 +419,8 @@ pub enum FindingKind {
391
419
  UnusedDependency,
392
420
  /// Declared dev dependency has no Dart import/export usage.
393
421
  UnusedDevDependency,
422
+ /// Declared dev dependency is imported from production-owned Dart code.
423
+ DevDependencyInProduction,
394
424
  /// Runtime dependency is imported only from dev/test files.
395
425
  TestOnlyDependency,
396
426
  /// Dependency override is absent from the resolved lockfile package graph.
@@ -417,6 +447,12 @@ pub enum FindingKind {
417
447
  HealthHotspot,
418
448
  /// File is a prioritized refactoring target.
419
449
  RefactoringTarget,
450
+ /// Raw Flutter style value with a resolvable theme token.
451
+ RawFlutterStyleValue,
452
+ /// Near-duplicate custom theme token pair.
453
+ NearDuplicateThemeToken,
454
+ /// Custom `ThemeExtension` field with no observed member access.
455
+ UnusedThemeExtensionToken,
420
456
  /// Feature flag reference.
421
457
  FeatureFlag,
422
458
  /// Security review candidate.
@@ -0,0 +1,12 @@
1
+ use super::{Finding, Severity, Verdict};
2
+
3
+ pub(super) fn report_verdict(findings: &[Finding]) -> Verdict {
4
+ if findings
5
+ .iter()
6
+ .any(|finding| finding.severity == Severity::Error)
7
+ {
8
+ Verdict::Fail
9
+ } else {
10
+ Verdict::Pass
11
+ }
12
+ }