Skip to content

Commit

Permalink
feat: warn user when unused features are defined
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben-arts committed Feb 2, 2024
1 parent 7599763 commit 850e609
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/project/manifest/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@ impl ProjectManifest {
}
}

// Check if all features are used in environments, warn if not.
let mut features_used = HashSet::new();
for env in self.environments.values() {
for feature in env.features.iter() {
features_used.insert(feature);
}
}
for (name, _feature) in self.features.iter() {
if name != &FeatureName::Default && !features_used.contains(&name.to_string()) {
tracing::warn!(
"The feature '{}' is defined but not used in any environment",
console::style(name).bold().blue()
);
}
}

// parse the SPDX license expression to make sure that it is a valid expression.
if let Some(spdx_expr) = &self.project.license {
spdx::Expression::parse(spdx_expr)
Expand Down

0 comments on commit 850e609

Please sign in to comment.