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,95 @@
1
+ use std::io::Write;
2
+
3
+ use clap::{Arg, ArgAction, ArgMatches, Command, value_parser};
4
+
5
+ use crate::impact::{
6
+ ImpactSort, impact_all_report, impact_report, render_impact_all_report, render_impact_report,
7
+ };
8
+
9
+ use super::common_args::{format_arg, root_arg, root_flag_arg, root_path};
10
+ use super::{CliError, OutputFormat};
11
+
12
+ pub(super) fn impact_command() -> Command {
13
+ Command::new("impact")
14
+ .about("Show Dart Decimate's local value report")
15
+ .arg(root_arg())
16
+ .arg(root_flag_arg())
17
+ .arg(format_arg())
18
+ .arg(
19
+ Arg::new("quiet")
20
+ .long("quiet")
21
+ .help("Suppress non-data prompts")
22
+ .action(ArgAction::SetTrue),
23
+ )
24
+ .arg(
25
+ Arg::new("all")
26
+ .long("all")
27
+ .help("Roll up every tracked local project")
28
+ .action(ArgAction::SetTrue),
29
+ )
30
+ .arg(
31
+ Arg::new("sort")
32
+ .long("sort")
33
+ .value_name("KEY")
34
+ .help("Sort key for --all")
35
+ .default_value("label")
36
+ .value_parser(["label", "surfaced", "contained-commits", "record-count"]),
37
+ )
38
+ .arg(
39
+ Arg::new("limit")
40
+ .long("limit")
41
+ .value_name("N")
42
+ .help("Maximum projects to emit for --all")
43
+ .default_value("20")
44
+ .value_parser(value_parser!(usize)),
45
+ )
46
+ }
47
+
48
+ pub(super) fn run_impact<W: Write>(
49
+ subcommand: &ArgMatches,
50
+ mut writer: W,
51
+ ) -> Result<i32, CliError> {
52
+ if subcommand.get_flag("all") {
53
+ let report = impact_all_report(
54
+ impact_sort(subcommand),
55
+ subcommand.get_one::<usize>("limit").copied().unwrap_or(20),
56
+ );
57
+ match output_format(subcommand) {
58
+ OutputFormat::Json => serde_json::to_writer_pretty(&mut writer, &report)?,
59
+ OutputFormat::Human => {
60
+ writer.write_all(render_impact_all_report(&report).as_bytes())?;
61
+ }
62
+ }
63
+ } else {
64
+ let root = root_path(subcommand);
65
+ let report = impact_report(root);
66
+ match output_format(subcommand) {
67
+ OutputFormat::Json => serde_json::to_writer_pretty(&mut writer, &report)?,
68
+ OutputFormat::Human => writer.write_all(render_impact_report(&report).as_bytes())?,
69
+ }
70
+ }
71
+ writeln!(writer)?;
72
+ Ok(0)
73
+ }
74
+
75
+ fn output_format(subcommand: &ArgMatches) -> OutputFormat {
76
+ match subcommand
77
+ .get_one::<String>("format")
78
+ .map_or("human", String::as_str)
79
+ {
80
+ "json" => OutputFormat::Json,
81
+ _ => OutputFormat::Human,
82
+ }
83
+ }
84
+
85
+ fn impact_sort(subcommand: &ArgMatches) -> ImpactSort {
86
+ match subcommand
87
+ .get_one::<String>("sort")
88
+ .map_or("label", String::as_str)
89
+ {
90
+ "surfaced" => ImpactSort::Surfaced,
91
+ "contained-commits" => ImpactSort::ContainedCommits,
92
+ "record-count" => ImpactSort::RecordCount,
93
+ _ => ImpactSort::Label,
94
+ }
95
+ }
@@ -0,0 +1,49 @@
1
+ use std::io::Write;
2
+
3
+ use clap::{Arg, ArgAction, ArgMatches, Command};
4
+
5
+ use crate::config::DartDecimateConfig;
6
+ use crate::init::{InitOptions, init_project, render_init_report};
7
+
8
+ use super::common_args::{format_arg, root_arg, root_flag_arg, root_path};
9
+ use super::{CliError, OutputFormat, output_format};
10
+
11
+ pub(super) fn init_command() -> Command {
12
+ Command::new("init")
13
+ .about("Create Dart Decimate config and optional agent guidance")
14
+ .arg(root_arg())
15
+ .arg(root_flag_arg())
16
+ .arg(format_arg())
17
+ .arg(
18
+ Arg::new("agents")
19
+ .long("agents")
20
+ .help("Write AGENTS.md guidance for downstream coding agents")
21
+ .action(ArgAction::SetTrue),
22
+ )
23
+ .arg(
24
+ Arg::new("force")
25
+ .long("force")
26
+ .help("Overwrite existing init files")
27
+ .action(ArgAction::SetTrue),
28
+ )
29
+ }
30
+
31
+ pub(super) fn run_init<W: Write>(subcommand: &ArgMatches, mut writer: W) -> Result<i32, CliError> {
32
+ let root = root_path(subcommand);
33
+ let report = init_project(
34
+ &root,
35
+ InitOptions {
36
+ force: subcommand.get_flag("force"),
37
+ agents: subcommand.get_flag("agents"),
38
+ },
39
+ )?;
40
+
41
+ match output_format(subcommand, &DartDecimateConfig::default()) {
42
+ OutputFormat::Json => {
43
+ serde_json::to_writer_pretty(&mut writer, &report)?;
44
+ writeln!(writer)?;
45
+ }
46
+ OutputFormat::Human => writer.write_all(render_init_report(&report).as_bytes())?,
47
+ }
48
+ Ok(0)
49
+ }
@@ -0,0 +1,20 @@
1
+ use std::path::PathBuf;
2
+
3
+ use clap::{Arg, Command, value_parser};
4
+
5
+ pub(super) fn inspect_command(command: Command) -> Command {
6
+ command
7
+ .arg(
8
+ Arg::new("file")
9
+ .long("file")
10
+ .value_name("PATH")
11
+ .help("Dart file to inspect")
12
+ .value_parser(value_parser!(PathBuf)),
13
+ )
14
+ .arg(
15
+ Arg::new("symbol")
16
+ .long("symbol")
17
+ .value_name("SYMBOL")
18
+ .help("Top-level symbol to inspect, or FILE:SYMBOL when --file is omitted"),
19
+ )
20
+ }
@@ -0,0 +1,66 @@
1
+ use std::io::Write;
2
+ use std::path::Path;
3
+
4
+ use super::analyze::analyze_project;
5
+ use super::entry_points::entry_points_for_check;
6
+ use super::{CliError, CommandRequest, ReportOutputFormat};
7
+ use crate::config::apply_rules_to_report;
8
+ use crate::graph::normalize_against;
9
+ use crate::inspect::{inspect_file, inspect_symbol, render_inspect_report};
10
+ use crate::output::{ReportCommand, build_json_report};
11
+ use crate::{ScannedProject, find_dead_code};
12
+
13
+ pub(super) fn run_inspect_request<W: Write>(
14
+ request: &CommandRequest,
15
+ project: &ScannedProject,
16
+ mut writer: W,
17
+ ) -> Result<i32, CliError> {
18
+ let dead_code = find_dead_code(
19
+ &project.graph,
20
+ entry_points_for_check(project, &request.entry_points, request.entry_point_mode()),
21
+ );
22
+ let report = if let Some(spec) = request.trace_symbol.as_ref() {
23
+ let scoped_report = scoped_check_report(project, request, &spec.file)?;
24
+ inspect_symbol(project, &dead_code, scoped_report, &spec.file, &spec.symbol)
25
+ } else if let Some(file) = request.trace_file.as_ref() {
26
+ let scoped_report = scoped_check_report(project, request, file)?;
27
+ inspect_file(project, &dead_code, scoped_report, file)
28
+ } else {
29
+ return Err(CliError::MissingInspectTarget);
30
+ };
31
+
32
+ match request.format {
33
+ ReportOutputFormat::Human => writer.write_all(render_inspect_report(&report).as_bytes())?,
34
+ ReportOutputFormat::Json => {
35
+ serde_json::to_writer_pretty(&mut writer, &report)?;
36
+ writeln!(writer)?;
37
+ }
38
+ ReportOutputFormat::Sarif => unreachable!("SARIF is rejected before inspect rendering"),
39
+ }
40
+
41
+ Ok(0)
42
+ }
43
+
44
+ fn scoped_check_report(
45
+ project: &ScannedProject,
46
+ request: &CommandRequest,
47
+ path: &Path,
48
+ ) -> Result<crate::JsonReport, CliError> {
49
+ let mut scoped_request = request.clone();
50
+ scoped_request.command = ReportCommand::Check;
51
+ scoped_request.audit_base = None;
52
+ scoped_request.file_paths = Vec::new();
53
+ scoped_request.workspace_patterns = Vec::new();
54
+ scoped_request.changed_workspaces = None;
55
+ scoped_request.baseline_paths = Vec::new();
56
+ scoped_request.save_baseline = None;
57
+ scoped_request.regression_baseline = None;
58
+ scoped_request.save_regression_baseline = None;
59
+ scoped_request.fail_on_regression = false;
60
+
61
+ let mut results = analyze_project(project, &scoped_request)?;
62
+ results.file_scope = Some(vec![normalize_against(&project.root, path)]);
63
+ let mut report = build_json_report(project, &results);
64
+ apply_rules_to_report(&mut report, &scoped_request.rules)?;
65
+ Ok(report)
66
+ }
@@ -0,0 +1,240 @@
1
+ use clap::{Arg, ArgAction, ArgMatches, Command};
2
+
3
+ use crate::output::{FindingKind, ReportCommand};
4
+
5
+ #[derive(Debug, Clone, Default, PartialEq, Eq)]
6
+ pub(super) struct IssueFilters {
7
+ pub(super) kinds: Vec<FindingKind>,
8
+ }
9
+
10
+ pub(super) fn check_issue_filter_command(command: Command) -> Command {
11
+ let command = shared_issue_filter_command(command);
12
+ command
13
+ .arg(filter_arg(
14
+ "circular-deps",
15
+ "Report only circular dependency findings",
16
+ ))
17
+ .arg(filter_arg(
18
+ "re-export-cycles",
19
+ "Report only re-export cycle findings",
20
+ ))
21
+ .arg(filter_arg(
22
+ "boundary-violations",
23
+ "Report only architecture boundary findings",
24
+ ))
25
+ }
26
+
27
+ pub(super) fn dead_code_issue_filter_command(command: Command) -> Command {
28
+ shared_issue_filter_command(command)
29
+ }
30
+
31
+ fn shared_issue_filter_command(command: Command) -> Command {
32
+ command
33
+ .arg(filter_arg(
34
+ "unused-files",
35
+ "Report only unreachable Dart files",
36
+ ))
37
+ .arg(filter_arg(
38
+ "unused-exports",
39
+ "Report only unused top-level exports",
40
+ ))
41
+ .arg(filter_arg(
42
+ "unused-types",
43
+ "Report only unused public typedefs",
44
+ ))
45
+ .arg(filter_arg(
46
+ "unused-deps",
47
+ "Report only unused pub dependency findings",
48
+ ))
49
+ .arg(filter_arg(
50
+ "unlisted-deps",
51
+ "Report only imports missing from pubspec dependencies",
52
+ ))
53
+ .arg(filter_arg(
54
+ "private-src-imports",
55
+ "Report only cross-package lib/src imports",
56
+ ))
57
+ .arg(filter_arg(
58
+ "duplicate-exports",
59
+ "Report only duplicated public API exports",
60
+ ))
61
+ .arg(filter_arg(
62
+ "unused-enum-members",
63
+ "Report only unused enum constants",
64
+ ))
65
+ .arg(filter_arg(
66
+ "unused-class-members",
67
+ "Report only unused class-like members",
68
+ ))
69
+ .arg(filter_arg(
70
+ "unresolved-imports",
71
+ "Report only unresolved local dependency URIs",
72
+ ))
73
+ .arg(filter_arg(
74
+ "stale-suppressions",
75
+ "Report only stale dart-decimate/fallow suppression comments",
76
+ ))
77
+ .arg(filter_arg(
78
+ "unused-dependency-overrides",
79
+ "Report only unused pub dependency overrides",
80
+ ))
81
+ .arg(filter_arg(
82
+ "misconfigured-dependency-overrides",
83
+ "Report only invalid pub dependency overrides",
84
+ ))
85
+ }
86
+
87
+ pub(super) fn issue_filters(command: ReportCommand, matches: &ArgMatches) -> IssueFilters {
88
+ if !matches!(command, ReportCommand::Check | ReportCommand::DeadCode) {
89
+ return IssueFilters::default();
90
+ }
91
+ let mut kinds = Vec::new();
92
+ push_dead_code_filters(matches, &mut kinds);
93
+ push_dependency_filters(matches, &mut kinds);
94
+ push_graph_filters(matches, &mut kinds);
95
+ push_member_filters(matches, &mut kinds);
96
+ IssueFilters { kinds }
97
+ }
98
+
99
+ fn filter_arg(id: &'static str, help: &'static str) -> Arg {
100
+ Arg::new(id).long(id).help(help).action(ArgAction::SetTrue)
101
+ }
102
+
103
+ fn push_dead_code_filters(matches: &ArgMatches, kinds: &mut Vec<FindingKind>) {
104
+ push_flag(matches, kinds, "unused-files", &[FindingKind::DeadFile]);
105
+ push_flag(
106
+ matches,
107
+ kinds,
108
+ "unused-exports",
109
+ &[FindingKind::UnusedExport],
110
+ );
111
+ push_flag(matches, kinds, "unused-types", &[FindingKind::UnusedType]);
112
+ push_flag(
113
+ matches,
114
+ kinds,
115
+ "private-type-leaks",
116
+ &[FindingKind::PrivateTypeLeak],
117
+ );
118
+ push_flag(
119
+ matches,
120
+ kinds,
121
+ "stale-suppressions",
122
+ &[FindingKind::StaleSuppression],
123
+ );
124
+ }
125
+
126
+ fn push_dependency_filters(matches: &ArgMatches, kinds: &mut Vec<FindingKind>) {
127
+ push_flag(
128
+ matches,
129
+ kinds,
130
+ "unused-deps",
131
+ &[
132
+ FindingKind::UnusedDependency,
133
+ FindingKind::UnusedDevDependency,
134
+ FindingKind::TestOnlyDependency,
135
+ ],
136
+ );
137
+ push_flag(
138
+ matches,
139
+ kinds,
140
+ "unlisted-deps",
141
+ &[FindingKind::UnlistedDependency],
142
+ );
143
+ push_flag(
144
+ matches,
145
+ kinds,
146
+ "private-src-imports",
147
+ &[FindingKind::PrivateSrcImport],
148
+ );
149
+ push_flag(
150
+ matches,
151
+ kinds,
152
+ "unresolved-imports",
153
+ &[FindingKind::UnresolvedDependency],
154
+ );
155
+ push_flag(
156
+ matches,
157
+ kinds,
158
+ "unused-dependency-overrides",
159
+ &[FindingKind::UnusedDependencyOverride],
160
+ );
161
+ push_flag(
162
+ matches,
163
+ kinds,
164
+ "misconfigured-dependency-overrides",
165
+ &[FindingKind::MisconfiguredDependencyOverride],
166
+ );
167
+ }
168
+
169
+ fn push_graph_filters(matches: &ArgMatches, kinds: &mut Vec<FindingKind>) {
170
+ push_flag(
171
+ matches,
172
+ kinds,
173
+ "duplicate-exports",
174
+ &[FindingKind::DuplicateExport],
175
+ );
176
+ push_flag(
177
+ matches,
178
+ kinds,
179
+ "circular-deps",
180
+ &[FindingKind::CircularDependency],
181
+ );
182
+ push_flag(
183
+ matches,
184
+ kinds,
185
+ "re-export-cycles",
186
+ &[FindingKind::ReExportCycle],
187
+ );
188
+ push_flag(
189
+ matches,
190
+ kinds,
191
+ "boundary-violations",
192
+ &[
193
+ FindingKind::BoundaryViolation,
194
+ FindingKind::BoundaryCoverage,
195
+ FindingKind::BoundaryCallViolation,
196
+ ],
197
+ );
198
+ push_flag(
199
+ matches,
200
+ kinds,
201
+ "policy-violations",
202
+ &[FindingKind::PolicyViolation],
203
+ );
204
+ }
205
+
206
+ fn push_member_filters(matches: &ArgMatches, kinds: &mut Vec<FindingKind>) {
207
+ push_flag(
208
+ matches,
209
+ kinds,
210
+ "unused-enum-members",
211
+ &[FindingKind::UnusedEnumMember],
212
+ );
213
+ push_flag(
214
+ matches,
215
+ kinds,
216
+ "unused-class-members",
217
+ &[FindingKind::UnusedClassMember],
218
+ );
219
+ }
220
+
221
+ fn push_flag(
222
+ matches: &ArgMatches,
223
+ kinds: &mut Vec<FindingKind>,
224
+ id: &str,
225
+ flag_kinds: &[FindingKind],
226
+ ) {
227
+ if matches
228
+ .try_get_one::<bool>(id)
229
+ .ok()
230
+ .flatten()
231
+ .copied()
232
+ .unwrap_or_default()
233
+ {
234
+ for kind in flag_kinds {
235
+ if !kinds.contains(kind) {
236
+ kinds.push(*kind);
237
+ }
238
+ }
239
+ }
240
+ }