Skip to content

Commit 6658f7c

Browse files
fix linter
1 parent 564261e commit 6658f7c

File tree

5 files changed

+36
-62
lines changed

5 files changed

+36
-62
lines changed

src/EfCore.Ydb/src/Storage/Internal/Mapping/YdbJsonTypeMapping.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ protected YdbJsonTypeMapping(RelationalTypeMappingParameters parameters) : base(
2323
private static readonly MethodInfo GetStringMethod
2424
= typeof(DbDataReader).GetRuntimeMethod(nameof(DbDataReader.GetString), [typeof(int)])!;
2525

26-
private static readonly PropertyInfo Utf8Property
27-
= typeof(Encoding).GetProperty(nameof(Encoding.UTF8))!;
26+
private static readonly PropertyInfo? Utf8Property
27+
= typeof(Encoding).GetProperty(nameof(Encoding.UTF8));
2828

29-
private static readonly MethodInfo EncodingGetBytesMethod
30-
= typeof(Encoding).GetMethod(nameof(Encoding.GetBytes), [typeof(string)])!;
29+
private static readonly MethodInfo? EncodingGetBytesMethod
30+
= typeof(Encoding).GetMethod(nameof(Encoding.GetBytes), [typeof(string)]);
3131

32-
private static readonly ConstructorInfo MemoryStreamConstructor
33-
= typeof(MemoryStream).GetConstructor([typeof(byte[])])!;
32+
private static readonly ConstructorInfo? MemoryStreamConstructor
33+
= typeof(MemoryStream).GetConstructor([typeof(byte[])]);
3434

3535
protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters parameters)
3636
=> new YdbJsonTypeMapping(parameters);
@@ -66,10 +66,10 @@ protected override string GenerateNonNullSqlLiteral(object value)
6666
}
6767

6868
public override Expression CustomizeDataReaderExpression(Expression expression) => Expression.New(
69-
MemoryStreamConstructor,
69+
MemoryStreamConstructor ?? throw new Exception(),
7070
Expression.Call(
71-
Expression.Property(null, Utf8Property),
72-
EncodingGetBytesMethod,
71+
Expression.Property(null, Utf8Property ?? throw new Exception()),
72+
EncodingGetBytesMethod ?? throw new Exception(),
7373
expression)
7474
);
7575
}

src/EfCore.Ydb/src/Utilities/ArrayUtil.cs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,11 @@ namespace EfCore.Ydb.Utilities;
22

33
internal static class ArrayUtil
44
{
5-
internal static readonly bool[][] TrueArrays =
6-
[
7-
[],
8-
[true],
9-
[true, true],
10-
[true, true, true]
11-
];
12-
135
internal static readonly bool[][] FalseArrays =
14-
[
15-
[],
16-
[false],
17-
[false, false],
18-
[false, false, false]
19-
];
6+
{
7+
new bool[] { },
8+
new bool[] { false },
9+
new bool[] { false, false },
10+
new bool[] { false, false, false }
11+
};
2012
}

src/EfCore.Ydb/test/EfCore.Ydb.FunctionalTests/AllTests/Update/UpdatesYdbTest.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,12 @@ public override Task Save_replaced_principal()
132132
base.Save_replaced_principal);
133133

134134
private async Task TestIgnoringBase(
135-
Func<Task> baseTest,
136-
params string[] expectedSql
137-
) => await TestIgnoringBase(_ => baseTest(), false, expectedSql);
135+
Func<Task> baseTest
136+
) => await TestIgnoringBase(_ => baseTest(), false);
138137

139138
private async Task TestIgnoringBase(
140139
Func<bool, Task> baseTest,
141-
bool async,
142-
params string[] expectedSql
140+
bool async
143141
)
144142
{
145143
try
@@ -151,16 +149,16 @@ params string[] expectedSql
151149
// if (expectedSql.Length == 0) throw;
152150
var actual = Fixture.TestSqlLoggerFactory.SqlStatements;
153151

154-
var comms = new StringBuilder();
152+
var commas = new StringBuilder();
155153
foreach (var str in actual)
156154
{
157-
comms
155+
commas
158156
.Append(">>>\n")
159157
.Append(str)
160158
.Append("\n<<<\n");
161159
}
162160

163-
throw new AggregateException(new Exception(comms.ToString()), e);
161+
throw new AggregateException(new Exception(commas.ToString()), e);
164162
}
165163
}
166164
}

src/EfCore.Ydb/test/EfCore.Ydb.FunctionalTests/TestUtilities/YdbTestStore.cs

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,14 @@
88

99
namespace EfCore.Ydb.FunctionalTests.TestUtilities;
1010

11-
public class YdbTestStore : RelationalTestStore
11+
public class YdbTestStore(
12+
string name,
13+
string? scriptPath = null,
14+
string? additionalSql = null,
15+
bool shared = true
16+
) : RelationalTestStore(name, shared, CreateConnection())
1217
{
1318
private const int CommandTimeout = 600;
14-
private readonly string? _scriptPath;
15-
private readonly string? _additionalSql;
16-
17-
public YdbTestStore(
18-
string name,
19-
string? scriptPath = null,
20-
string? additionalSql = null,
21-
string? connectionStringOptions = null,
22-
bool shared = true,
23-
bool useConnectionString = false
24-
) : base(name, shared, CreateConnection())
25-
{
26-
_scriptPath = scriptPath;
27-
_additionalSql = additionalSql;
28-
}
2919

3020
public static YdbTestStore GetOrCreate(
3121
string name,
@@ -42,13 +32,13 @@ protected override async Task InitializeAsync(
4232
Func<DbContext, Task>? clean
4333
)
4434
{
45-
if (_scriptPath is not null)
35+
if (scriptPath is not null)
4636
{
47-
await ExecuteScript(_scriptPath);
37+
await ExecuteScript(scriptPath);
4838

49-
if (_additionalSql is not null)
39+
if (additionalSql is not null)
5040
{
51-
await ExecuteAsync(Connection, command => command.ExecuteNonQueryAsync(), _additionalSql);
41+
await ExecuteAsync(Connection, command => command.ExecuteNonQueryAsync(), additionalSql);
5242
}
5343
}
5444
else
@@ -58,9 +48,9 @@ protected override async Task InitializeAsync(
5848
await CleanAsync(context);
5949
await context.Database.EnsureCreatedAsync();
6050

61-
if (_additionalSql is not null)
51+
if (additionalSql is not null)
6252
{
63-
await ExecuteAsync(Connection, command => command.ExecuteNonQueryAsync(), _additionalSql);
53+
await ExecuteAsync(Connection, command => command.ExecuteNonQueryAsync(), additionalSql);
6454
}
6555

6656
if (seed is not null)

src/EfCore.Ydb/test/EfCore.Ydb.FunctionalTests/TestUtilities/YdbTestStoreFactory.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,17 @@
44

55
namespace EfCore.Ydb.FunctionalTests.TestUtilities;
66

7-
public class YdbTestStoreFactory(
8-
string? additionalSql = null,
9-
string? connectionStringOptions = null,
10-
bool useConnectionString = false
11-
) : RelationalTestStoreFactory
7+
public class YdbTestStoreFactory(string? additionalSql = null) : RelationalTestStoreFactory
128
{
139
public static YdbTestStoreFactory Instance { get; } = new();
1410

1511
private readonly string? _scriptPath = null;
1612

1713
public override TestStore Create(string storeName) =>
18-
new YdbTestStore(storeName, _scriptPath, additionalSql, connectionStringOptions, shared: false,
19-
useConnectionString);
14+
new YdbTestStore(storeName, _scriptPath, additionalSql, shared: false);
2015

2116
public override TestStore GetOrCreate(string storeName)
22-
=> new YdbTestStore(storeName, _scriptPath, additionalSql, connectionStringOptions, shared: true,
23-
useConnectionString);
17+
=> new YdbTestStore(storeName, _scriptPath, additionalSql, shared: true);
2418

2519
public override IServiceCollection AddProviderServices(IServiceCollection serviceCollection)
2620
=> serviceCollection.AddEntityFrameworkYdb();

0 commit comments

Comments
 (0)