Skip to content

Commit 30d1eda

Browse files
authored
Merge pull request #135 from samuelzedec/develop
fix: Correções de Issues do SonarCloud
2 parents 7e247ed + 30307eb commit 30d1eda

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

analyze.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ SONAR_BEGIN_ARGS=(
4444
**/appsettings*.json,\
4545
**/Dockerfile*,\
4646
**/Seeders/**,\
47-
**/Schedulers/**,\,
48-
**/Templates/**,\
47+
**/Schedulers/**,\
48+
**/*.html,\
4949
**/Mappings/**"
5050
/d:sonar.coverage.exclusions="\
5151
**/Migrations/**,\

src/Riber.Infrastructure/Services/AI/Models/AiProductService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public sealed class AiProductService(AppDbContext context)
1212
{
1313
public override async Task<ReadOnlyMemory<Product>> FindSimilarAsync(
1414
float[] query,
15-
CancellationToken cancellationToken)
15+
CancellationToken cancellationToken = default)
1616
{
1717
var products = await _table
1818
.AsNoTracking()
@@ -27,6 +27,6 @@ public override async Task<ReadOnlyMemory<Product>> FindSimilarAsync(
2727

2828
public override async Task<ProductEmbeddingsModel?> GetByEntityIdAsync(
2929
Guid entityId,
30-
CancellationToken cancellationToken)
30+
CancellationToken cancellationToken = default)
3131
=> await _table.LastOrDefaultAsync(p => p.ProductId == entityId, cancellationToken);
3232
}

tests/Riber.Infrastructure.Tests/Services/Authentication/PermissionDataServiceTests.cs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
using Riber.Infrastructure.Persistence.Identity;
1111
using Riber.Api.Tests;
1212
using Riber.Api.Tests.Fixtures;
13+
using Riber.Infrastructure.Services.Authentication;
1314

1415
namespace Riber.Infrastructure.Tests.Services.Authentication;
1516

1617
public sealed class PermissionDataServiceTests(
17-
WebAppFixture webAppFixture,
18+
WebAppFixture webAppFixture,
1819
DatabaseFixture databaseFixture)
1920
: IntegrationTestBase(webAppFixture, databaseFixture)
2021
{
@@ -104,7 +105,7 @@ public async Task UpdatePermissionStatusAsync_WhenPermissionExists_ShouldToggleI
104105

105106
// Assert
106107
result.IsSuccess.Should().BeTrue();
107-
108+
108109
var updatedPermission = await context.Set<ApplicationPermission>()
109110
.FirstAsync(p => p.Name == permission.Name);
110111
updatedPermission.IsActive.Should().BeTrue();
@@ -155,8 +156,8 @@ public async Task GetAllWithDescriptionsAsync_WhenCalled_ShouldReturnAllPermissi
155156

156157
#region Helper Methods
157158

158-
private IPermissionDataService CreatePermissionService(AppDbContext context)
159-
=> new Infrastructure.Services.Authentication.PermissionDataService(context, _mockMemoryCache.Object);
159+
private PermissionDataService CreatePermissionService(AppDbContext context)
160+
=> new(context, _mockMemoryCache.Object);
160161

161162
private ApplicationPermission CreatePermission(string name, bool isActive = true)
162163
=> new()
@@ -169,16 +170,18 @@ private ApplicationPermission CreatePermission(string name, bool isActive = true
169170
};
170171

171172
private List<ApplicationPermission> CreatePermissions(int count)
172-
=> Enumerable.Range(1, count)
173-
.Select(i => new ApplicationPermission
174-
{
175-
Id = _faker.Random.UInt(),
176-
Name = $"permission-{i}",
177-
Description = _faker.Random.String2(10),
178-
IsActive = _faker.Random.Bool(),
179-
Category = "test"
180-
})
181-
.ToList();
173+
=>
174+
[
175+
.. Enumerable.Range(1, count)
176+
.Select(i => new ApplicationPermission
177+
{
178+
Id = _faker.Random.UInt(),
179+
Name = $"permission-{i}",
180+
Description = _faker.Random.String2(10),
181+
IsActive = _faker.Random.Bool(),
182+
Category = "test"
183+
})
184+
];
182185

183186
private void SetupCacheMiss()
184187
{

0 commit comments

Comments
 (0)