Skip to content

Commit fe385cf

Browse files
committed
fix sonar issues
1 parent 5e8677c commit fe385cf

File tree

9 files changed

+35
-43
lines changed

9 files changed

+35
-43
lines changed

libraries/tests/e2e/functions/core/logging/AOT-Function/src/AOT-Function/Function.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace AOT_Function;
1010

11-
public class Function
11+
public static class Function
1212
{
1313
private static async Task Main()
1414
{

libraries/tests/e2e/functions/core/metrics/AOT-Function/src/AOT-Function/Function.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
namespace AOT_Function;
99

10-
public class Function
10+
public static class Function
1111
{
12-
private static Dictionary<string, string> _defaultDimensions = new()
12+
private static readonly Dictionary<string, string> DefaultDimensions = new()
1313
{
1414
{"Environment", "Prod"},
1515
{"Another", "One"}
@@ -27,7 +27,7 @@ await LambdaBootstrapBuilder.Create(handler,
2727
[Metrics(Namespace = "Test", Service = "Test", CaptureColdStart = true)]
2828
public static APIGatewayProxyResponse FunctionHandler(APIGatewayProxyRequest apigwProxyEvent, ILambdaContext context)
2929
{
30-
Metrics.SetDefaultDimensions(_defaultDimensions);
30+
Metrics.SetDefaultDimensions(DefaultDimensions);
3131
Metrics.AddMetric("Invocation", 1, MetricUnit.Count);
3232

3333
Metrics.AddDimension("Memory","MemoryLimitInMB");

libraries/tests/e2e/functions/core/tracing/AOT-Function/src/AOT-Function/Function.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace AOT_Function;
1010

11-
public class Function
11+
public static class Function
1212
{
1313
private static async Task Main()
1414
{
@@ -69,11 +69,13 @@ private static void NestedBusinessLogic1()
6969
}
7070
private static void NestedBusinessLogic2()
7171
{
72+
// Some business logic
7273
}
7374

7475
[Tracing(CaptureMode = TracingCaptureMode.Disabled)]
7576
private static void NestedBusinessLogic3()
7677
{
78+
// Some business logic
7779
}
7880

7981
}

libraries/tests/e2e/functions/core/tracing/Function/src/Function/Function.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ private void NestedBusinessLogic1()
5858
[Tracing(CaptureMode = TracingCaptureMode.Disabled)]
5959
private void NestedBusinessLogic2()
6060
{
61+
// Some business logic
6162
}
6263

6364
class MetadataObject

libraries/tests/e2e/infra-aot/CoreAotStack.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ internal CoreAotStack(Construct scope, string id, IStackProps props = null) : ba
1717

1818
private void CreateFunctionConstructs(string utility)
1919
{
20-
string baseAotPath = $"../functions/core/{utility}/AOT-Function/src/AOT-Function";
21-
string distAotPath = $"../functions/core/{utility}/AOT-Function/dist";
20+
var baseAotPath = $"../functions/core/{utility}/AOT-Function/src/AOT-Function";
21+
var distAotPath = $"../functions/core/{utility}/AOT-Function/dist";
2222

23-
if (RuntimeInformation.OSArchitecture == System.Runtime.InteropServices.Architecture.Arm64)
23+
switch (RuntimeInformation.OSArchitecture)
2424
{
25-
CreateFunctionConstruct(this, $"{utility}_ARM_aot_net8", Runtime.DOTNET_8, Architecture.ARM_64, $"E2ETestLambda_ARM_AOT_NET8_{utility}", baseAotPath, distAotPath);
26-
}
27-
28-
if (RuntimeInformation.OSArchitecture == System.Runtime.InteropServices.Architecture.X64)
29-
{
30-
CreateFunctionConstruct(this, $"{utility}_X64_aot_net8", Runtime.DOTNET_8, Architecture.X86_64, $"E2ETestLambda_X64_AOT_NET8_{utility}", baseAotPath, distAotPath);
25+
case System.Runtime.InteropServices.Architecture.Arm64:
26+
CreateFunctionConstruct(this, $"{utility}_ARM_aot_net8", Runtime.DOTNET_8, Architecture.ARM_64, $"E2ETestLambda_ARM_AOT_NET8_{utility}", baseAotPath, distAotPath);
27+
break;
28+
case System.Runtime.InteropServices.Architecture.X64:
29+
CreateFunctionConstruct(this, $"{utility}_X64_aot_net8", Runtime.DOTNET_8, Architecture.X86_64, $"E2ETestLambda_X64_AOT_NET8_{utility}", baseAotPath, distAotPath);
30+
break;
3131
}
3232
}
3333

3434
private void CreateFunctionConstruct(Construct scope, string id, Runtime runtime, Architecture architecture, string name, string sourcePath, string distPath)
3535
{
36-
new FunctionConstruct(scope, id, new FunctionConstructProps
36+
_ = new FunctionConstruct(scope, id, new FunctionConstructProps
3737
{
3838
Runtime = runtime,
3939
Architecture = architecture,

libraries/tests/e2e/infra-aot/InfraAotStack.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

libraries/tests/e2e/infra-aot/Program.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
using Amazon.CDK;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.Linq;
52

63
namespace InfraAot
74
{
8-
sealed class Program
5+
internal sealed class Program
96
{
107
public static void Main(string[] args)
118
{
129
var app = new App();
13-
new CoreAotStack(app, "CoreAotStack", new StackProps { });
10+
_ = new CoreAotStack(app, "CoreAotStack", new StackProps { });
1411
app.Synth();
1512
}
1613
}

libraries/tests/e2e/infra/CoreStack.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,23 @@ internal CoreStack(Construct scope, string id, IStackProps props = null) : base(
1616

1717
private void CreateFunctionConstructs(string utility)
1818
{
19-
string basePath = $"../functions/core/{utility}/Function/src/Function";
20-
string distPath = $"../functions/core/{utility}/Function/dist";
19+
var basePath = $"../functions/core/{utility}/Function/src/Function";
20+
var distPath = $"../functions/core/{utility}/Function/dist";
2121

22-
CreateFunctionConstruct(this, $"{utility}_X64_net8", Runtime.DOTNET_8, Architecture.X86_64, $"E2ETestLambda_X64_NET8_{utility}", basePath, distPath);
23-
CreateFunctionConstruct(this, $"{utility}_arm_net8", Runtime.DOTNET_8, Architecture.ARM_64, $"E2ETestLambda_ARM_NET8_{utility}", basePath, distPath);
24-
CreateFunctionConstruct(this, $"{utility}_X64_net6", Runtime.DOTNET_6, Architecture.X86_64, $"E2ETestLambda_X64_NET6_{utility}", basePath, distPath);
25-
CreateFunctionConstruct(this, $"{utility}_arm_net6", Runtime.DOTNET_6, Architecture.ARM_64, $"E2ETestLambda_ARM_NET6_{utility}", basePath, distPath);
22+
CreateFunctionConstruct(this, $"{utility}_X64_net8", Runtime.DOTNET_8, Architecture.X86_64,
23+
$"E2ETestLambda_X64_NET8_{utility}", basePath, distPath);
24+
CreateFunctionConstruct(this, $"{utility}_arm_net8", Runtime.DOTNET_8, Architecture.ARM_64,
25+
$"E2ETestLambda_ARM_NET8_{utility}", basePath, distPath);
26+
CreateFunctionConstruct(this, $"{utility}_X64_net6", Runtime.DOTNET_6, Architecture.X86_64,
27+
$"E2ETestLambda_X64_NET6_{utility}", basePath, distPath);
28+
CreateFunctionConstruct(this, $"{utility}_arm_net6", Runtime.DOTNET_6, Architecture.ARM_64,
29+
$"E2ETestLambda_ARM_NET6_{utility}", basePath, distPath);
2630
}
2731

28-
private void CreateFunctionConstruct(Construct scope, string id, Runtime runtime, Architecture architecture, string name, string sourcePath, string distPath)
32+
private void CreateFunctionConstruct(Construct scope, string id, Runtime runtime, Architecture architecture,
33+
string name, string sourcePath, string distPath)
2934
{
30-
new FunctionConstruct(scope, id, new FunctionConstructProps
35+
_ = new FunctionConstruct(scope, id, new FunctionConstructProps
3136
{
3237
Runtime = runtime,
3338
Architecture = architecture,

libraries/tests/e2e/infra/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
namespace Infra
44
{
5-
sealed class Program
5+
internal sealed class Program
66
{
77
public static void Main(string[] args)
88
{
99
var app = new App();
1010

11-
new CoreStack(app, "CoreStack", new StackProps { });
11+
_ = new CoreStack(app, "CoreStack", new StackProps { });
1212

1313
app.Synth();
1414
}

0 commit comments

Comments
 (0)