dart-decimate 0.0.29 → 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 +3 -2
  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
@@ -0,0 +1,72 @@
1
+ use super::IssueExplanation;
2
+
3
+ pub(super) const MISC_ISSUES: &[IssueExplanation] = &[
4
+ issue!(
5
+ "feature-flag",
6
+ "dart-decimate/feature-flag",
7
+ &["feature-flag", "feature-flags", "flags"],
8
+ "Feature flag",
9
+ "A Dart or Flutter feature flag pattern was detected.",
10
+ "Flag inventories help find stale rollout logic and risky config gates.",
11
+ "bool.fromEnvironment('NEW_FLOW') gates production behavior.",
12
+ "Review owner, rollout state, and dead-code traces before deleting flag branches.",
13
+ next_line_suppressions!("feature-flag"),
14
+ &["dart-decimate flags --format json"],
15
+ ),
16
+ issue!(
17
+ "security-candidate",
18
+ "dart-decimate/security-candidate",
19
+ &[
20
+ "security",
21
+ "security-candidate",
22
+ "security-candidates",
23
+ "security-sink",
24
+ "hardcoded-secret",
25
+ "firebase-api-key",
26
+ "insecure-transport",
27
+ "tls-bypass",
28
+ "webview-risk",
29
+ "process-execution",
30
+ "process-exec",
31
+ "raw-sql",
32
+ "plain-secret-storage",
33
+ "weak-randomness",
34
+ ],
35
+ "Security candidate",
36
+ "A deterministic local security review candidate was detected.",
37
+ "Dart Decimate surfaces candidates for agent verification; it does not prove exploitability.",
38
+ "HttpClient.badCertificateCallback or an http:// URL appears in reachable code.",
39
+ "Verify source, sink, reachability, and product intent before changing code.",
40
+ next_line_suppressions!("security-sink"),
41
+ &["dart-decimate security --format json --surface"],
42
+ ),
43
+ issue!(
44
+ "stale-suppression",
45
+ "dart-decimate/stale-suppression",
46
+ &[
47
+ "stale-suppression",
48
+ "stale-suppressions",
49
+ "unused-suppression",
50
+ "unused-suppressions"
51
+ ],
52
+ "Stale suppression",
53
+ "A Dart Decimate or Fallow inline suppression no longer suppresses any finding.",
54
+ "Stale suppressions hide historical context and can mask future findings accidentally.",
55
+ "// dart-decimate-ignore-next-line unused-export remains above live code with no finding.",
56
+ "Remove the unused suppression comment.",
57
+ &[],
58
+ &["dart-decimate check --format json"],
59
+ ),
60
+ issue!(
61
+ "missing-suppression-reason",
62
+ "dart-decimate/missing-suppression-reason",
63
+ &["missing-suppression-reason", "missing-suppression-reasons"],
64
+ "Missing suppression reason",
65
+ "A Dart Decimate or Fallow inline suppression is missing required justification text.",
66
+ "Reasoned suppressions make intentional exceptions reviewable and prevent silent cleanup drift.",
67
+ "// dart-decimate-ignore-next-line unused-export omits why the export is intentionally kept.",
68
+ "Add a short reason after `--`, `because`, or `reason:`.",
69
+ &[],
70
+ &["dart-decimate check --format json"],
71
+ ),
72
+ ];
package/src/explain.rs CHANGED
@@ -1,3 +1,5 @@
1
+ use flutter_style::STYLE_ISSUES;
2
+ use misc::MISC_ISSUES;
1
3
  use serde::{Deserialize, Serialize};
2
4
  pub const EXPLAIN_SCHEMA_VERSION: &str = "dart-decimate.explain.v1";
3
5
 
@@ -30,6 +32,8 @@ pub fn explain_issue(issue_type: &str) -> Result<ExplainReport, ExplainError> {
30
32
  let normalized = normalize_issue_type(issue_type);
31
33
  let Some(issue) = ISSUES
32
34
  .iter()
35
+ .chain(STYLE_ISSUES)
36
+ .chain(MISC_ISSUES)
33
37
  .copied()
34
38
  .find(|issue| issue.aliases.iter().any(|alias| *alias == normalized))
35
39
  else {
@@ -144,6 +148,9 @@ macro_rules! file_suppressions {
144
148
  };
145
149
  }
146
150
 
151
+ mod flutter_style;
152
+ mod misc;
153
+
147
154
  const ISSUES: &[IssueExplanation] = &[
148
155
  issue!(
149
156
  "unused-file",
@@ -467,6 +474,22 @@ const ISSUES: &[IssueExplanation] = &[
467
474
  &[],
468
475
  &["dart-decimate trace-dependency --format json --dependency <package>"],
469
476
  ),
477
+ issue!(
478
+ "dev-dependency-in-production",
479
+ "dart-decimate/dev-dependency-in-production",
480
+ &[
481
+ "dev-dependency-in-production",
482
+ "dev-dependencies-in-production",
483
+ "dev-deps-in-production"
484
+ ],
485
+ "Dev dependency used in production",
486
+ "A package declared under dev_dependencies is imported from the owning package's lib/ or bin/ code.",
487
+ "Consumers do not receive another package's dev dependencies, so published runtime code can fail to resolve the package.",
488
+ "lib/main.dart imports package:collection/... while collection is declared only under dev_dependencies.",
489
+ "Move the package declaration from dev_dependencies to dependencies.",
490
+ &[],
491
+ &["dart-decimate trace-dependency --format json --dependency <package>"],
492
+ ),
470
493
  issue!(
471
494
  "test-only-dependency",
472
495
  "dart-decimate/test-only-dependency",
@@ -635,71 +658,4 @@ const ISSUES: &[IssueExplanation] = &[
635
658
  &[],
636
659
  &["dart-decimate health --format json --targets"],
637
660
  ),
638
- issue!(
639
- "feature-flag",
640
- "dart-decimate/feature-flag",
641
- &["feature-flag", "feature-flags", "flags"],
642
- "Feature flag",
643
- "A Dart or Flutter feature flag pattern was detected.",
644
- "Flag inventories help find stale rollout logic and risky config gates.",
645
- "bool.fromEnvironment('NEW_FLOW') gates production behavior.",
646
- "Review owner, rollout state, and dead-code traces before deleting flag branches.",
647
- next_line_suppressions!("feature-flag"),
648
- &["dart-decimate flags --format json"],
649
- ),
650
- issue!(
651
- "security-candidate",
652
- "dart-decimate/security-candidate",
653
- &[
654
- "security",
655
- "security-candidate",
656
- "security-candidates",
657
- "security-sink",
658
- "hardcoded-secret",
659
- "firebase-api-key",
660
- "insecure-transport",
661
- "tls-bypass",
662
- "webview-risk",
663
- "process-execution",
664
- "process-exec",
665
- "raw-sql",
666
- "plain-secret-storage",
667
- ],
668
- "Security candidate",
669
- "A deterministic local security review candidate was detected.",
670
- "Dart Decimate surfaces candidates for agent verification; it does not prove exploitability.",
671
- "HttpClient.badCertificateCallback or an http:// URL appears in reachable code.",
672
- "Verify source, sink, reachability, and product intent before changing code.",
673
- next_line_suppressions!("security-sink"),
674
- &["dart-decimate security --format json --surface"],
675
- ),
676
- issue!(
677
- "stale-suppression",
678
- "dart-decimate/stale-suppression",
679
- &[
680
- "stale-suppression",
681
- "stale-suppressions",
682
- "unused-suppression",
683
- "unused-suppressions"
684
- ],
685
- "Stale suppression",
686
- "A Dart Decimate or Fallow inline suppression no longer suppresses any finding.",
687
- "Stale suppressions hide historical context and can mask future findings accidentally.",
688
- "// dart-decimate-ignore-next-line unused-export remains above live code with no finding.",
689
- "Remove the unused suppression comment.",
690
- &[],
691
- &["dart-decimate check --format json"],
692
- ),
693
- issue!(
694
- "missing-suppression-reason",
695
- "dart-decimate/missing-suppression-reason",
696
- &["missing-suppression-reason", "missing-suppression-reasons"],
697
- "Missing suppression reason",
698
- "A Dart Decimate or Fallow inline suppression is missing required justification text.",
699
- "Reasoned suppressions make intentional exceptions reviewable and prevent silent cleanup drift.",
700
- "// dart-decimate-ignore-next-line unused-export omits why the export is intentionally kept.",
701
- "Add a short reason after `--`, `because`, or `reason:`.",
702
- &[],
703
- &["dart-decimate check --format json"],
704
- ),
705
661
  ];