use serde::{Deserialize, Serialize};
use crate::catalog_source::is_pnpm_catalog_source;
use crate::envelope::AuditIntroduced;
use crate::output::{
AddToConfigAction, AddToConfigKind, AddToConfigValue, FixAction, FixActionType,
IgnoreExportsRule, IssueAction, SuppressFileAction, SuppressFileKind, SuppressLineAction,
SuppressLineKind, SuppressLineScope,
};
pub use crate::results::AbsentComponentPropFinding;
use crate::results::{
BoundaryCallViolation, BoundaryCoverageViolation, BoundaryViolation, CircularDependency,
DependencyOverrideSource, DeprecatedExportInUse, DevDependencyInProduction, DuplicateExport,
DuplicateExportAlias, DuplicatePropShape, DynamicSegmentNameConflict, EmptyCatalogGroup,
InvalidClientExport, MisconfiguredDependencyOverride, MisplacedDirective,
MixedClientServerBarrel, PackageCycle, PolicyViolation, PrivateTypeLeak, PropDrillingChain,
ReExportCycle, ReExportCycleKind, RouteCollision, TestOnlyDependency, ThinWrapper,
TypeOnlyDependency, UnlistedBinary, UnlistedDependency, UnproducedCatchTag, UnprovidedInject,
UnrenderedComponent, UnresolvedCatalogReference, UnresolvedImport, UnusedCatalogEntry,
UnusedComponentEmit, UnusedComponentInput, UnusedComponentOutput, UnusedComponentProp,
UnusedDependency, UnusedDependencyOverride, UnusedEffectLayer, UnusedExport, UnusedFile,
UnusedLoadDataKey, UnusedMember, UnusedServerAction, UnusedSvelteEvent, UnusedTaggedError,
};
use crate::semantic::{
SemanticCandidateDecision, SemanticCandidateDecisionKind, SemanticCompleteness,
};
pub const NAMESPACE_BARREL_HINT: &str = "If every location is the sole `index.*` of its directory, this is likely an intentional namespace-barrel API. Prefer adding these files to `ignoreExports` over removing exports.";
const IGNORE_EXPORTS_VALUE_SCHEMA: &str =
"https://raw.githubusercontent.com/fallow-rs/fallow/main/schema.json#/properties/ignoreExports";
const IGNORE_CATALOG_REFERENCES_VALUE_SCHEMA: &str = "https://raw.githubusercontent.com/fallow-rs/fallow/main/schema.json#/properties/ignoreCatalogReferences/items";
const IGNORE_DEPENDENCY_OVERRIDES_VALUE_SCHEMA: &str = "https://raw.githubusercontent.com/fallow-rs/fallow/main/schema.json#/properties/ignoreDependencyOverrides/items";
pub(crate) fn manual_framework_fix(
kind: FixActionType,
description: &str,
note: &str,
) -> IssueAction {
IssueAction::Fix(FixAction {
kind,
auto_fixable: false,
description: description.to_string(),
note: Some(note.to_string()),
available_in_catalogs: None,
suggested_target: None,
})
}
pub(crate) fn suppress_line(comment: &str) -> IssueAction {
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: comment.to_string(),
scope: None,
})
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[serde(rename_all = "kebab-case")]
pub enum ReachabilityCaveat {
IncompleteFileAnalysis,
IncompleteImportGraph,
}
impl ReachabilityCaveat {
#[must_use]
pub const fn token(self) -> &'static str {
match self {
Self::IncompleteFileAnalysis => "incomplete-file-analysis",
Self::IncompleteImportGraph => "incomplete-import-graph",
}
}
#[must_use]
pub const fn message(self) -> &'static str {
match self {
Self::IncompleteFileAnalysis => {
"low: this file was not fully analyzed, so its extracted exports and imports may be incomplete; see workspace_diagnostics[]"
}
Self::IncompleteImportGraph => {
"low: a module this run did not fully read may hold an import that would credit this; see workspace_diagnostics[]"
}
}
}
#[must_use]
pub const fn short_label(self) -> &'static str {
match self {
Self::IncompleteFileAnalysis => "incomplete file analysis",
Self::IncompleteImportGraph => "incomplete import graph",
}
}
}
#[must_use]
pub fn caveat_labels(caveats: &[ReachabilityCaveat]) -> Option<String> {
if caveats.is_empty() {
return None;
}
let labels: Vec<&str> = caveats
.iter()
.map(|caveat| ReachabilityCaveat::short_label(*caveat))
.collect();
Some(labels.join(", "))
}
#[must_use]
pub fn caveat_suffix(caveats: &[ReachabilityCaveat]) -> Option<String> {
caveat_labels(caveats).map(|labels| format!("{CAVEAT_SUFFIX_MARKER}{labels})"))
}
pub const CAVEAT_SUFFIX_MARKER: &str = " (caveat: ";
#[must_use]
pub fn description_carries_caveat(description: &str) -> bool {
description.contains(CAVEAT_SUFFIX_MARKER)
}
#[must_use]
pub fn caveat_label_for_token(token: &str) -> String {
match token {
"incomplete-file-analysis" => {
ReachabilityCaveat::short_label(ReachabilityCaveat::IncompleteFileAnalysis).to_owned()
}
"incomplete-import-graph" => {
ReachabilityCaveat::short_label(ReachabilityCaveat::IncompleteImportGraph).to_owned()
}
other => other.replace('-', " "),
}
}
#[must_use]
pub fn caveat_labels_for_tokens<'a>(tokens: impl IntoIterator<Item = &'a str>) -> Option<String> {
let labels: Vec<String> = tokens.into_iter().map(caveat_label_for_token).collect();
if labels.is_empty() {
return None;
}
Some(labels.join(", "))
}
#[must_use]
pub fn caveat_suffix_for_tokens<'a>(tokens: impl IntoIterator<Item = &'a str>) -> Option<String> {
caveat_labels_for_tokens(tokens).map(|labels| format!("{CAVEAT_SUFFIX_MARKER}{labels})"))
}
pub const INCOMPLETE_EVIDENCE_NOTE: &str = "Evidence is incomplete: a file this run did not fully analyze may hold the reference that \
credits this finding, so this mutation is not applied automatically. Resolve the files named \
in workspace_diagnostics[] and re-run, or confirm and remove it by hand.";
pub trait MutationEvidence {
fn reachability_caveats(&self) -> &[ReachabilityCaveat];
fn may_auto_apply_mutation(&self) -> bool {
self.reachability_caveats().is_empty()
}
}
pub trait CaveatedFinding: MutationEvidence {
fn set_reachability_caveats(&mut self, caveats: Vec<ReachabilityCaveat>);
}
fn withhold_caveated_mutations(actions: &mut [IssueAction], caveats: &[ReachabilityCaveat]) {
if caveats.is_empty() {
return;
}
for action in actions {
let IssueAction::Fix(fix) = action else {
continue;
};
fix.auto_fixable = false;
fix.note = Some(match fix.note.take() {
Some(existing) => format!("{existing}. {INCOMPLETE_EVIDENCE_NOTE}"),
None => INCOMPLETE_EVIDENCE_NOTE.to_string(),
});
}
}
macro_rules! impl_caveated_finding {
($($finding:ty),+ $(,)?) => {
$(
impl MutationEvidence for $finding {
fn reachability_caveats(&self) -> &[ReachabilityCaveat] {
&self.reachability_caveats
}
}
impl CaveatedFinding for $finding {
fn set_reachability_caveats(&mut self, caveats: Vec<ReachabilityCaveat>) {
withhold_caveated_mutations(&mut self.actions, &caveats);
self.reachability_caveats = caveats;
}
}
)+
};
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedFileFinding {
#[serde(flatten)]
pub file: UnusedFile,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub reachability_caveats: Vec<ReachabilityCaveat>,
}
impl UnusedFileFinding {
#[must_use]
pub fn with_actions(file: UnusedFile) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::DeleteFile,
auto_fixable: false,
description: "Delete this file".to_string(),
note: Some(
"File deletion may remove runtime functionality not visible to static analysis"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressFile(SuppressFileAction {
kind: SuppressFileKind::SuppressFile,
auto_fixable: false,
description: "Suppress with a file-level comment at the top of the file"
.to_string(),
comment: "// fallow-ignore-file unused-file".to_string(),
}),
];
Self {
finding_id: None,
file,
actions,
introduced: None,
effective_severity: None,
reachability_caveats: Vec::new(),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct PrivateTypeLeakFinding {
#[serde(flatten)]
pub leak: PrivateTypeLeak,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl PrivateTypeLeakFinding {
#[must_use]
pub fn with_actions(leak: PrivateTypeLeak) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::ExportType,
auto_fixable: false,
description: "Export the referenced private type by name".to_string(),
note: Some(
"Keep the type exported while it is part of a public signature".to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line private-type-leak".to_string(),
scope: None,
}),
];
Self {
finding_id: None,
leak,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct DeprecatedExportInUseFinding {
#[serde(flatten)]
pub export: DeprecatedExportInUse,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl DeprecatedExportInUseFinding {
#[must_use]
pub fn with_actions(export: DeprecatedExportInUse) -> Self {
let trace_hint = format!(
"For the full consumer list, run `fallow dead-code --trace <path>:{}` with the `path` of this finding.",
export.export_name
);
let note = if export.public_api {
format!(
"This export is public API. External consumers are not visible, so do not remove it on this evidence alone. {trace_hint}"
)
} else {
format!(
"Move each consumer to the replacement that the deprecation message names, then remove the export. {trace_hint}"
)
};
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::MigrateDeprecatedExport,
auto_fixable: false,
description: "Move the consumers off the deprecated export".to_string(),
note: Some(note),
available_in_catalogs: None,
suggested_target: None,
}),
suppress_line("// fallow-ignore-next-line deprecated-export-in-use"),
];
Self {
finding_id: None,
export,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnresolvedImportFinding {
#[serde(flatten)]
pub import: UnresolvedImport,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnresolvedImportFinding {
#[must_use]
pub fn with_actions(import: UnresolvedImport) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::ResolveImport,
auto_fixable: false,
description: "Fix the import specifier or install the missing module".to_string(),
note: Some(
"Verify the module path and check tsconfig paths configuration".to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::AddToConfig(AddToConfigAction {
kind: AddToConfigKind::AddToConfig,
auto_fixable: false,
description: format!(
"Add \"{}\" to ignoreUnresolvedImports in fallow config",
import.specifier
),
config_key: "ignoreUnresolvedImports".to_string(),
value: AddToConfigValue::Scalar(import.specifier.clone()),
value_schema: Some(
"https://raw.githubusercontent.com/fallow-rs/fallow/main/schema.json#/properties/ignoreUnresolvedImports/items"
.to_string(),
),
}),
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line unresolved-import".to_string(),
scope: None,
}),
];
Self {
finding_id: None,
import,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct CircularDependencyFinding {
#[serde(flatten)]
pub cycle: CircularDependency,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl CircularDependencyFinding {
#[must_use]
pub fn with_actions(cycle: CircularDependency) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::RefactorCycle,
auto_fixable: false,
description: "Extract shared logic into a separate module to break the cycle"
.to_string(),
note: Some(
"Circular imports can cause initialization issues and make code harder to reason about"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line circular-dependency".to_string(),
scope: None,
}),
];
Self {
finding_id: None,
cycle,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct ReExportCycleFinding {
#[serde(flatten)]
pub cycle: ReExportCycle,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl ReExportCycleFinding {
#[must_use]
pub fn with_actions(cycle: ReExportCycle) -> Self {
let suppress_description = match cycle.kind {
ReExportCycleKind::SelfLoop => {
"Suppress with a file-level comment at the top of this file. \
The cycle is a self-loop, so the suppression covers the entire finding."
.to_string()
}
ReExportCycleKind::MultiNode => {
"Suppress with a file-level comment at the top of this file. \
One suppression on any member breaks the cycle for every member \
(see the sibling `files` array)."
.to_string()
}
};
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::RefactorReExportCycle,
auto_fixable: false,
description: "Remove one `export * from` (or `export { ... } from`) \
statement on any one member to break the cycle"
.to_string(),
note: Some(
"Re-export cycles are structurally a no-op: chain propagation through \
the loop never reaches a terminating module, so imports from any member \
may silently come up empty."
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressFile(SuppressFileAction {
kind: SuppressFileKind::SuppressFile,
auto_fixable: false,
description: suppress_description,
comment: "// fallow-ignore-file re-export-cycle".to_string(),
}),
];
Self {
finding_id: None,
cycle,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct PackageCycleFinding {
#[serde(flatten)]
pub cycle: PackageCycle,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl PackageCycleFinding {
#[must_use]
pub fn with_actions(cycle: PackageCycle) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::RefactorCycle,
auto_fixable: false,
description: "Remove the imports on one hop of the cycle, for example by \
moving the shared code to a package that both packages import"
.to_string(),
note: Some(
"Packages that import each other cannot be built in dependency order"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the import. The cycle \
is gone when every import on one hop is suppressed"
.to_string(),
comment: "// fallow-ignore-next-line package-cycle".to_string(),
scope: None,
}),
];
Self {
cycle,
finding_id: None,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct BoundaryViolationFinding {
#[serde(flatten)]
pub violation: BoundaryViolation,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl BoundaryViolationFinding {
#[must_use]
pub fn with_actions(violation: BoundaryViolation) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::RefactorBoundary,
auto_fixable: false,
description: "Move the import through an allowed zone or restructure the dependency"
.to_string(),
note: Some(
"This import crosses an architecture boundary that is not permitted by the configured rules"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line boundary-violation".to_string(),
scope: None,
}),
];
Self {
finding_id: None,
violation,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct BoundaryCoverageViolationFinding {
#[serde(flatten)]
pub violation: BoundaryCoverageViolation,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl BoundaryCoverageViolationFinding {
#[must_use]
pub fn with_actions(violation: BoundaryCoverageViolation) -> Self {
let path = violation.path.to_string_lossy().replace('\\', "/");
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::RefactorBoundary,
auto_fixable: false,
description: "Add this file to a boundary zone pattern or move it under an existing zone"
.to_string(),
note: Some(
"Boundary coverage is enabled, so every analyzed source file must match a zone unless allow-listed"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::AddToConfig(AddToConfigAction {
kind: AddToConfigKind::AddToConfig,
auto_fixable: false,
description: format!(
"Add \"{path}\" to boundaries.coverage.allowUnmatched in fallow config"
),
config_key: "boundaries.coverage.allowUnmatched".to_string(),
value: AddToConfigValue::Scalar(path),
value_schema: Some(
"https://raw.githubusercontent.com/fallow-rs/fallow/main/schema.json#/properties/boundaries/properties/coverage/properties/allowUnmatched/items"
.to_string(),
),
}),
IssueAction::SuppressFile(SuppressFileAction {
kind: SuppressFileKind::SuppressFile,
auto_fixable: false,
description: "Suppress with a file-level comment at the top of the file"
.to_string(),
comment: "// fallow-ignore-file boundary-violation".to_string(),
}),
];
Self {
finding_id: None,
violation,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct BoundaryCallViolationFinding {
#[serde(flatten)]
pub violation: BoundaryCallViolation,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl BoundaryCallViolationFinding {
#[must_use]
pub fn with_actions(violation: BoundaryCallViolation) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::RefactorBoundary,
auto_fixable: false,
description: format!(
"Move the `{}` call out of zone '{}' or behind an allowed abstraction",
violation.callee, violation.zone,
),
note: Some(format!(
"`boundaries.calls.forbidden` bans callees matching `{}` from zone '{}'. The check is syntactic: it applies only to files classified into a zone and does not follow aliased or re-bound callees",
violation.pattern, violation.zone,
)),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line boundary-violation".to_string(),
scope: None,
}),
IssueAction::SuppressFile(SuppressFileAction {
kind: SuppressFileKind::SuppressFile,
auto_fixable: false,
description: "Suppress with a file-level comment at the top of the file"
.to_string(),
comment: "// fallow-ignore-file boundary-violation".to_string(),
}),
];
Self {
finding_id: None,
violation,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct PolicyViolationFinding {
#[serde(flatten)]
pub violation: PolicyViolation,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
}
impl PolicyViolationFinding {
#[must_use]
pub fn with_actions(violation: PolicyViolation) -> Self {
let what = match violation.kind {
crate::results::PolicyRuleKind::BannedCall => "call",
crate::results::PolicyRuleKind::BannedImport => "import",
crate::results::PolicyRuleKind::BannedEffect => "effect",
crate::results::PolicyRuleKind::BannedExport => "export",
crate::results::PolicyRuleKind::GdpProofProducer => "proof producer",
};
let description = match &violation.message {
Some(message) => format!("Replace the `{}` {what}: {message}", violation.matched),
None => format!("Replace the `{}` {what}", violation.matched),
};
let suppress_token = format!("policy-violation:{}/{}", violation.pack, violation.rule_id);
let note = if violation.kind == crate::results::PolicyRuleKind::GdpProofProducer {
"This check resolves the gdp-ts factory through static imports and unambiguous re-exports. Move proof creation to an allowed module. It does not verify authorization logic or follow arbitrary wrappers.".to_owned()
} else {
format!(
"Rule `{}/{}` from the configured rule packs bans this {what}. The check is syntactic: it does not follow aliased or re-bound callees, and import matching uses the raw specifier",
violation.pack, violation.rule_id,
)
};
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::ResolvePolicyViolation,
auto_fixable: false,
description,
note: Some(note),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress this rule-pack rule with an inline comment above the line"
.to_string(),
comment: format!("// fallow-ignore-next-line {suppress_token}"),
scope: None,
}),
IssueAction::SuppressFile(SuppressFileAction {
kind: SuppressFileKind::SuppressFile,
auto_fixable: false,
description:
"Suppress this rule-pack rule with a file-level comment at the top of the file"
.to_string(),
comment: format!("// fallow-ignore-file {suppress_token}"),
}),
];
Self {
finding_id: None,
violation,
actions,
introduced: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedExportFinding {
#[serde(flatten)]
pub export: UnusedExport,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub semantic: Option<SemanticCandidateDecision>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub reachability_caveats: Vec<ReachabilityCaveat>,
}
impl UnusedExportFinding {
#[must_use]
pub fn with_actions(export: UnusedExport) -> Self {
let note = if export.is_re_export {
Some(
"This finding originates from a re-export; verify it is not part of your public API before removing"
.to_string(),
)
} else {
None
};
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::RemoveExport,
auto_fixable: true,
description: "Remove the unused export from the public API".to_string(),
note,
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line unused-export".to_string(),
scope: None,
}),
];
Self {
finding_id: None,
export,
actions,
semantic: None,
introduced: None,
effective_severity: None,
reachability_caveats: Vec::new(),
}
}
pub fn set_semantic_decision(&mut self, decision: SemanticCandidateDecision) {
set_export_semantic_action(&mut self.actions, &decision, &self.reachability_caveats);
self.semantic = Some(decision);
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedTypeFinding {
#[serde(flatten)]
pub export: UnusedExport,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub semantic: Option<SemanticCandidateDecision>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub reachability_caveats: Vec<ReachabilityCaveat>,
}
impl UnusedTypeFinding {
#[must_use]
pub fn with_actions(export: UnusedExport) -> Self {
let note = if export.is_re_export {
Some(
"This finding originates from a re-export; verify it is not part of your public API before removing"
.to_string(),
)
} else {
None
};
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::RemoveExport,
auto_fixable: true,
description:
"Remove the `export` (or `export type`) keyword from the type declaration"
.to_string(),
note,
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line unused-type".to_string(),
scope: None,
}),
];
Self {
finding_id: None,
export,
actions,
semantic: None,
introduced: None,
effective_severity: None,
reachability_caveats: Vec::new(),
}
}
pub fn set_semantic_decision(&mut self, decision: SemanticCandidateDecision) {
set_export_semantic_action(&mut self.actions, &decision, &self.reachability_caveats);
self.semantic = Some(decision);
}
}
fn set_export_semantic_action(
actions: &mut [IssueAction],
decision: &SemanticCandidateDecision,
caveats: &[ReachabilityCaveat],
) {
let complete_negative = decision.decision
== SemanticCandidateDecisionKind::ConfirmedNoStaticReferences
&& decision.status == SemanticCompleteness::Complete;
let Some(IssueAction::Fix(action)) = actions.first_mut() else {
return;
};
action.auto_fixable = complete_negative && caveats.is_empty();
if !complete_negative {
action.note = Some(
"Type-aware analysis retained this candidate because complete negative evidence was not available"
.to_string(),
);
}
if !caveats.is_empty() {
action.note = Some(INCOMPLETE_EVIDENCE_NOTE.to_string());
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct InvalidClientExportFinding {
#[serde(flatten)]
pub export: InvalidClientExport,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl InvalidClientExportFinding {
#[must_use]
pub fn with_actions(export: InvalidClientExport) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::MoveToServerModule,
auto_fixable: false,
description: "Move the server-only export to a non-client module and import it from there"
.to_string(),
note: Some(
"A \"use client\" file cannot export a Next.js server-only or route-config name; Next.js rejects it at build time"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line invalid-client-export".to_string(),
scope: None,
}),
];
Self {
finding_id: None,
export,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct MixedClientServerBarrelFinding {
#[serde(flatten)]
pub barrel: MixedClientServerBarrel,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl MixedClientServerBarrelFinding {
#[must_use]
pub fn with_actions(barrel: MixedClientServerBarrel) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::SplitMixedBarrel,
auto_fixable: false,
description: "Split the barrel so client and server-only modules are re-exported from separate files"
.to_string(),
note: Some(
"Importing one name from this barrel drags the other's directive across the client/server boundary"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line mixed-client-server-barrel".to_string(),
scope: None,
}),
];
Self {
finding_id: None,
barrel,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct MisplacedDirectiveFinding {
#[serde(flatten)]
pub directive_site: MisplacedDirective,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl MisplacedDirectiveFinding {
#[must_use]
pub fn with_actions(directive_site: MisplacedDirective) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::HoistDirective,
auto_fixable: false,
description: "Move the directive to the very top of the file, above all imports and statements"
.to_string(),
note: Some(
"An RSC bundler honors the directive only in the leading prologue; here it precedes other statements and is silently ignored"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line misplaced-directive".to_string(),
scope: None,
}),
];
Self {
finding_id: None,
directive_site,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnprovidedInjectFinding {
#[serde(flatten)]
pub inject: UnprovidedInject,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnprovidedInjectFinding {
#[must_use]
pub fn with_actions(inject: UnprovidedInject) -> Self {
let actions = vec![
manual_framework_fix(
FixActionType::ProvideInject,
"Provide this injected key, or remove the inject / getContext call",
"Manual review required: dependency-injection keys can be provided by framework wiring, tests, or package consumers outside this project.",
),
suppress_line("// fallow-ignore-next-line unprovided-inject"),
];
Self {
finding_id: None,
inject,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedServerActionFinding {
#[serde(flatten)]
pub action: UnusedServerAction,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnusedServerActionFinding {
#[must_use]
pub fn with_actions(action: UnusedServerAction) -> Self {
let actions = vec![
manual_framework_fix(
FixActionType::WireServerAction,
"Wire the server action to a caller or form action, or remove it",
"Manual review required: server actions may still be POST-able by action id or invoked reflectively outside the static project graph.",
),
suppress_line("// fallow-ignore-next-line unused-server-action"),
];
Self {
finding_id: None,
action,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedLoadDataKeyFinding {
#[serde(flatten)]
pub key: UnusedLoadDataKey,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnusedLoadDataKeyFinding {
#[must_use]
pub fn with_actions(key: UnusedLoadDataKey) -> Self {
let actions = vec![
manual_framework_fix(
FixActionType::UseLoadData,
"Read this load data key from the route UI, or remove it from the load return",
"Manual review required: load functions can perform real server or database work, so verify side effects before deleting the producer.",
),
suppress_line("// fallow-ignore-next-line unused-load-data-key"),
];
Self {
finding_id: None,
key,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnrenderedComponentFinding {
#[serde(flatten)]
pub component: UnrenderedComponent,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnrenderedComponentFinding {
#[must_use]
pub fn with_actions(component: UnrenderedComponent) -> Self {
let actions = vec![
manual_framework_fix(
FixActionType::RenderComponent,
"Render the reachable component from project code, or remove it",
"Manual review required: exported library components and dynamic render registries can be intentionally reachable without static template usage.",
),
suppress_line("// fallow-ignore-next-line unrendered-component"),
];
Self {
finding_id: None,
component,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedComponentPropFinding {
#[serde(flatten)]
pub prop: UnusedComponentProp,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnusedComponentPropFinding {
#[must_use]
pub fn with_actions(prop: UnusedComponentProp) -> Self {
let actions = vec![
manual_framework_fix(
FixActionType::UseComponentProp,
"Use the declared prop in the component, or remove it from the component API",
"Manual review required: public component APIs can intentionally keep stable props for external consumers.",
),
suppress_line("// fallow-ignore-next-line unused-component-prop"),
];
Self {
finding_id: None,
prop,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedComponentEmitFinding {
#[serde(flatten)]
pub emit: UnusedComponentEmit,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnusedComponentEmitFinding {
#[must_use]
pub fn with_actions(emit: UnusedComponentEmit) -> Self {
let actions = vec![
manual_framework_fix(
FixActionType::EmitComponentEvent,
"Emit the declared event from the component, or remove it from the component API",
"Manual review required: public component APIs can intentionally keep stable events for external listeners.",
),
suppress_line("// fallow-ignore-next-line unused-component-emit"),
];
Self {
finding_id: None,
emit,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedSvelteEventFinding {
#[serde(flatten)]
pub event: UnusedSvelteEvent,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnusedSvelteEventFinding {
#[must_use]
pub fn with_actions(event: UnusedSvelteEvent) -> Self {
let actions = vec![
manual_framework_fix(
FixActionType::WireSvelteEvent,
"Add or forward a listener for this custom event, or remove the dispatch",
"Manual review required: public Svelte component APIs can intentionally dispatch events for package consumers outside this project.",
),
suppress_line("// fallow-ignore-next-line unused-svelte-event"),
];
Self {
finding_id: None,
event,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct DuplicateExportAliasFinding {
#[serde(flatten)]
pub alias: DuplicateExportAlias,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl DuplicateExportAliasFinding {
#[must_use]
pub fn with_actions(alias: DuplicateExportAlias) -> Self {
let actions = vec![
manual_framework_fix(
FixActionType::RemoveDuplicate,
"Keep one export name for the binding and remove the other names",
"Manual review required: update the importers of a removed name first. Code outside the analyzed project can import any of the names. If the names are an intentional public API, add them to ignoreExports.",
),
suppress_line("// fallow-ignore-next-line duplicate-export-alias"),
];
Self {
finding_id: None,
alias,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedEffectLayerFinding {
#[serde(flatten)]
pub layer: UnusedEffectLayer,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnusedEffectLayerFinding {
#[must_use]
pub fn with_actions(layer: UnusedEffectLayer) -> Self {
let actions = vec![
manual_framework_fix(
FixActionType::ComposeEffectLayer,
"Compose the layer into a layer that reaches a runtime, or remove it with its unused consumers",
"Manual review required: remove the unused consumer layers first, then this layer. Code outside the analyzed project can still compose it.",
),
suppress_line("// fallow-ignore-next-line unused-effect-layer"),
];
Self {
finding_id: None,
layer,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedTaggedErrorFinding {
#[serde(flatten)]
pub error: UnusedTaggedError,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnusedTaggedErrorFinding {
#[must_use]
pub fn with_actions(error: UnusedTaggedError) -> Self {
let actions = vec![
manual_framework_fix(
FixActionType::FailTaggedError,
"Fail with this error where the condition occurs, or remove the class and its catchTag handlers",
"Manual review required: consumers outside the analyzed project can construct or decode the error.",
),
suppress_line("// fallow-ignore-next-line unused-tagged-error"),
];
Self {
finding_id: None,
error,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnproducedCatchTagFinding {
#[serde(flatten)]
pub catch_tag: UnproducedCatchTag,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnproducedCatchTagFinding {
#[must_use]
pub fn with_actions(catch_tag: UnproducedCatchTag) -> Self {
let actions = vec![
manual_framework_fix(
FixActionType::RemoveCatchTagHandler,
"Remove the handler for this tag, or fail with the error where the condition occurs",
"Manual review required: a package or code outside the analyzed project can produce the tag.",
),
suppress_line("// fallow-ignore-next-line unproduced-catch-tag"),
];
Self {
finding_id: None,
catch_tag,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct PropDrillingChainFinding {
#[serde(flatten)]
pub chain: PropDrillingChain,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl PropDrillingChainFinding {
#[must_use]
pub fn with_actions(chain: PropDrillingChain) -> Self {
let actions = vec![IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the source prop declaration"
.to_string(),
comment: "// fallow-ignore-next-line prop-drilling".to_string(),
scope: None,
})];
Self {
finding_id: None,
chain,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct ThinWrapperFinding {
#[serde(flatten)]
pub wrapper: ThinWrapper,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl ThinWrapperFinding {
#[must_use]
pub fn with_actions(wrapper: ThinWrapper) -> Self {
let actions = vec![IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the component definition"
.to_string(),
comment: "// fallow-ignore-next-line thin-wrapper".to_string(),
scope: None,
})];
Self {
finding_id: None,
wrapper,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct DuplicatePropShapeFinding {
#[serde(flatten)]
pub shape: DuplicatePropShape,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl DuplicatePropShapeFinding {
#[must_use]
pub fn with_actions(shape: DuplicatePropShape) -> Self {
let actions = vec![
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Three or more components share this exact prop shape. Extract one \
shared `Props` type (or a base component) that every member reuses, \
or keep them separate if a per-variant divergence is planned. \
Suppress one member with an inline comment above the component \
definition."
.to_string(),
comment: "// fallow-ignore-next-line duplicate-prop-shape".to_string(),
scope: None,
}),
IssueAction::SuppressFile(SuppressFileAction {
kind: SuppressFileKind::SuppressFile,
auto_fixable: false,
description: "Escape hatch: a file-level suppress silences this member but it \
still appears in its siblings' `sharing_components` (the group is \
real regardless of suppression)."
.to_string(),
comment: "// fallow-ignore-file duplicate-prop-shape".to_string(),
}),
];
Self {
finding_id: None,
shape,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedComponentInputFinding {
#[serde(flatten)]
pub input: UnusedComponentInput,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnusedComponentInputFinding {
#[must_use]
pub fn with_actions(input: UnusedComponentInput) -> Self {
let actions = vec![IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line unused-component-input".to_string(),
scope: None,
})];
Self {
finding_id: None,
input,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedComponentOutputFinding {
#[serde(flatten)]
pub output: UnusedComponentOutput,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnusedComponentOutputFinding {
#[must_use]
pub fn with_actions(output: UnusedComponentOutput) -> Self {
let actions = vec![IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line unused-component-output".to_string(),
scope: None,
})];
Self {
finding_id: None,
output,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct RouteCollisionFinding {
#[serde(flatten)]
pub collision: RouteCollision,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl RouteCollisionFinding {
#[must_use]
pub fn with_actions(collision: RouteCollision) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::ResolveRouteCollision,
auto_fixable: false,
description: "Two or more files resolve to the same URL. Move or merge one so \
each URL has a single owner. Route groups `(name)` and parallel \
slots `@name` are the only legal same-URL shapes."
.to_string(),
note: Some(
"Next.js fails the build with \"You cannot have two parallel pages that \
resolve to the same path\". See the sibling `conflicting_paths` array for \
the other files that own this URL."
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressFile(SuppressFileAction {
kind: SuppressFileKind::SuppressFile,
auto_fixable: false,
description: "Escape hatch only: a file-level suppress silences the finding but \
does NOT make `next build` pass. Prefer moving or merging a file."
.to_string(),
comment: "// fallow-ignore-file route-collision".to_string(),
}),
];
Self {
finding_id: None,
collision,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct DynamicSegmentNameConflictFinding {
#[serde(flatten)]
pub conflict: DynamicSegmentNameConflict,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl DynamicSegmentNameConflictFinding {
#[must_use]
pub fn with_actions(conflict: DynamicSegmentNameConflict) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::ResolveDynamicSegmentNameConflict,
auto_fixable: false,
description: "Sibling dynamic segments at the same position use different param \
names. Rename them to one consistent slug name (e.g. pick `[id]` \
or `[slug]` for both)."
.to_string(),
note: Some(
"Next.js throws \"You cannot use different slug names for the same dynamic \
path\" at dev / runtime when the position is hit; `next build` does not \
catch it. See the sibling `conflicting_segments` array."
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressFile(SuppressFileAction {
kind: SuppressFileKind::SuppressFile,
auto_fixable: false,
description: "Escape hatch only: a file-level suppress silences the finding but \
does NOT stop Next.js from throwing at dev / runtime. Prefer \
renaming the segments."
.to_string(),
comment: "// fallow-ignore-file dynamic-segment-name-conflict".to_string(),
}),
];
Self {
finding_id: None,
conflict,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedEnumMemberFinding {
#[serde(flatten)]
pub member: UnusedMember,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub reachability_caveats: Vec<ReachabilityCaveat>,
}
impl UnusedEnumMemberFinding {
#[must_use]
pub fn with_actions(member: UnusedMember) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::RemoveEnumMember,
auto_fixable: true,
description: "Remove this enum member".to_string(),
note: None,
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line unused-enum-member".to_string(),
scope: None,
}),
];
Self {
finding_id: None,
member,
actions,
introduced: None,
effective_severity: None,
reachability_caveats: Vec::new(),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedClassMemberFinding {
#[serde(flatten)]
pub member: UnusedMember,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub semantic: Option<SemanticCandidateDecision>,
#[serde(skip)]
#[cfg_attr(feature = "schema", schemars(skip))]
pub semantic_only_candidate: bool,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub reachability_caveats: Vec<ReachabilityCaveat>,
}
impl UnusedClassMemberFinding {
#[must_use]
pub fn with_actions(member: UnusedMember) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::RemoveClassMember,
auto_fixable: false,
description: "Remove this class member".to_string(),
note: Some(
"Class member may be used via dependency injection or decorators".to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line unused-class-member".to_string(),
scope: None,
}),
];
Self {
finding_id: None,
member,
actions,
semantic: None,
semantic_only_candidate: false,
introduced: None,
effective_severity: None,
reachability_caveats: Vec::new(),
}
}
#[must_use]
pub const fn semantic_only_candidate(mut self) -> Self {
self.semantic_only_candidate = true;
self
}
pub fn set_semantic_decision(&mut self, decision: SemanticCandidateDecision) {
let evidence_complete = self.reachability_caveats.is_empty();
if let Some(IssueAction::Fix(action)) = self.actions.first_mut() {
action.auto_fixable = decision.closed_world_eligible && evidence_complete;
action.note = Some(if evidence_complete {
decision.explanation.clone()
} else {
INCOMPLETE_EVIDENCE_NOTE.to_string()
});
}
self.semantic = Some(decision);
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedStoreMemberFinding {
#[serde(flatten)]
pub member: UnusedMember,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub reachability_caveats: Vec<ReachabilityCaveat>,
}
impl UnusedStoreMemberFinding {
#[must_use]
pub fn with_actions(member: UnusedMember) -> Self {
let actions = vec![IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line unused-store-member".to_string(),
scope: None,
})];
Self {
finding_id: None,
member,
actions,
introduced: None,
effective_severity: None,
reachability_caveats: Vec::new(),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedNamespaceMemberFinding {
#[serde(flatten)]
pub member: UnusedMember,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub reachability_caveats: Vec<ReachabilityCaveat>,
}
impl UnusedNamespaceMemberFinding {
#[must_use]
pub fn with_actions(member: UnusedMember) -> Self {
let actions = vec![IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line unused-namespace-member".to_string(),
scope: None,
})];
Self {
finding_id: None,
member,
actions,
introduced: None,
effective_severity: None,
reachability_caveats: Vec::new(),
}
}
}
fn build_unused_dependency_actions(
dep: &UnusedDependency,
package_json_location: &str,
suppress_issue_kind: &str,
) -> Vec<IssueAction> {
let mut actions = Vec::with_capacity(2);
let cross_workspace = !dep.used_in_workspaces.is_empty();
actions.push(if cross_workspace {
IssueAction::Fix(FixAction {
kind: FixActionType::MoveDependency,
auto_fixable: false,
description: "Move this dependency to the workspace package.json that imports it"
.to_string(),
note: Some(
"fallow fix will not remove dependencies that are imported by another workspace"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
})
} else {
IssueAction::Fix(FixAction {
kind: FixActionType::RemoveDependency,
auto_fixable: true,
description: format!("Remove from {package_json_location} in package.json"),
note: None,
available_in_catalogs: None,
suggested_target: None,
})
});
actions.push(build_ignore_dependencies_suppress_action(
&dep.package_name,
suppress_issue_kind,
));
actions
}
fn build_ignore_dependencies_suppress_action(
package_name: &str,
_suppress_issue_kind: &str,
) -> IssueAction {
IssueAction::AddToConfig(AddToConfigAction {
kind: AddToConfigKind::AddToConfig,
auto_fixable: false,
description: format!("Add \"{package_name}\" to ignoreDependencies in fallow config"),
config_key: "ignoreDependencies".to_string(),
value: AddToConfigValue::Scalar(package_name.to_string()),
value_schema: Some(
"https://raw.githubusercontent.com/fallow-rs/fallow/main/schema.json#/properties/ignoreDependencies/items"
.to_string(),
),
})
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedDependencyFinding {
#[serde(flatten)]
pub dep: UnusedDependency,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub reachability_caveats: Vec<ReachabilityCaveat>,
}
impl UnusedDependencyFinding {
#[must_use]
pub fn with_actions(dep: UnusedDependency) -> Self {
let actions = build_unused_dependency_actions(&dep, "dependencies", "unused-dependency");
Self {
finding_id: None,
dep,
actions,
introduced: None,
effective_severity: None,
reachability_caveats: Vec::new(),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedDevDependencyFinding {
#[serde(flatten)]
pub dep: UnusedDependency,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub reachability_caveats: Vec<ReachabilityCaveat>,
}
impl UnusedDevDependencyFinding {
#[must_use]
pub fn with_actions(dep: UnusedDependency) -> Self {
let actions =
build_unused_dependency_actions(&dep, "devDependencies", "unused-dev-dependency");
Self {
finding_id: None,
dep,
actions,
introduced: None,
effective_severity: None,
reachability_caveats: Vec::new(),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedOptionalDependencyFinding {
#[serde(flatten)]
pub dep: UnusedDependency,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub reachability_caveats: Vec<ReachabilityCaveat>,
}
impl UnusedOptionalDependencyFinding {
#[must_use]
pub fn with_actions(dep: UnusedDependency) -> Self {
let actions =
build_unused_dependency_actions(&dep, "optionalDependencies", "unused-dependency");
Self {
finding_id: None,
dep,
actions,
introduced: None,
effective_severity: None,
reachability_caveats: Vec::new(),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnlistedDependencyFinding {
#[serde(flatten)]
pub dep: UnlistedDependency,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnlistedDependencyFinding {
#[must_use]
pub fn with_actions(dep: UnlistedDependency) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::InstallDependency,
auto_fixable: false,
description: "Add this package to dependencies in package.json".to_string(),
note: Some(
"Verify this package should be a direct dependency before adding".to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
build_ignore_dependencies_suppress_action(&dep.package_name, "unlisted-dependency"),
];
Self {
finding_id: None,
dep,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnlistedBinaryFinding {
#[serde(flatten)]
pub binary: UnlistedBinary,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnlistedBinaryFinding {
#[must_use]
pub fn with_actions(binary: UnlistedBinary) -> Self {
let name = &binary.binary_name;
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::InstallDependency,
auto_fixable: false,
description: "Add the package that provides this binary to devDependencies"
.to_string(),
note: Some(
"If the operating system or the CI image provides this binary, add it to ignoreBinaries instead"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
IssueAction::AddToConfig(AddToConfigAction {
kind: AddToConfigKind::AddToConfig,
auto_fixable: false,
description: format!("Add \"{name}\" to ignoreBinaries in fallow config"),
config_key: "ignoreBinaries".to_string(),
value: AddToConfigValue::Scalar(name.clone()),
value_schema: Some(
"https://raw.githubusercontent.com/fallow-rs/fallow/main/schema.json#/properties/ignoreBinaries/items"
.to_string(),
),
}),
];
Self {
finding_id: None,
binary,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct TypeOnlyDependencyFinding {
#[serde(flatten)]
pub dep: TypeOnlyDependency,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl TypeOnlyDependencyFinding {
#[must_use]
pub fn with_actions(dep: TypeOnlyDependency) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::MoveToDev,
auto_fixable: false,
description: "Move to devDependencies (only type imports are used)".to_string(),
note: Some(
"Type imports are erased at runtime so this dependency is not needed in production"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
build_ignore_dependencies_suppress_action(&dep.package_name, "type-only-dependency"),
];
Self {
finding_id: None,
dep,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct TestOnlyDependencyFinding {
#[serde(flatten)]
pub dep: TestOnlyDependency,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl TestOnlyDependencyFinding {
#[must_use]
pub fn with_actions(dep: TestOnlyDependency) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::MoveToDev,
auto_fixable: false,
description: "Move to devDependencies (only test files import this)".to_string(),
note: Some(
"Only test files import this package so it does not need to be a production dependency"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
build_ignore_dependencies_suppress_action(&dep.package_name, "test-only-dependency"),
];
Self {
finding_id: None,
dep,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct DevDependencyInProductionFinding {
#[serde(flatten)]
pub dep: DevDependencyInProduction,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl DevDependencyInProductionFinding {
#[must_use]
pub fn with_actions(dep: DevDependencyInProduction) -> Self {
let actions = vec![
IssueAction::Fix(FixAction {
kind: FixActionType::MoveToProd,
auto_fixable: false,
description:
"Move to dependencies if the deployment installs them (production code imports this)"
.to_string(),
note: Some(
"A production-only install (`pnpm install --prod`) omits devDependencies, so an import resolved at runtime breaks. A build that inlines the package into its output resolves nothing at runtime, and moving it there can instead make the deployment require an install it did not need"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}),
build_ignore_dependencies_suppress_action(
&dep.package_name,
"dev-dependency-in-production",
),
];
Self {
finding_id: None,
dep,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct DuplicateExportFinding {
#[serde(flatten)]
pub export: DuplicateExport,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl DuplicateExportFinding {
#[must_use]
pub fn with_actions(export: DuplicateExport) -> Self {
let mut actions: Vec<IssueAction> = Vec::with_capacity(3);
if let Some(rules) = build_duplicate_exports_ignore_rules(&export) {
actions.push(IssueAction::AddToConfig(AddToConfigAction {
kind: AddToConfigKind::AddToConfig,
auto_fixable: false,
description: "Add an ignoreExports rule so these files are excluded from duplicate-export grouping (use when this duplication is an intentional namespace-barrel API).".to_string(),
config_key: "ignoreExports".to_string(),
value: AddToConfigValue::ExportsRules(rules),
value_schema: Some(IGNORE_EXPORTS_VALUE_SCHEMA.to_string()),
}));
}
actions.push(IssueAction::Fix(FixAction {
kind: FixActionType::RemoveDuplicate,
auto_fixable: false,
description: "Keep one canonical export location and remove the others".to_string(),
note: Some(NAMESPACE_BARREL_HINT.to_string()),
available_in_catalogs: None,
suggested_target: None,
}));
actions.push(IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with an inline comment above the line".to_string(),
comment: "// fallow-ignore-next-line duplicate-export".to_string(),
scope: Some(SuppressLineScope::PerLocation),
}));
Self {
finding_id: None,
export,
actions,
introduced: None,
effective_severity: None,
}
}
pub fn set_config_fixable(&mut self, fixable: bool) {
if let Some(IssueAction::AddToConfig(action)) = self.actions.first_mut() {
action.auto_fixable = fixable;
}
}
}
fn build_duplicate_exports_ignore_rules(
export: &DuplicateExport,
) -> Option<Vec<IgnoreExportsRule>> {
let mut entries: Vec<IgnoreExportsRule> = Vec::with_capacity(export.locations.len());
for loc in &export.locations {
let path = loc.path.to_string_lossy().replace('\\', "/");
if path.is_empty() {
continue;
}
if entries.iter().any(|existing| existing.file == path) {
continue;
}
entries.push(IgnoreExportsRule {
file: path,
exports: vec!["*".to_string()],
});
}
if entries.is_empty() {
None
} else {
Some(entries)
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedCatalogEntryFinding {
#[serde(flatten)]
pub entry: UnusedCatalogEntry,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnusedCatalogEntryFinding {
#[must_use]
pub fn with_actions(entry: UnusedCatalogEntry) -> Self {
let is_pnpm_source = is_pnpm_catalog_source(&entry.path);
let auto_fixable = entry.hardcoded_consumers.is_empty() && is_pnpm_source;
let note = if is_pnpm_source {
Some(
"If any consumer declares the same package with a hardcoded version, switch the consumer to `catalog:` before removing"
.to_string(),
)
} else {
Some(
"fallow fix only edits pnpm-workspace.yaml catalog entries. Edit Bun package.json catalogs manually."
.to_string(),
)
};
let mut actions = vec![IssueAction::Fix(FixAction {
kind: FixActionType::RemoveCatalogEntry,
auto_fixable,
description: if is_pnpm_source {
"Remove the entry from pnpm-workspace.yaml".to_string()
} else {
"Remove the entry from the catalog source file manually".to_string()
},
note,
available_in_catalogs: None,
suggested_target: None,
})];
if is_pnpm_source {
actions.push(IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with a YAML comment above the line".to_string(),
comment: "# fallow-ignore-next-line unused-catalog-entry".to_string(),
scope: None,
}));
}
Self {
finding_id: None,
entry,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct EmptyCatalogGroupFinding {
#[serde(flatten)]
pub group: EmptyCatalogGroup,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl EmptyCatalogGroupFinding {
#[must_use]
pub fn with_actions(group: EmptyCatalogGroup) -> Self {
let auto_fixable = is_pnpm_catalog_source(&group.path);
let mut actions = vec![IssueAction::Fix(FixAction {
kind: FixActionType::RemoveEmptyCatalogGroup,
auto_fixable,
description: if auto_fixable {
"Remove the empty named catalog group from pnpm-workspace.yaml".to_string()
} else {
"Remove the empty named catalog group from the catalog source file manually"
.to_string()
},
note: Some(if auto_fixable {
"Only named groups under `catalogs:` are flagged; the top-level `catalog:` hook is intentionally ignored"
.to_string()
} else {
"fallow fix only edits pnpm-workspace.yaml catalog groups. Edit Bun package.json catalogs manually."
.to_string()
}),
available_in_catalogs: None,
suggested_target: None,
})];
if auto_fixable {
actions.push(IssueAction::SuppressLine(SuppressLineAction {
kind: SuppressLineKind::SuppressLine,
auto_fixable: false,
description: "Suppress with a YAML comment above the line".to_string(),
comment: "# fallow-ignore-next-line empty-catalog-group".to_string(),
scope: None,
}));
}
Self {
finding_id: None,
group,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnresolvedCatalogReferenceFinding {
#[serde(flatten)]
pub reference: UnresolvedCatalogReference,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnresolvedCatalogReferenceFinding {
#[must_use]
pub fn with_actions(reference: UnresolvedCatalogReference) -> Self {
let consumer_path = reference.path.to_string_lossy().replace('\\', "/");
let primary = catalog_reference_primary_action(&reference);
let fallback = remove_catalog_reference_action();
let suppress = suppress_catalog_reference_action(&reference, consumer_path);
Self {
finding_id: None,
reference,
actions: vec![primary, fallback, suppress],
introduced: None,
effective_severity: None,
}
}
}
fn catalog_reference_primary_action(reference: &UnresolvedCatalogReference) -> IssueAction {
if reference.available_in_catalogs.is_empty() {
return IssueAction::Fix(FixAction {
kind: FixActionType::AddCatalogEntry,
auto_fixable: false,
description: format!(
"Add `{}` to the `{}` catalog in pnpm-workspace.yaml",
reference.entry_name, reference.catalog_name
),
note: Some(
"Pin a version that satisfies the consumer's import; no other catalog declares this package today"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
});
}
let available = reference.available_in_catalogs.clone();
let suggested_target = (available.len() == 1).then(|| available[0].clone());
IssueAction::Fix(FixAction {
kind: FixActionType::UpdateCatalogReference,
auto_fixable: false,
description: format!(
"Switch the reference from `catalog:{}` to a catalog that declares `{}`",
reference.catalog_name, reference.entry_name
),
note: None,
available_in_catalogs: Some(available),
suggested_target,
})
}
fn remove_catalog_reference_action() -> IssueAction {
IssueAction::Fix(FixAction {
kind: FixActionType::RemoveCatalogReference,
auto_fixable: false,
description: "Remove the catalog reference and pin a hardcoded version in its place"
.to_string(),
note: Some(
"Use only when neither another catalog declares the package nor the named catalog should grow to include it"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
})
}
fn suppress_catalog_reference_action(
reference: &UnresolvedCatalogReference,
consumer_path: String,
) -> IssueAction {
let mut suppress_value = serde_json::Map::new();
suppress_value.insert(
"package".to_string(),
serde_json::Value::String(reference.entry_name.clone()),
);
suppress_value.insert(
"catalog".to_string(),
serde_json::Value::String(reference.catalog_name.clone()),
);
suppress_value.insert(
"consumer".to_string(),
serde_json::Value::String(consumer_path),
);
IssueAction::AddToConfig(AddToConfigAction {
kind: AddToConfigKind::AddToConfig,
auto_fixable: false,
description: "Suppress this reference via ignoreCatalogReferences in fallow config (use when the catalog edit is intentionally landing in a separate PR or the package is a placeholder).".to_string(),
config_key: "ignoreCatalogReferences".to_string(),
value: AddToConfigValue::RuleObject(suppress_value),
value_schema: Some(IGNORE_CATALOG_REFERENCES_VALUE_SCHEMA.to_string()),
})
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UnusedDependencyOverrideFinding {
#[serde(flatten)]
pub entry: UnusedDependencyOverride,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl UnusedDependencyOverrideFinding {
#[must_use]
pub fn with_actions(entry: UnusedDependencyOverride) -> Self {
let mut actions: Vec<IssueAction> = Vec::with_capacity(2);
actions.push(IssueAction::Fix(FixAction {
kind: FixActionType::RemoveDependencyOverride,
auto_fixable: false,
description: "Remove the package-manager override entry from its declaration source"
.to_string(),
note: Some(
"Conservative static check; verify against the active package manager's frozen-lockfile install before removing in case the override targets a transitive dependency (CVE-fix pattern)"
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}));
if let Some(suppress) = build_ignore_dependency_overrides_suppress(
Some(&entry.target_package),
&entry.raw_key,
entry.source,
) {
actions.push(suppress);
}
Self {
finding_id: None,
entry,
actions,
introduced: None,
effective_severity: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct MisconfiguredDependencyOverrideFinding {
#[serde(flatten)]
pub entry: MisconfiguredDependencyOverride,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finding_id: Option<String>,
pub actions: Vec<IssueAction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub introduced: Option<AuditIntroduced>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_effective_severity"
)]
pub effective_severity: Option<EffectiveSeverity>,
}
impl MisconfiguredDependencyOverrideFinding {
#[must_use]
pub fn with_actions(entry: MisconfiguredDependencyOverride) -> Self {
let mut actions: Vec<IssueAction> = Vec::with_capacity(2);
actions.push(IssueAction::Fix(FixAction {
kind: FixActionType::FixDependencyOverride,
auto_fixable: false,
description:
"Fix the package-manager override key or value: invalid entries are rejected or ignored"
.to_string(),
note: Some(
"Common shapes: bare `pkg`, scoped `@scope/pkg`, version-selector `pkg@<2`, parent-chain `parent>child`. Valid values include semver ranges, `-` (removal), `$ref` (self-ref), and `npm:alias@^1`."
.to_string(),
),
available_in_catalogs: None,
suggested_target: None,
}));
if let Some(suppress) = build_ignore_dependency_overrides_suppress(
entry.target_package.as_deref(),
&entry.raw_key,
entry.source,
) {
actions.push(suppress);
}
Self {
finding_id: None,
entry,
actions,
introduced: None,
effective_severity: None,
}
}
}
fn build_ignore_dependency_overrides_suppress(
target_package: Option<&str>,
raw_key: &str,
source: DependencyOverrideSource,
) -> Option<IssueAction> {
let package = target_package
.filter(|s| !s.is_empty())
.or_else(|| Some(raw_key).filter(|s| !s.is_empty()))?
.to_string();
let mut value = serde_json::Map::new();
value.insert("package".to_string(), serde_json::Value::String(package));
value.insert(
"source".to_string(),
serde_json::Value::String(source.as_label().to_string()),
);
Some(IssueAction::AddToConfig(AddToConfigAction {
kind: AddToConfigKind::AddToConfig,
auto_fixable: false,
description: "Suppress this override finding via ignoreDependencyOverrides in fallow config (use for CVE-fix overrides that target a purely-transitive package).".to_string(),
config_key: "ignoreDependencyOverrides".to_string(),
value: AddToConfigValue::RuleObject(value),
value_schema: Some(IGNORE_DEPENDENCY_OVERRIDES_VALUE_SCHEMA.to_string()),
}))
}
impl_caveated_finding!(
UnusedFileFinding,
UnusedExportFinding,
UnusedTypeFinding,
UnusedEnumMemberFinding,
UnusedClassMemberFinding,
UnusedNamespaceMemberFinding,
UnusedStoreMemberFinding,
UnusedDependencyFinding,
UnusedDevDependencyFinding,
UnusedOptionalDependencyFinding,
);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[serde(rename_all = "lowercase")]
pub enum EffectiveSeverity {
Error,
Warn,
}
pub fn deserialize_effective_severity<'de, D>(
deserializer: D,
) -> Result<Option<EffectiveSeverity>, D::Error>
where
D: serde::Deserializer<'de>,
{
#[derive(Deserialize)]
#[serde(untagged)]
enum Tolerant {
Known(EffectiveSeverity),
Unknown(serde::de::IgnoredAny),
}
Ok(match Option::<Tolerant>::deserialize(deserializer)? {
Some(Tolerant::Known(severity)) => Some(severity),
Some(Tolerant::Unknown(_)) | None => None,
})
}
pub trait GatedFinding {
fn effective_severity(&self) -> Option<EffectiveSeverity>;
fn set_effective_severity(&mut self, severity: Option<EffectiveSeverity>);
}
macro_rules! impl_gated_finding {
($($finding:ty),+ $(,)?) => {
$(
impl GatedFinding for $finding {
fn effective_severity(&self) -> Option<EffectiveSeverity> {
self.effective_severity
}
fn set_effective_severity(&mut self, severity: Option<EffectiveSeverity>) {
self.effective_severity = severity;
}
}
)+
};
}
impl_gated_finding!(
UnusedFileFinding,
PrivateTypeLeakFinding,
DeprecatedExportInUseFinding,
UnresolvedImportFinding,
CircularDependencyFinding,
ReExportCycleFinding,
PackageCycleFinding,
BoundaryViolationFinding,
BoundaryCoverageViolationFinding,
BoundaryCallViolationFinding,
UnusedExportFinding,
UnusedTypeFinding,
InvalidClientExportFinding,
MixedClientServerBarrelFinding,
MisplacedDirectiveFinding,
UnprovidedInjectFinding,
UnusedServerActionFinding,
UnusedLoadDataKeyFinding,
UnrenderedComponentFinding,
UnusedComponentPropFinding,
AbsentComponentPropFinding,
UnusedComponentEmitFinding,
UnusedSvelteEventFinding,
UnusedEffectLayerFinding,
UnusedTaggedErrorFinding,
UnproducedCatchTagFinding,
UnusedComponentInputFinding,
UnusedComponentOutputFinding,
RouteCollisionFinding,
DynamicSegmentNameConflictFinding,
UnusedEnumMemberFinding,
UnusedClassMemberFinding,
UnusedNamespaceMemberFinding,
UnusedStoreMemberFinding,
UnusedDependencyFinding,
UnusedDevDependencyFinding,
UnusedOptionalDependencyFinding,
UnlistedDependencyFinding,
UnlistedBinaryFinding,
TypeOnlyDependencyFinding,
TestOnlyDependencyFinding,
DevDependencyInProductionFinding,
DuplicateExportFinding,
DuplicateExportAliasFinding,
UnusedCatalogEntryFinding,
EmptyCatalogGroupFinding,
UnresolvedCatalogReferenceFinding,
UnusedDependencyOverrideFinding,
MisconfiguredDependencyOverrideFinding,
PropDrillingChainFinding,
ThinWrapperFinding,
DuplicatePropShapeFinding,
crate::results::StaleSuppression,
);
#[cfg(test)]
#[path = "output_dead_code_caveat_tokens.rs"]
mod caveat_tokens;
#[cfg(test)]
#[path = "output_dead_code_mutation_gate.rs"]
mod mutation_gate;
#[cfg(test)]
#[path = "output_dead_code_position_0_invariants.rs"]
mod position_0_invariants;