Skip to content

Commit

Permalink
Fix: Only consider fragment files
Browse files Browse the repository at this point in the history
The previous implementation did consider non-changelog-fragment-files as
well, which is not what we want here.

Signed-off-by: Matthias Beyer <[email protected]>
  • Loading branch information
matthiasbeyer committed Jun 18, 2023
1 parent 65bdab4 commit 0934f16
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/command/verify_metadata_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,23 @@ impl crate::command::Command for VerifyMetadataCommand {
Ok(de) => de.path().is_file().then(|| de.path().to_path_buf()).map(Ok),
Err(e) => Some(Err(e)),
})
.map(|rde| -> Result<_, Error> {
let de = rde.map_err(VerificationError::from)?;
.filter_map(|rde| {
let de = match rde {
Err(e) => return Some(Err(Error::from(VerificationError::from(e)))),
Ok(de) => de,
};
let path = de.as_path();
log::trace!("Looking at {}", path.display());

if crate::command::common::get_version_from_path(path)
.map_err(VerificationError::from)?
.is_none()
{
log::warn!("No version: {}", path.display());
match crate::command::common::get_version_from_path(path).map_err(VerificationError::from) {
Err(e) => return Some(Err(Error::from(e))),
Ok(None) => return None,
Ok(_some) => {
// nothing
}
}

std::fs::OpenOptions::new()
let res = std::fs::OpenOptions::new()
.read(true)
.create(false)
.write(false)
Expand All @@ -58,7 +62,9 @@ impl crate::command::Command for VerifyMetadataCommand {
multiple: errors,
})
})
.map_err(|ve| Error::Verification(ve))
.map_err(|ve| Error::Verification(ve));

Some(res)
})
.partition_result();

Expand Down

0 comments on commit 0934f16

Please sign in to comment.