diff --git a/packages/@aws-cdk/cloudformation-diff/lib/diff-template.ts b/packages/@aws-cdk/cloudformation-diff/lib/diff-template.ts index 989f9bcfe8ce3..4335c468be946 100644 --- a/packages/@aws-cdk/cloudformation-diff/lib/diff-template.ts +++ b/packages/@aws-cdk/cloudformation-diff/lib/diff-template.ts @@ -40,8 +40,11 @@ const DIFF_HANDLERS: HandlerRegistry = { * a stack which current state is described by +currentTemplate+ is updated with * the template +newTemplate+. */ -// eslint-disable-next-line max-len -export function diffTemplate(currentTemplate: { [key: string]: any }, newTemplate: { [key: string]: any }, changeSet?: CloudFormation.DescribeChangeSetOutput): types.TemplateDiff { +export function diffTemplate( + currentTemplate: { [key: string]: any }, + newTemplate: { [key: string]: any }, + changeSet?: CloudFormation.DescribeChangeSetOutput +): types.TemplateDiff { const replacements = changeSet ? findResourceReplacements(changeSet): undefined; // Base diff const theDiff = calculateTemplateDiff(currentTemplate, newTemplate, replacements); @@ -97,8 +100,11 @@ function propagatePropertyReplacement(source: types.ResourceDifference, dest: ty } } -// eslint-disable-next-line max-len -function calculateTemplateDiff(currentTemplate: { [key: string]: any }, newTemplate: { [key: string]: any }, replacements?: ResourceReplacements): types.TemplateDiff { +function calculateTemplateDiff( + currentTemplate: { [key: string]: any }, + newTemplate: { [key: string]: any }, + replacements?: ResourceReplacements, +): types.TemplateDiff { const differences: types.ITemplateDiff = {}; const unknown: { [key: string]: types.Difference } = {}; for (const key of unionOf(Object.keys(currentTemplate), Object.keys(newTemplate)).sort()) { @@ -118,14 +124,6 @@ function calculateTemplateDiff(currentTemplate: { [key: string]: any }, newTempl return new types.TemplateDiff(differences); } -/** - * Compare two CloudFormation resources and return semantic differences between them - */ -/*export function diffResource(oldValue: types.Resource, newValue: types.Resource): types.ResourceDifference { - return impl.diffResource(oldValue, newValue); -} -*/ - /** * Replace all references to the given logicalID on the given template, in-place * @@ -214,9 +212,5 @@ function findResourceReplacements(changeSet: CloudFormation.DescribeChangeSetOut }; } - //console.log('----=----=-=-=-=-=-='); - //console.log(JSON.stringify(replacements, undefined, 2)); - //console.log('----=----=-=-=-=-=-='); - return replacements; -} \ No newline at end of file +} diff --git a/packages/aws-cdk/lib/diff.ts b/packages/aws-cdk/lib/diff.ts index 4cdde055a695e..f23e05bd95c49 100644 --- a/packages/aws-cdk/lib/diff.ts +++ b/packages/aws-cdk/lib/diff.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-console */ import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cfnDiff from '@aws-cdk/cloudformation-diff'; import * as cxapi from '@aws-cdk/cx-api'; @@ -77,8 +76,12 @@ export enum RequireApproval { * * Returns true if the changes are prompt-worthy, false otherwise. */ -// eslint-disable-next-line max-len -export function printSecurityDiff(oldTemplate: any, newTemplate: cxapi.CloudFormationStackArtifact, requireApproval: RequireApproval, changeSet?: CloudFormation.DescribeChangeSetOutput): boolean { +export function printSecurityDiff( + oldTemplate: any, + newTemplate: cxapi.CloudFormationStackArtifact, + requireApproval: RequireApproval, + changeSet?: CloudFormation.DescribeChangeSetOutput, +): boolean { const diff = cfnDiff.diffTemplate(oldTemplate, newTemplate.template, changeSet); if (difRequiresApproval(diff, requireApproval)) {