fallow_engine/unprovable.rs
1//! Finding classes that one run cannot prove.
2//!
3//! Some detectors do not report anything when the run cannot see all of the
4//! code that can disprove a finding. The audit reads
5//! [`unprovable_dead_code_collections`] on the base run: a head finding of a
6//! class that the base could not prove is inherited, not introduced, because
7//! the base did not measure that class.
8
9use fallow_config::{ResolvedConfig, Severity};
10
11/// JSON collection key of the unused-catalog-entries findings.
12const UNUSED_CATALOG_ENTRIES: &str = "unused_catalog_entries";
13
14/// The dead-code collections, by JSON key, that a run over `config` does not
15/// report because it cannot prove their findings.
16///
17/// The catalog analysis skips unused catalog entries on the same predicate,
18/// [`fallow_config::has_missing_workspace_pattern_dirs`]. A collection whose
19/// rule is `off` is not in the list: the run does not report it for a
20/// different reason.
21#[must_use]
22pub fn unprovable_dead_code_collections(config: &ResolvedConfig) -> Vec<&'static str> {
23 let mut collections = Vec::new();
24 if config.rules.unused_catalog_entries != Severity::Off
25 && fallow_config::has_missing_workspace_pattern_dirs(
26 &config.root,
27 &config.workspace_patterns,
28 )
29 {
30 collections.push(UNUSED_CATALOG_ENTRIES);
31 }
32 collections
33}