Skip to content

Commit 705390c

Browse files
committed
fix sonar issues
1 parent d40da1f commit 705390c

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

packages/cdkConstructs/src/constructs/PythonLambdaFunction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
Code,
1616
ILayerVersion
1717
} from "aws-cdk-lib/aws-lambda"
18-
import {join} from "path"
18+
import {join} from "node:path"
1919
import {createSharedLambdaResources} from "./lambdaSharedResources"
2020

2121
export interface PythonLambdaFunctionProps {

packages/cdkConstructs/src/utils/helpers.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ export function findCloudFormationResourcesByType(construct: IConstruct, type: s
6767
*/
6868
export function addSuppressions(resources: Array<CfnResource>, rules: Array<string>): void {
6969
resources.forEach(resource => {
70-
if (!resource.cfnOptions.metadata) {
71-
resource.cfnOptions.metadata = {}
72-
}
70+
resource.cfnOptions.metadata ??= {}
7371
const existing = resource.cfnOptions.metadata.guard?.SuppressedRules || []
7472
const combined = Array.from(new Set([...existing, ...rules]))
7573
resource.cfnOptions.metadata.guard = {SuppressedRules: combined}

packages/cdkConstructs/tests/utils/helpers.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const defaultSuppressionRules = ["LAMBDA_DLQ_CHECK", "LAMBDA_INSIDE_VPC", "LAMBD
1616
const createResource = (stack: Stack, id: string, type = "Custom::Test", path?: string): CfnResource => {
1717
const resource = new CfnResource(stack, id, {type, properties: {}})
1818
resource.cfnOptions.metadata = {
19-
...(resource.cfnOptions.metadata ?? {}),
19+
...(resource.cfnOptions.metadata),
2020
"aws:cdk:path": path ?? `${stack.stackName}/${id}`
2121
}
2222
return resource

0 commit comments

Comments
 (0)