Fixing SonarCloud integration + fixing CodeSmells - 2
This commit is contained in:
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@@ -44,6 +44,7 @@ jobs:
|
|||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
.\.sonar\scanner\dotnet-sonarscanner begin /k:"csimonapastore_BasicDotnetTemplate" /o:"csimonapastore-github" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
|
.\.sonar\scanner\dotnet-sonarscanner begin /k:"csimonapastore_BasicDotnetTemplate" /o:"csimonapastore-github" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
|
||||||
|
dotnet restore
|
||||||
dotnet build --no-incremental
|
dotnet build --no-incremental
|
||||||
dotnet test --collect "Code Coverage"
|
dotnet test ./MainProject.Tests/MainProject.Tests.csproj --collect "XPlat Code Coverage" --results-directory TestResults/ --logger "trx;LogFileName=unit_test_sonar.trx" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
|
||||||
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
|
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
|||||||
protected readonly IConfiguration _configuration;
|
protected readonly IConfiguration _configuration;
|
||||||
protected readonly AppSettings _appSettings;
|
protected readonly AppSettings _appSettings;
|
||||||
|
|
||||||
public BaseController(
|
protected BaseController(
|
||||||
IConfiguration configuration
|
IConfiguration configuration
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -20,7 +20,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
private BaseResponse CreateResponse(HttpStatusCode status, string message, object? data = null)
|
private static BaseResponse CreateResponse(HttpStatusCode status, string message, object? data = null)
|
||||||
{
|
{
|
||||||
return new BaseResponse()
|
return new BaseResponse()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||||
<PackageReference Include="NLog" Version="5.2.8" />
|
<PackageReference Include="NLog" Version="5.2.8" />
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ namespace BasicDotnetTemplate.MainProject.Models.Api.Response;
|
|||||||
public class BaseResponse
|
public class BaseResponse
|
||||||
{
|
{
|
||||||
public int Status { get; set; }
|
public int Status { get; set; }
|
||||||
public string Message { get; set; }
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
public string? Message { get; set; }
|
||||||
|
|
||||||
public object? Data { get; set; }
|
public object? Data { get; set; }
|
||||||
#nullable disable
|
#nullable disable
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ using System.Reflection;
|
|||||||
|
|
||||||
namespace BasicDotnetTemplate.MainProject;
|
namespace BasicDotnetTemplate.MainProject;
|
||||||
|
|
||||||
public class ReflectionProgram
|
public static class ReflectionProgram
|
||||||
{
|
{
|
||||||
public static MethodInfo LaunchConfiguration()
|
public static MethodInfo LaunchConfiguration()
|
||||||
{
|
{
|
||||||
@@ -25,7 +25,7 @@ public class ReflectionProgram
|
|||||||
initialize = m;
|
initialize = m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return initialize;
|
return initialize!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user