Skip to main content

apply_dead_code_baseline

Function apply_dead_code_baseline 

Source
pub fn apply_dead_code_baseline(
    results: &mut AnalysisResults,
    content: &str,
    root: &Path,
    identity: &SemanticAnalysisIdentity,
    change_scoped: bool,
) -> Result<DeadCodeBaselineOutcome, DeadCodeBaselineError>
Expand description

Apply a dead-code baseline to a result.

The CLI (--baseline) and the programmatic API read a baseline through this one function, so a baseline hides the same findings on every surface. content is the text of the baseline file. change_scoped is true when the run analyzed only part of the project; see BaselineStaleness.

The file kind is read before the strict parse. Several fields of the dead-code format have no default, so another command’s baseline would fail the parse before anything could name its writer.

§Errors

Returns DeadCodeBaselineError when the file is not valid JSON, is a broken dead-code baseline, or was saved with an incompatible analysis identity.