Skip to main content

Module output_dead_code

Module output_dead_code 

Source
Expand description

Typed envelope wrappers for the simple 1:1 dead-code findings (UnusedFile, PrivateTypeLeak, UnresolvedImport, CircularDependency, BoundaryViolation). Each wrapper flattens the bare finding via #[serde(flatten)] and carries a typed actions array populated at construction time, replacing the per-finding post-pass injection that previously grafted actions[] and introduced onto the schema. The introduced field is set by the audit pass via JSON map insertion and is None when serialized directly from Rust. The schemars::JsonSchema derive is gated per-struct on the schema feature. Typed envelope wrappers for the simple 1:1 dead-code findings whose actions are entirely determined by the wrapper type (no per-instance discriminants beyond what the bare finding already exposes).

Each wrapper flattens the bare finding via #[serde(flatten)] so the wire shape matches the previous actions-grafted output byte-for-byte. actions is populated at construction time via each wrapper’s with_actions constructor and replaces the per-finding inject_actions post-pass in crates/cli/src/report/json.rs. introduced carries the optional audit breadcrumb that crates/cli/src/audit.rs::annotate_issue_array inserts into the JSON object via map.insert; the wrapper-level field stays None when serialized directly from Rust and is set by the audit pass only when the issue was introduced relative to the merge-base.

All nine wrappers ship with IssueAction arrays today; they pay the serde_json dependency cost because IssueAction transitively references AddToConfigValue::RuleObject(serde_json::Map<...>). The variants the wrappers actually emit (Fix, SuppressLine, SuppressFile) are small, but reusing the existing enum keeps the wire-shape contract identical to the legacy post-pass.

introduced is typed as Option<AuditIntroduced> (transparent newtype over bool) so the regenerated schema renders the field via $ref: #/definitions/AuditIntroduced, matching the reference the prior post-pass augmentation graft used. The audit pass continues to inject a bare bool via map.insert("introduced", ...); serde reads it back into AuditIntroduced transparently. The field stays absent at the wire when None (skip_serializing_if).

Structs§

BoundaryViolationFinding
Wire-shape envelope for a BoundaryViolation finding. Mirrors UnusedFileFinding: flattens the bare finding and carries a typed actions array (refactor-boundary primary plus suppress-line secondary).
CircularDependencyFinding
Wire-shape envelope for a CircularDependency finding. Mirrors UnusedFileFinding: flattens the bare finding and carries a typed actions array (refactor-cycle primary plus suppress-line secondary).
DuplicateExportFinding
Wire-shape envelope for a DuplicateExport finding. Carries up to three actions in position-locked order: an add-to-config ignoreExports snippet (only when locations[] carries at least one path) followed by the remove-duplicate fix and the multi-location suppress.
EmptyCatalogGroupFinding
Wire-shape envelope for an EmptyCatalogGroup finding. Carries a straightforward remove-empty-catalog-group primary plus a YAML-comment suppress.
MisconfiguredDependencyOverrideFinding
Wire-shape envelope for a MisconfiguredDependencyOverride finding. Carries a fix-dependency-override primary plus the conditional add-to-config ignoreDependencyOverrides suppress (skipped when both target_package and raw_key are empty, since the rule matcher keys on a non-empty package name).
PrivateTypeLeakFinding
Wire-shape envelope for a PrivateTypeLeak finding. Mirrors UnusedFileFinding: flattens the bare finding and carries a typed actions array (export-type primary plus suppress-line secondary).
ReExportCycleFinding
Wire-shape envelope for a ReExportCycle finding. Mirrors CircularDependencyFinding: flattens the bare finding and carries a typed actions array (refactor-re-export-cycle informational primary plus suppress-file secondary; cycles are file-scoped so a single file-level suppression on the alphabetically-first member breaks the cycle, and no // fallow-ignore-next-line form makes sense because the diagnostic is anchored at line 1 col 0 of each member).
TestOnlyDependencyFinding
Wire-shape envelope for a TestOnlyDependency finding. Carries a move-to-dev primary (different prose than TypeOnlyDependencyFinding) plus the standard ignoreDependencies config suppress.
TypeOnlyDependencyFinding
Wire-shape envelope for a TypeOnlyDependency finding. Carries a move-to-dev primary plus the standard ignoreDependencies config suppress.
UnlistedDependencyFinding
Wire-shape envelope for an UnlistedDependency finding. Carries an install-dependency primary (non-auto-fixable) plus the standard ignoreDependencies config suppress.
UnresolvedCatalogReferenceFinding
Wire-shape envelope for an UnresolvedCatalogReference finding. The primary action at position 0 discriminates on available_in_catalogs: add-catalog-entry when the array is empty (no other catalog declares the package), or update-catalog-reference when at least one alternative exists. When exactly one alternative exists, the action also carries suggested_target so deterministic agents can land the edit without picking from a list.
UnresolvedImportFinding
Wire-shape envelope for an UnresolvedImport finding. Mirrors UnusedFileFinding: flattens the bare finding and carries a typed actions array (resolve-import primary plus suppress-line secondary).
UnusedCatalogEntryFinding
Wire-shape envelope for an UnusedCatalogEntry finding. Per-instance auto_fixable flips to false when hardcoded_consumers is non-empty: the entry cannot be removed safely while a workspace package still pins the same package via a hardcoded version range.
UnusedClassMemberFinding
Wire-shape envelope for an UnusedMember finding consumed under the unused_class_members key. Same Rust struct as UnusedEnumMemberFinding; the fix action and suppress comment carry the class-member kebab-case identifier instead.
UnusedDependencyFinding
Wire-shape envelope for an UnusedDependency finding consumed under the unused_dependencies key (production deps). Flattens the bare finding; the typed actions array carries either a remove-dependency or move-dependency primary depending on inner.used_in_workspaces.
UnusedDependencyOverrideFinding
Wire-shape envelope for an UnusedDependencyOverride finding. Carries a remove-dependency-override primary plus an add-to-config ignoreDependencyOverrides suppress scoped to the target package and declaration source.
UnusedDevDependencyFinding
Wire-shape envelope for an UnusedDependency finding consumed under the unused_dev_dependencies key. Same bare struct as UnusedDependencyFinding; the fix description points at devDependencies and the suppress comment uses unused-dev-dependency.
UnusedEnumMemberFinding
Wire-shape envelope for an UnusedMember finding consumed under the unused_enum_members key.
UnusedExportFinding
Wire-shape envelope for an UnusedExport finding consumed under the unused_exports key. Same Rust struct as UnusedTypeFinding, with a different fix description so consumers can tell value-export from type-export removal at the action level.
UnusedFileFinding
Wire-shape envelope for an UnusedFile finding. The bare finding flattens in via #[serde(flatten)], with a typed actions array populated at construction time and the audit-pass introduced flag attached as an optional sibling.
UnusedOptionalDependencyFinding
Wire-shape envelope for an UnusedDependency finding consumed under the unused_optional_dependencies key. Same bare struct as UnusedDependencyFinding; the fix description points at optionalDependencies. Reuses the unused-dependency suppress IssueKind because there is no dedicated variant for optional deps.
UnusedTypeFinding
Wire-shape envelope for an UnusedExport finding consumed under the unused_types key. Wraps the same bare UnusedExport struct as UnusedExportFinding but emits a fix action targeted at type-only declarations, with the same is_re_export-aware note swap.

Constants§

NAMESPACE_BARREL_HINT
Shared note for the duplicate-exports fix action. Mirrors the const used by the human report (see crates/cli/src/report/shared.rs); kept here so the wire-format builder reads from the same source of truth.