Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/+residual-spacing.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The `package plan` residuals for an inferred moduleclass and for a dropped build requirement, and the source finding for a tree that declares no version, read as one sentence instead of carrying a run of spaces where the source line was wrapped.
8 changes: 7 additions & 1 deletion src/artifact_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ pub fn verify_declared_version(
let mut findings = Vec::new();
let Some(declared) = declared else {
findings.push(SourceFinding::warning(
"no build system in the source tree declares a version, so the recipe version is unverified against what the code reports"
"no build system in the source tree declares a version, so the recipe version \
is unverified against what the code reports"
.into(),
));
return findings;
Expand Down Expand Up @@ -670,6 +671,11 @@ mod declared_version_tests {
let findings = verify_declared_version("1.0.0", None);
assert_eq!(findings.len(), 1);
assert_eq!(findings[0].level, FindingLevel::Warning);
assert_eq!(
findings[0].message,
"no build system in the source tree declares a version, so the recipe version \
is unverified against what the code reports"
);
}

/// The real case: a snapshot named after the last release tag while the
Expand Down
47 changes: 45 additions & 2 deletions src/package_workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,8 @@ fn drop_unavailable_build_requirements(
category: "build-requirement".into(),
severity: ResidualSeverity::Judgment,
summary: format!(
"{name} is a stated build requirement and this tree carries no module for it, so the recipe does not name it"
"{name} is a stated build requirement and this tree carries no module for it, \
so the recipe does not name it"
),
evidence: None,
provenance: None,
Expand Down Expand Up @@ -581,7 +582,8 @@ fn note_inferred_moduleclass(plan: &mut PackagePlan) {
category: "moduleclass".into(),
severity: ResidualSeverity::Judgment,
summary: format!(
"moduleclass {moduleclass} is inferred from the package's own classifiers; this tree carries no other recipe for {} to take it from",
"moduleclass {moduleclass} is inferred from the package's own classifiers; \
this tree carries no other recipe for {} to take it from",
plan.package.name
),
evidence: None,
Expand Down Expand Up @@ -3103,3 +3105,44 @@ mod portable_path_tests {
assert_eq!(portable_easyconfig_path(""), "");
}
}

#[cfg(test)]
mod residual_text_tests {
use super::{
add_gcccore_binutils, drop_unavailable_build_requirements, inspect_new_package,
note_inferred_moduleclass, ForeignFormat,
};
use crate::domain::Toolchain;
use std::path::Path;

#[test]
fn residual_summaries_read_as_one_sentence() {
let source = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("fixtures/foreign_ingest/pypi_bs4/pypi.json");
let toolchain = Toolchain {
name: "GCCcore".into(),
version: "15.2.0".into(),
};
let (mut plan, _) =
inspect_new_package(&source, Some(ForeignFormat::Pypi), &toolchain, &[])
.expect("inspect the PyPI fixture");
plan.residuals.clear();
note_inferred_moduleclass(&mut plan);
add_gcccore_binutils(&mut plan);
drop_unavailable_build_requirements(&mut plan, &[]);
let summaries: Vec<&str> = plan
.residuals
.iter()
.map(|residual| residual.summary.as_str())
.collect();
assert_eq!(
summaries,
[
"moduleclass tools is inferred from the package's own classifiers; \
this tree carries no other recipe for beautifulsoup4 to take it from",
"binutils is a stated build requirement and this tree carries no module \
for it, so the recipe does not name it",
]
);
}
}
Loading