dart-decimate 0.0.1

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 (188) hide show
  1. package/Cargo.lock +572 -0
  2. package/Cargo.toml +41 -0
  3. package/LICENSE +21 -0
  4. package/README.md +617 -0
  5. package/assets/dart-decimate-banner.png +0 -0
  6. package/npm/bin/dart-decimate-mcp.js +48 -0
  7. package/npm/bin/dart-decimate.js +48 -0
  8. package/npm/scripts/postinstall.js +46 -0
  9. package/npm/scripts/test-npx-local.js +54 -0
  10. package/npm/scripts/test-npx-mcp-local.js +56 -0
  11. package/package.json +45 -0
  12. package/src/baseline.rs +643 -0
  13. package/src/bin/dart-decimate-mcp.rs +11 -0
  14. package/src/boundaries/tests.rs +60 -0
  15. package/src/boundaries.rs +317 -0
  16. package/src/changed_scope.rs +117 -0
  17. package/src/ci_template.rs +399 -0
  18. package/src/cli/analyze.rs +462 -0
  19. package/src/cli/analyzer_options.rs +82 -0
  20. package/src/cli/audit_run.rs +327 -0
  21. package/src/cli/boundary_args.rs +44 -0
  22. package/src/cli/ci_template_run.rs +196 -0
  23. package/src/cli/command_name.rs +20 -0
  24. package/src/cli/common_args.rs +167 -0
  25. package/src/cli/config_run.rs +78 -0
  26. package/src/cli/coverage_run.rs +393 -0
  27. package/src/cli/decision_surface_run.rs +99 -0
  28. package/src/cli/default_command.rs +69 -0
  29. package/src/cli/dupes_args.rs +150 -0
  30. package/src/cli/entry_points.rs +121 -0
  31. package/src/cli/error.rs +149 -0
  32. package/src/cli/error_output.rs +68 -0
  33. package/src/cli/explain_run.rs +72 -0
  34. package/src/cli/fix_run.rs +162 -0
  35. package/src/cli/flags_args.rs +23 -0
  36. package/src/cli/health_args.rs +200 -0
  37. package/src/cli/hooks_run.rs +191 -0
  38. package/src/cli/impact_run.rs +95 -0
  39. package/src/cli/init_run.rs +49 -0
  40. package/src/cli/inspect_args.rs +20 -0
  41. package/src/cli/inspect_run.rs +66 -0
  42. package/src/cli/issue_filter_args.rs +240 -0
  43. package/src/cli/list_run.rs +311 -0
  44. package/src/cli/mode_args.rs +72 -0
  45. package/src/cli/output_format.rs +62 -0
  46. package/src/cli/regression_args.rs +156 -0
  47. package/src/cli/request_args.rs +175 -0
  48. package/src/cli/schema_commands.rs +72 -0
  49. package/src/cli/scope_args.rs +174 -0
  50. package/src/cli/security_args.rs +175 -0
  51. package/src/cli/security_gate_run.rs +66 -0
  52. package/src/cli/security_summary_run.rs +43 -0
  53. package/src/cli/summary_args.rs +12 -0
  54. package/src/cli/tests.rs +516 -0
  55. package/src/cli/trace_args.rs +67 -0
  56. package/src/cli/trace_run.rs +131 -0
  57. package/src/cli/trace_tests.rs +235 -0
  58. package/src/cli/unsupported_run.rs +116 -0
  59. package/src/cli/watch_run.rs +153 -0
  60. package/src/cli.rs +603 -0
  61. package/src/config/boundary_config.rs +235 -0
  62. package/src/config/cache.rs +25 -0
  63. package/src/config/dependencies.rs +114 -0
  64. package/src/config/health.rs +237 -0
  65. package/src/config/jsonc.rs +66 -0
  66. package/src/config/policy.rs +91 -0
  67. package/src/config/rule_aliases.rs +487 -0
  68. package/src/config/rules.rs +339 -0
  69. package/src/config.rs +635 -0
  70. package/src/coverage.rs +469 -0
  71. package/src/dart_parser.rs +673 -0
  72. package/src/decision_surface.rs +405 -0
  73. package/src/dependencies/analyze.rs +218 -0
  74. package/src/dependencies/codegen.rs +118 -0
  75. package/src/dependencies/discovery.rs +60 -0
  76. package/src/dependencies/overrides.rs +76 -0
  77. package/src/dependencies/private_src_imports.rs +32 -0
  78. package/src/dependencies/pubspec_document.rs +86 -0
  79. package/src/dependencies/pubspec_entry.rs +96 -0
  80. package/src/dependencies/tests.rs +544 -0
  81. package/src/dependencies/usage.rs +33 -0
  82. package/src/dependencies.rs +553 -0
  83. package/src/dependency_scripts.rs +91 -0
  84. package/src/dupes/lex.rs +236 -0
  85. package/src/dupes/tests.rs +119 -0
  86. package/src/dupes.rs +625 -0
  87. package/src/explain.rs +692 -0
  88. package/src/extract/directives.rs +252 -0
  89. package/src/extract/error_tests.rs +25 -0
  90. package/src/extract/members.rs +210 -0
  91. package/src/extract/primary_constructors.rs +421 -0
  92. package/src/extract/references.rs +151 -0
  93. package/src/extract/routes.rs +691 -0
  94. package/src/extract/signatures.rs +266 -0
  95. package/src/extract/string_tests.rs +18 -0
  96. package/src/extract/strings.rs +107 -0
  97. package/src/extract/tests.rs +697 -0
  98. package/src/extract.rs +680 -0
  99. package/src/feature_flags/tests.rs +76 -0
  100. package/src/feature_flags.rs +453 -0
  101. package/src/finding_identity.rs +60 -0
  102. package/src/fix.rs +551 -0
  103. package/src/generated.rs +53 -0
  104. package/src/graph/augment_tests.rs +212 -0
  105. package/src/graph/conditionals.rs +74 -0
  106. package/src/graph/package_config_tests.rs +100 -0
  107. package/src/graph/parts.rs +248 -0
  108. package/src/graph/pubspec_tests.rs +119 -0
  109. package/src/graph/tests.rs +837 -0
  110. package/src/graph/uri_tests.rs +102 -0
  111. package/src/graph.rs +644 -0
  112. package/src/health/coverage.rs +309 -0
  113. package/src/health/ownership.rs +175 -0
  114. package/src/health/runtime_coverage.rs +616 -0
  115. package/src/health/runtime_intelligence.rs +511 -0
  116. package/src/health/scores.rs +296 -0
  117. package/src/health/tests.rs +240 -0
  118. package/src/health/threshold_types.rs +163 -0
  119. package/src/health/thresholds.rs +229 -0
  120. package/src/health/types.rs +636 -0
  121. package/src/health.rs +597 -0
  122. package/src/hooks/agent_settings.rs +175 -0
  123. package/src/hooks/templates.rs +51 -0
  124. package/src/hooks.rs +569 -0
  125. package/src/impact.rs +287 -0
  126. package/src/init.rs +237 -0
  127. package/src/inspect.rs +142 -0
  128. package/src/intelligence/tests.rs +232 -0
  129. package/src/intelligence.rs +305 -0
  130. package/src/lib.rs +198 -0
  131. package/src/main.rs +5 -0
  132. package/src/manifest/mcp.rs +565 -0
  133. package/src/manifest.rs +552 -0
  134. package/src/mcp/cli_args/value_args.rs +175 -0
  135. package/src/mcp/cli_args.rs +658 -0
  136. package/src/mcp/cli_args_tests.rs +522 -0
  137. package/src/mcp/code_execute.rs +671 -0
  138. package/src/mcp/tools.rs +660 -0
  139. package/src/mcp.rs +325 -0
  140. package/src/output/audit_risk.rs +135 -0
  141. package/src/output/dependency_findings.rs +327 -0
  142. package/src/output/duplication_findings.rs +114 -0
  143. package/src/output/feature_flag_findings.rs +122 -0
  144. package/src/output/format.rs +31 -0
  145. package/src/output/graph_findings.rs +461 -0
  146. package/src/output/health_findings.rs +612 -0
  147. package/src/output/human.rs +27 -0
  148. package/src/output/next_steps.rs +92 -0
  149. package/src/output/route_findings.rs +76 -0
  150. package/src/output/runtime_coverage.rs +515 -0
  151. package/src/output/scope.rs +183 -0
  152. package/src/output/security_findings.rs +390 -0
  153. package/src/output/security_sarif.rs +150 -0
  154. package/src/output/suppressions.rs +323 -0
  155. package/src/output/symbol_findings.rs +257 -0
  156. package/src/output/tests.rs +114 -0
  157. package/src/output/types.rs +604 -0
  158. package/src/output/widget_findings.rs +213 -0
  159. package/src/output.rs +682 -0
  160. package/src/package_map.rs +495 -0
  161. package/src/policy/packs.rs +232 -0
  162. package/src/policy/tests.rs +134 -0
  163. package/src/policy.rs +640 -0
  164. package/src/project_list.rs +376 -0
  165. package/src/report_schema/inventory.rs +418 -0
  166. package/src/report_schema.rs +488 -0
  167. package/src/routes.rs +354 -0
  168. package/src/scan/tests.rs +250 -0
  169. package/src/scan.rs +275 -0
  170. package/src/security/detect.rs +639 -0
  171. package/src/security/tests.rs +178 -0
  172. package/src/security.rs +373 -0
  173. package/src/security_gate.rs +555 -0
  174. package/src/symbols/path_filters.rs +27 -0
  175. package/src/symbols/private_type_leaks.rs +125 -0
  176. package/src/symbols/riverpod.rs +113 -0
  177. package/src/symbols/tests.rs +692 -0
  178. package/src/symbols.rs +693 -0
  179. package/src/trace/tests.rs +225 -0
  180. package/src/trace.rs +690 -0
  181. package/src/unsupported.rs +47 -0
  182. package/src/widgets/lifecycle.rs +484 -0
  183. package/src/widgets/params.rs +236 -0
  184. package/src/widgets/tests.rs +430 -0
  185. package/src/widgets/top_level.rs +110 -0
  186. package/src/widgets/unrendered.rs +374 -0
  187. package/src/widgets.rs +590 -0
  188. package/src/workspace_scope.rs +358 -0
@@ -0,0 +1,91 @@
1
+ use std::path::PathBuf;
2
+
3
+ use serde::Deserialize;
4
+ use serde_json::{Value, json};
5
+
6
+ use crate::BoundaryCallRule;
7
+
8
+ use super::ConfigError;
9
+
10
+ pub(crate) fn rule_packs_schema() -> Value {
11
+ json!({
12
+ "type": "array",
13
+ "items": { "type": "string" }
14
+ })
15
+ }
16
+
17
+ pub(crate) fn boundary_calls_schema() -> Value {
18
+ json!({
19
+ "type": "array",
20
+ "items": {
21
+ "oneOf": [
22
+ { "type": "string", "description": "FROM:PATTERN" },
23
+ {
24
+ "type": "object",
25
+ "additionalProperties": false,
26
+ "required": ["from"],
27
+ "properties": {
28
+ "from": { "type": "string" },
29
+ "pattern": { "type": "string" },
30
+ "forbidden": {
31
+ "type": "array",
32
+ "items": { "type": "string" }
33
+ }
34
+ }
35
+ }
36
+ ]
37
+ }
38
+ })
39
+ }
40
+
41
+ #[derive(Debug, Clone, Deserialize)]
42
+ #[serde(untagged)]
43
+ pub(crate) enum RawBoundaryCall {
44
+ String(String),
45
+ Object(RawBoundaryCallObject),
46
+ }
47
+
48
+ #[derive(Debug, Clone, Default, Deserialize)]
49
+ #[serde(default, deny_unknown_fields)]
50
+ pub(crate) struct RawBoundaryCallObject {
51
+ from: PathBuf,
52
+ pattern: Option<String>,
53
+ forbidden: Vec<String>,
54
+ }
55
+
56
+ pub(crate) fn parse_boundary_call(raw: RawBoundaryCall) -> Result<BoundaryCallRule, ConfigError> {
57
+ match raw {
58
+ RawBoundaryCall::String(value) => parse_boundary_call_string(&value),
59
+ RawBoundaryCall::Object(object) => {
60
+ if object.from.as_os_str().is_empty() {
61
+ return Err(ConfigError::BoundaryCallRule {
62
+ value: format!("{object:?}"),
63
+ });
64
+ }
65
+ let value = format!("{object:?}");
66
+ let mut forbidden = object.forbidden;
67
+ if let Some(pattern) = object.pattern {
68
+ forbidden.push(pattern);
69
+ }
70
+ forbidden.retain(|pattern| !pattern.trim().is_empty());
71
+ if forbidden.is_empty() {
72
+ return Err(ConfigError::BoundaryCallRule { value });
73
+ }
74
+ Ok(BoundaryCallRule::new(object.from, forbidden))
75
+ }
76
+ }
77
+ }
78
+
79
+ fn parse_boundary_call_string(value: &str) -> Result<BoundaryCallRule, ConfigError> {
80
+ let Some((from, pattern)) = value.split_once(':') else {
81
+ return Err(ConfigError::BoundaryCallRule {
82
+ value: value.to_owned(),
83
+ });
84
+ };
85
+ if from.is_empty() || pattern.is_empty() {
86
+ return Err(ConfigError::BoundaryCallRule {
87
+ value: value.to_owned(),
88
+ });
89
+ }
90
+ Ok(BoundaryCallRule::new(from, vec![pattern.to_owned()]))
91
+ }
@@ -0,0 +1,487 @@
1
+ use crate::output::FindingKind;
2
+
3
+ pub(super) fn known_rule(rule: &str) -> bool {
4
+ rule == "all"
5
+ || rule.starts_with("dart-decimate/policy/")
6
+ || all_security_aliases()
7
+ .into_iter()
8
+ .chain(all_dependency_aliases())
9
+ .chain(all_known_aliases())
10
+ .any(|alias| alias == rule)
11
+ }
12
+
13
+ pub(super) fn aliases(rule_id: &str, kind: FindingKind) -> Vec<&'static str> {
14
+ let suffix = rule_id.rsplit('/').next().unwrap_or(rule_id);
15
+ let mut aliases = match suffix {
16
+ "security-hardcoded-secret" => vec![
17
+ "dart-decimate/security-hardcoded-secret",
18
+ "security-hardcoded-secret",
19
+ "hardcoded-secret",
20
+ ],
21
+ "security-insecure-transport" => vec![
22
+ "dart-decimate/security-insecure-transport",
23
+ "security-insecure-transport",
24
+ "insecure-transport",
25
+ ],
26
+ "security-tls-bypass" => vec![
27
+ "dart-decimate/security-tls-bypass",
28
+ "security-tls-bypass",
29
+ "tls-bypass",
30
+ ],
31
+ "security-webview-risk" => vec![
32
+ "dart-decimate/security-webview-risk",
33
+ "security-webview-risk",
34
+ "webview-risk",
35
+ ],
36
+ "security-process-execution" => vec![
37
+ "dart-decimate/security-process-execution",
38
+ "dart-decimate/security-process-exec",
39
+ "security-process-execution",
40
+ "process-execution",
41
+ "process-exec",
42
+ ],
43
+ "security-raw-sql" => vec![
44
+ "dart-decimate/security-raw-sql",
45
+ "security-raw-sql",
46
+ "raw-sql",
47
+ ],
48
+ "security-plain-secret-storage" => vec![
49
+ "dart-decimate/security-plain-secret-storage",
50
+ "security-plain-secret-storage",
51
+ "plain-secret-storage",
52
+ ],
53
+ "unused-dev-dependency" => vec![
54
+ "dart-decimate/unused-dev-dependency",
55
+ "unused-dev-dependency",
56
+ "unused-dev-dependencies",
57
+ "unused-dev-deps",
58
+ ],
59
+ "test-only-dependency" => vec![
60
+ "dart-decimate/test-only-dependency",
61
+ "test-only-dependency",
62
+ "test-only-dependencies",
63
+ "test-only-deps",
64
+ ],
65
+ "unused-dependency-override" => unused_dependency_override_aliases().into(),
66
+ "misconfigured-dependency-override" => misconfigured_dependency_override_aliases().into(),
67
+ _ => Vec::new(),
68
+ };
69
+ aliases.extend(kind_aliases(kind));
70
+ aliases.push("all");
71
+ aliases
72
+ }
73
+
74
+ pub(super) fn missing_suppression_reason_aliases() -> [&'static str; 3] {
75
+ [
76
+ "dart-decimate/missing-suppression-reason",
77
+ "missing-suppression-reason",
78
+ "missing-suppression-reasons",
79
+ ]
80
+ }
81
+
82
+ pub(super) fn private_type_leak_aliases() -> [&'static str; 3] {
83
+ [
84
+ "dart-decimate/private-type-leak",
85
+ "private-type-leak",
86
+ "private-type-leaks",
87
+ ]
88
+ }
89
+
90
+ fn all_security_aliases() -> Vec<&'static str> {
91
+ [
92
+ "dart-decimate/security-hardcoded-secret",
93
+ "security-hardcoded-secret",
94
+ "hardcoded-secret",
95
+ "dart-decimate/security-insecure-transport",
96
+ "security-insecure-transport",
97
+ "insecure-transport",
98
+ "dart-decimate/security-tls-bypass",
99
+ "security-tls-bypass",
100
+ "tls-bypass",
101
+ "dart-decimate/security-webview-risk",
102
+ "security-webview-risk",
103
+ "webview-risk",
104
+ "dart-decimate/security-process-execution",
105
+ "dart-decimate/security-process-exec",
106
+ "security-process-execution",
107
+ "process-execution",
108
+ "process-exec",
109
+ "dart-decimate/security-raw-sql",
110
+ "security-raw-sql",
111
+ "raw-sql",
112
+ "dart-decimate/security-plain-secret-storage",
113
+ "security-plain-secret-storage",
114
+ "plain-secret-storage",
115
+ ]
116
+ .into()
117
+ }
118
+
119
+ fn all_dependency_aliases() -> Vec<&'static str> {
120
+ [
121
+ "dart-decimate/unused-dev-dependency",
122
+ "unused-dev-dependency",
123
+ "unused-dev-dependencies",
124
+ "unused-dev-deps",
125
+ "dart-decimate/test-only-dependency",
126
+ "test-only-dependency",
127
+ "test-only-dependencies",
128
+ "test-only-deps",
129
+ "dart-decimate/unused-dependency-override",
130
+ "unused-dependency-override",
131
+ "unused-dependency-overrides",
132
+ "dart-decimate/misconfigured-dependency-override",
133
+ "misconfigured-dependency-override",
134
+ "misconfigured-dependency-overrides",
135
+ "dart-decimate/private-src-import",
136
+ "private-src-import",
137
+ "private-src-imports",
138
+ ]
139
+ .into()
140
+ }
141
+
142
+ fn all_known_aliases() -> Vec<&'static str> {
143
+ [
144
+ FindingKind::DeadFile,
145
+ FindingKind::UnusedExport,
146
+ FindingKind::UnusedType,
147
+ FindingKind::PrivateTypeLeak,
148
+ FindingKind::UnusedEnumMember,
149
+ FindingKind::UnusedClassMember,
150
+ FindingKind::DuplicateExport,
151
+ FindingKind::RouteCollision,
152
+ FindingKind::PrivateWidgetClass,
153
+ FindingKind::WidgetTopLevelFunctionBoundary,
154
+ FindingKind::UnusedWidgetParam,
155
+ FindingKind::UnrenderedWidget,
156
+ FindingKind::MissingContextMountedAfterAwait,
157
+ FindingKind::MissingEntryPoint,
158
+ FindingKind::CircularDependency,
159
+ FindingKind::ReExportCycle,
160
+ FindingKind::BoundaryViolation,
161
+ FindingKind::BoundaryCoverage,
162
+ FindingKind::BoundaryCallViolation,
163
+ FindingKind::PolicyViolation,
164
+ FindingKind::UnresolvedDependency,
165
+ FindingKind::PartOfViolation,
166
+ FindingKind::UnusedDependency,
167
+ FindingKind::UnusedDevDependency,
168
+ FindingKind::TestOnlyDependency,
169
+ FindingKind::UnusedDependencyOverride,
170
+ FindingKind::MisconfiguredDependencyOverride,
171
+ FindingKind::UnlistedDependency,
172
+ FindingKind::CodeDuplication,
173
+ FindingKind::HighCyclomaticComplexity,
174
+ FindingKind::HighCognitiveComplexity,
175
+ FindingKind::HighComplexity,
176
+ FindingKind::CoverageGap,
177
+ FindingKind::HighCrapScore,
178
+ FindingKind::HealthHotspot,
179
+ FindingKind::RefactoringTarget,
180
+ FindingKind::FeatureFlag,
181
+ FindingKind::SecurityCandidate,
182
+ FindingKind::StaleSuppression,
183
+ FindingKind::MissingSuppressionReason,
184
+ ]
185
+ .into_iter()
186
+ .flat_map(|kind| kind_aliases(kind).into_iter())
187
+ .collect()
188
+ }
189
+
190
+ fn kind_aliases(kind: FindingKind) -> Vec<&'static str> {
191
+ cleanup_kind_aliases(kind)
192
+ .or_else(|| widget_kind_aliases(kind))
193
+ .or_else(|| graph_kind_aliases(kind))
194
+ .or_else(|| dependency_kind_aliases(kind))
195
+ .or_else(|| quality_kind_aliases(kind))
196
+ .unwrap_or_default()
197
+ }
198
+
199
+ fn cleanup_kind_aliases(kind: FindingKind) -> Option<Vec<&'static str>> {
200
+ match kind {
201
+ FindingKind::DeadFile => Some(vec![
202
+ "dart-decimate/dead-file",
203
+ "dead-file",
204
+ "dead-files",
205
+ "unused-file",
206
+ "unused-files",
207
+ ]),
208
+ FindingKind::UnusedExport => Some(vec![
209
+ "dart-decimate/unused-export",
210
+ "unused-export",
211
+ "unused-exports",
212
+ ]),
213
+ FindingKind::UnusedType => Some(vec![
214
+ "dart-decimate/unused-type",
215
+ "unused-type",
216
+ "unused-types",
217
+ ]),
218
+ FindingKind::PrivateTypeLeak => Some(private_type_leak_aliases().into()),
219
+ FindingKind::UnusedEnumMember => Some(vec![
220
+ "dart-decimate/unused-enum-member",
221
+ "unused-enum-member",
222
+ "unused-enum-members",
223
+ ]),
224
+ FindingKind::UnusedClassMember => Some(vec![
225
+ "dart-decimate/unused-class-member",
226
+ "unused-class-member",
227
+ "unused-class-members",
228
+ ]),
229
+ FindingKind::DuplicateExport => Some(vec![
230
+ "dart-decimate/duplicate-export",
231
+ "duplicate-export",
232
+ "duplicate-exports",
233
+ ]),
234
+ FindingKind::StaleSuppression => Some(vec![
235
+ "dart-decimate/stale-suppression",
236
+ "stale-suppression",
237
+ "stale-suppressions",
238
+ "unused-suppression",
239
+ "unused-suppressions",
240
+ ]),
241
+ FindingKind::MissingSuppressionReason => Some(missing_suppression_reason_aliases().into()),
242
+ _ => None,
243
+ }
244
+ }
245
+
246
+ fn widget_kind_aliases(kind: FindingKind) -> Option<Vec<&'static str>> {
247
+ match kind {
248
+ FindingKind::PrivateWidgetClass => Some(vec![
249
+ "dart-decimate/private-widget-class",
250
+ "private-widget-class",
251
+ "private-widget-classes",
252
+ "flutter-private-widget-class",
253
+ "flutter-private-widget-classes",
254
+ ]),
255
+ FindingKind::WidgetTopLevelFunctionBoundary => Some(vec![
256
+ "dart-decimate/widget-top-level-function-boundary",
257
+ "widget-top-level-function-boundary",
258
+ "top-level-widget-helper",
259
+ "top-level-widget-helpers",
260
+ "flutter-widget-helper-function",
261
+ ]),
262
+ FindingKind::UnusedWidgetParam => Some(vec![
263
+ "dart-decimate/unused-widget-param",
264
+ "unused-widget-param",
265
+ "unused-widget-params",
266
+ "unused-component-prop",
267
+ "unused-component-props",
268
+ "flutter-unused-widget-param",
269
+ "flutter-unused-widget-params",
270
+ ]),
271
+ FindingKind::UnrenderedWidget => Some(vec![
272
+ "dart-decimate/unrendered-widget",
273
+ "unrendered-widget",
274
+ "unrendered-widgets",
275
+ "unused-widget-class",
276
+ "unused-widget-classes",
277
+ "unused-component",
278
+ "unused-components",
279
+ ]),
280
+ FindingKind::MissingContextMountedAfterAwait => Some(vec![
281
+ "dart-decimate/missing-context-mounted-after-await",
282
+ "missing-context-mounted-after-await",
283
+ "context-mounted-after-await",
284
+ "flutter-context-mounted",
285
+ "use-build-context-synchronously",
286
+ ]),
287
+ _ => None,
288
+ }
289
+ }
290
+
291
+ fn graph_kind_aliases(kind: FindingKind) -> Option<Vec<&'static str>> {
292
+ match kind {
293
+ FindingKind::MissingEntryPoint => Some(vec![
294
+ "dart-decimate/missing-entry-point",
295
+ "missing-entry-point",
296
+ "missing-entry-points",
297
+ ]),
298
+ FindingKind::CircularDependency => Some(vec![
299
+ "dart-decimate/circular-dependency",
300
+ "circular-dependency",
301
+ "circular-dependencies",
302
+ "circular-deps",
303
+ ]),
304
+ FindingKind::ReExportCycle => Some(vec![
305
+ "dart-decimate/re-export-cycle",
306
+ "re-export-cycle",
307
+ "re-export-cycles",
308
+ ]),
309
+ FindingKind::RouteCollision => Some(vec![
310
+ "dart-decimate/route-collision",
311
+ "route-collision",
312
+ "route-collisions",
313
+ "flutter-route-collision",
314
+ "flutter-route-collisions",
315
+ ]),
316
+ FindingKind::BoundaryViolation => Some(vec![
317
+ "dart-decimate/boundary-violation",
318
+ "boundary-violation",
319
+ "boundary-violations",
320
+ ]),
321
+ FindingKind::BoundaryCoverage => Some(vec![
322
+ "dart-decimate/boundary-coverage",
323
+ "boundary-coverage",
324
+ "boundary-coverages",
325
+ "dart-decimate/boundary-violation",
326
+ "boundary-violation",
327
+ "boundary-violations",
328
+ ]),
329
+ FindingKind::BoundaryCallViolation => Some(vec![
330
+ "dart-decimate/boundary-call-violation",
331
+ "boundary-call-violation",
332
+ "boundary-call-violations",
333
+ "dart-decimate/boundary-violation",
334
+ "boundary-violation",
335
+ "boundary-violations",
336
+ ]),
337
+ FindingKind::PolicyViolation => Some(vec![
338
+ "dart-decimate/policy-violation",
339
+ "policy-violation",
340
+ "policy-violations",
341
+ ]),
342
+ FindingKind::UnresolvedDependency => Some(vec![
343
+ "dart-decimate/unresolved-dependency",
344
+ "unresolved-dependency",
345
+ "unresolved-import",
346
+ "unresolved-imports",
347
+ "unresolved-augment",
348
+ "unresolved-augments",
349
+ ]),
350
+ FindingKind::PartOfViolation => Some(vec![
351
+ "dart-decimate/part-of-violation",
352
+ "part-of-violation",
353
+ "part-of-violations",
354
+ "invalid-part-of",
355
+ "invalid-part",
356
+ ]),
357
+ _ => None,
358
+ }
359
+ }
360
+
361
+ fn dependency_kind_aliases(kind: FindingKind) -> Option<Vec<&'static str>> {
362
+ match kind {
363
+ FindingKind::UnusedDependency => Some(vec![
364
+ "dart-decimate/unused-dependency",
365
+ "unused-dependency",
366
+ "unused-dependencies",
367
+ "unused-deps",
368
+ ]),
369
+ FindingKind::UnusedDevDependency => Some(vec![
370
+ "dart-decimate/unused-dev-dependency",
371
+ "unused-dev-dependency",
372
+ "unused-dev-dependencies",
373
+ "unused-dev-deps",
374
+ ]),
375
+ FindingKind::TestOnlyDependency => Some(vec![
376
+ "dart-decimate/test-only-dependency",
377
+ "test-only-dependency",
378
+ "test-only-dependencies",
379
+ "test-only-deps",
380
+ ]),
381
+ FindingKind::UnusedDependencyOverride => Some(unused_dependency_override_aliases().into()),
382
+ FindingKind::MisconfiguredDependencyOverride => {
383
+ Some(misconfigured_dependency_override_aliases().into())
384
+ }
385
+ FindingKind::UnlistedDependency => Some(vec![
386
+ "dart-decimate/unlisted-dependency",
387
+ "unlisted-dependency",
388
+ "unlisted-dependencies",
389
+ "unlisted-deps",
390
+ ]),
391
+ FindingKind::PrivateSrcImport => Some(vec![
392
+ "dart-decimate/private-src-import",
393
+ "private-src-import",
394
+ "private-src-imports",
395
+ ]),
396
+ _ => None,
397
+ }
398
+ }
399
+
400
+ fn unused_dependency_override_aliases() -> [&'static str; 6] {
401
+ [
402
+ "dart-decimate/unused-dependency-override",
403
+ "unused-dependency-override",
404
+ "unused-dependency-overrides",
405
+ "dart-decimate/dependency-override",
406
+ "dependency-override",
407
+ "dependency-overrides",
408
+ ]
409
+ }
410
+
411
+ fn misconfigured_dependency_override_aliases() -> [&'static str; 6] {
412
+ [
413
+ "dart-decimate/misconfigured-dependency-override",
414
+ "misconfigured-dependency-override",
415
+ "misconfigured-dependency-overrides",
416
+ "dart-decimate/dependency-override",
417
+ "dependency-override",
418
+ "dependency-overrides",
419
+ ]
420
+ }
421
+
422
+ fn quality_kind_aliases(kind: FindingKind) -> Option<Vec<&'static str>> {
423
+ match kind {
424
+ FindingKind::CodeDuplication => Some(vec![
425
+ "dart-decimate/code-duplication",
426
+ "code-duplication",
427
+ "duplication",
428
+ "dupes",
429
+ ]),
430
+ FindingKind::HighCyclomaticComplexity => Some(vec![
431
+ "dart-decimate/high-cyclomatic-complexity",
432
+ "high-cyclomatic-complexity",
433
+ "complexity",
434
+ ]),
435
+ FindingKind::HighCognitiveComplexity => Some(vec![
436
+ "dart-decimate/high-cognitive-complexity",
437
+ "high-cognitive-complexity",
438
+ "complexity",
439
+ ]),
440
+ FindingKind::HighComplexity => Some(vec![
441
+ "dart-decimate/high-complexity",
442
+ "high-complexity",
443
+ "complexity",
444
+ ]),
445
+ FindingKind::CoverageGap => Some(vec![
446
+ "dart-decimate/coverage-gap",
447
+ "coverage-gap",
448
+ "coverage-gaps",
449
+ "untested-file",
450
+ "untested-files",
451
+ ]),
452
+ FindingKind::HighCrapScore => Some(vec![
453
+ "dart-decimate/high-crap-score",
454
+ "high-crap-score",
455
+ "crap-score",
456
+ "crap",
457
+ "complexity",
458
+ ]),
459
+ FindingKind::HealthHotspot => Some(vec![
460
+ "dart-decimate/health-hotspot",
461
+ "health-hotspot",
462
+ "health-hotspots",
463
+ "hotspot",
464
+ "hotspots",
465
+ ]),
466
+ FindingKind::RefactoringTarget => Some(vec![
467
+ "dart-decimate/refactoring-target",
468
+ "refactoring-target",
469
+ "refactoring-targets",
470
+ "target",
471
+ "targets",
472
+ ]),
473
+ FindingKind::FeatureFlag => Some(vec![
474
+ "dart-decimate/feature-flag",
475
+ "feature-flag",
476
+ "feature-flags",
477
+ "flags",
478
+ ]),
479
+ FindingKind::SecurityCandidate => Some(vec![
480
+ "security",
481
+ "security-candidate",
482
+ "security-candidates",
483
+ "security-sink",
484
+ ]),
485
+ _ => None,
486
+ }
487
+ }