⚙️ 🧹 Clean up smells and security hotspot, set up code coverage #63

Merged
alexis.drai merged 1 commits from implement-logging into master 2 years ago

@ -42,6 +42,13 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell shell: powershell
run: | run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"draialexis_cat_cafe" /o:"draialexis" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" .\.sonar\scanner\dotnet-sonarscanner begin
/k:"draialexis_cat_cafe"
/o:"draialexis"
/d:sonar.login="${{ secrets.SONAR_TOKEN }}"
/d:sonar.host.url="https://sonarcloud.io"
/d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
dotnet build cat_cafe\cat_cafe.sln dotnet build cat_cafe\cat_cafe.sln
dotnet build --no-incremental
dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

@ -123,10 +123,5 @@ namespace cat_cafe.Controllers
return NoContent(); return NoContent();
} }
private bool CatExists(long id)
{
return _context.Cats.Any(e => e.Id == id);
}
} }
} }

@ -129,10 +129,5 @@ namespace cat_cafe.Controllers
return Ok(); return Ok();
} }
private bool CustomerExists(long id)
{
return _context.Customers.Any(e => e.Id == id);
}
} }
} }

@ -6,7 +6,7 @@ namespace cat_cafe.Dto
{ {
public long Id { get; set; } public long Id { get; set; }
[Required] [Required]
public string FullName { get; set; } public string FullName { get; set; } = "";
[Required] [Required]
public int Age { get; set; } = 0; public int Age { get; set; } = 0;
} }

@ -10,6 +10,6 @@ namespace cat_cafe.Entities
public int Age { get; set; } = 0; public int Age { get; set; } = 0;
public long? BarId { get; set; } public long? BarId { get; set; }
public Bar? Bar { get; set; } public Bar? Bar { get; set; }
public string Meow() { return "meow"; } public static string Meow { get; set; } = "meow";
} }
} }

@ -6,8 +6,6 @@ using System.Net.WebSockets;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
Log.Logger = new LoggerConfiguration().MinimumLevel.Information().WriteTo.File("log.txt").CreateLogger();
List<WebSocket> _sockets = new(); List<WebSocket> _sockets = new();
// Add services to the container. // Add services to the container.

Loading…
Cancel
Save