Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for (const change of Object.values(diff.resources.changes)) {
if (change.changeImpact === cfnDiff.ResourceImpact.MAY_REPLACE) { return false; }
if (change.changeImpact === cfnDiff.ResourceImpact.WILL_REPLACE) { return false; }
}
for (const change of Object.values(diff.parameters.changes)) {
if (change.isUpdate) { return false; }
}
for (const change of Object.values(diff.outputs.changes)) {
if (change.isUpdate) { return false; }
}
return true;
case MatchStyle.SUPERSET:
for (const change of Object.values(diff.resources.changes)) {
if (change.changeImpact !== cfnDiff.ResourceImpact.WILL_CREATE) { return false; }
}
for (const change of Object.values(diff.parameters.changes)) {
if (change.isAddition) { return false; }
}
for (const change of Object.values(diff.outputs.changes)) {
if (change.isAddition || change.isUpdate) { return false; }
}
return true;
}
throw new Error(`Unsupported match style: ${this.matchStyle}`);
}
private isDiffAcceptable(diff: cfnDiff.TemplateDiff): boolean {
switch (this.matchStyle) {
case MatchStyle.EXACT:
return diff.differenceCount === 0;
case MatchStyle.NO_REPLACES:
for (const change of Object.values(diff.resources.changes)) {
if (change.changeImpact === cfnDiff.ResourceImpact.MAY_REPLACE) { return false; }
if (change.changeImpact === cfnDiff.ResourceImpact.WILL_REPLACE) { return false; }
}
for (const change of Object.values(diff.parameters.changes)) {
if (change.isUpdate) { return false; }
}
for (const change of Object.values(diff.outputs.changes)) {
if (change.isUpdate) { return false; }
}
return true;
case MatchStyle.SUPERSET:
for (const change of Object.values(diff.resources.changes)) {
if (change.changeImpact !== cfnDiff.ResourceImpact.WILL_CREATE) { return false; }
}
for (const change of Object.values(diff.parameters.changes)) {
private isDiffAcceptable(diff: cfnDiff.TemplateDiff): boolean {
switch (this.matchStyle) {
case MatchStyle.EXACT:
return diff.differenceCount === 0;
case MatchStyle.NO_REPLACES:
for (const change of Object.values(diff.resources.changes)) {
if (change.changeImpact === cfnDiff.ResourceImpact.MAY_REPLACE) { return false; }
if (change.changeImpact === cfnDiff.ResourceImpact.WILL_REPLACE) { return false; }
}
for (const change of Object.values(diff.parameters.changes)) {
if (change.isUpdate) { return false; }
}
for (const change of Object.values(diff.outputs.changes)) {
if (change.isUpdate) { return false; }
}
return true;
case MatchStyle.SUPERSET:
for (const change of Object.values(diff.resources.changes)) {
if (change.changeImpact !== cfnDiff.ResourceImpact.WILL_CREATE) { return false; }
}