Skip to content

Commit

Permalink
cleaned up function as a whole
Browse files Browse the repository at this point in the history
Signed-off-by: Amndeep Singh Mann <[email protected]>
  • Loading branch information
Amndeep7 committed Feb 11, 2025
1 parent b771f8f commit 7783c66
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions libs/hdf-converters/src/utils/attestations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,25 @@ function attestationCanBeAdded(
attestation: Attestation,
control: ExecJSON.Control
) {
if (attestation.control_id.toLowerCase() === control.id.toLowerCase()) {
if (control.results.length === 0) {
// There are no results for this control. It may be part of an overlay file.
return false;
} else if (control.results[0].status === 'skipped') {
return true;
} else {
console.error(
'Invalid control selected: Control must have "skipped" status to be attested'
);
return false;
}
} else {
if (attestation.control_id.toLowerCase() !== control.id.toLowerCase()) {
// Cannot be added if it's not the same control.
return false;
}

if (control.results.length === 0) {
// There are no results for this control. It may be part of an overlay file.
return false;
}

if (control.results[0].status === 'skipped') {
// Can be added if it's a control that's marked as 'skipped', which means it needs Manual Review.
return true;
}

console.error(
'Invalid control selected: Control must have "skipped" status to be attested'
);
return false;
}

function getFirstPath(
Expand Down

0 comments on commit 7783c66

Please sign in to comment.