Skip to content

Commit 9381d04

Browse files
fix linter
1 parent 6d4b7eb commit 9381d04

File tree

11 files changed

+66
-75
lines changed

11 files changed

+66
-75
lines changed

slo/src/TableService/SloTableContext.cs

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ public class SloTableContext : SloTableContext<TableClient>
1414

1515
protected override async Task Create(TableClient client, string createTableSql, int operationTimeout)
1616
{
17-
var response = await client.SessionExec(
18-
async session => await session.ExecuteSchemeQuery(createTableSql,
19-
new ExecuteSchemeQuerySettings { OperationTimeout = TimeSpan.FromSeconds(operationTimeout) }));
17+
var response = await client.SessionExec(async session => await session.ExecuteSchemeQuery(createTableSql,
18+
new ExecuteSchemeQuerySettings { OperationTimeout = TimeSpan.FromSeconds(operationTimeout) }));
2019

2120
response.Status.EnsureSuccess();
2221
}
@@ -29,21 +28,20 @@ protected override async Task Create(TableClient client, string createTableSql,
2928

3029
var attempts = 0;
3130

32-
var response = await tableClient.SessionExec(
33-
async session =>
31+
var response = await tableClient.SessionExec(async session =>
32+
{
33+
attempts++;
34+
var response = await session.ExecuteDataQuery(upsertSql, _txControl, parameters, querySettings);
35+
if (response.Status.IsSuccess)
3436
{
35-
attempts++;
36-
var response = await session.ExecuteDataQuery(upsertSql, _txControl, parameters, querySettings);
37-
if (response.Status.IsSuccess)
38-
{
39-
return response;
40-
}
37+
return response;
38+
}
4139

4240

43-
errorsGauge?.WithLabels(response.Status.StatusCode.ToString(), "retried").Inc();
41+
errorsGauge?.WithLabels(response.Status.StatusCode.ToString(), "retried").Inc();
4442

45-
return response;
46-
});
43+
return response;
44+
});
4745

4846
return (attempts, response.Status.StatusCode);
4947
}
@@ -56,22 +54,21 @@ protected override async Task Create(TableClient client, string createTableSql,
5654

5755
var attempts = 0;
5856

59-
var response = (ExecuteDataQueryResponse)await tableClient.SessionExec(
60-
async session =>
57+
var response = (ExecuteDataQueryResponse)await tableClient.SessionExec(async session =>
58+
{
59+
attempts++;
60+
var response = await session.ExecuteDataQuery(selectSql, _txControl, parameters, querySettings);
61+
if (response.Status.IsSuccess)
6162
{
62-
attempts++;
63-
var response = await session.ExecuteDataQuery(selectSql, _txControl, parameters, querySettings);
64-
if (response.Status.IsSuccess)
65-
{
66-
return response;
67-
}
63+
return response;
64+
}
6865

69-
Logger.LogWarning("{}", response.Status.ToString());
66+
Logger.LogWarning("{}", response.Status.ToString());
7067

71-
errorsGauge?.WithLabels(response.Status.StatusCode.StatusName(), "retried").Inc();
68+
errorsGauge?.WithLabels(response.Status.StatusCode.StatusName(), "retried").Inc();
7269

73-
return response;
74-
});
70+
return response;
71+
});
7572

7673
return (attempts, response.Status.StatusCode,
7774
response.Status.IsSuccess ? response.Result.ResultSets[0].Rows[0][0].GetOptionalInt32() : null);

src/EFCore.Ydb/test/EntityFrameworkCore.Ydb.FunctionalTests/Migrations/YdbMigrationsSqlGeneratorTest.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,16 @@ public override void InsertDataOperation_required_args_multiple_rows()
150150
public override void InsertDataOperation_throws_for_unsupported_column_types()
151151
=> Assert.Equal(
152152
RelationalStrings.UnsupportedDataOperationStoreType("foo", "dbo.People.First Name"),
153-
Assert.Throws<InvalidOperationException>(
154-
() =>
155-
Generate(
156-
new InsertDataOperation
157-
{
158-
Table = "People",
159-
Schema = "dbo",
160-
Columns = ["First Name"],
161-
ColumnTypes = ["foo"],
162-
Values = new object?[,] { { null } }
163-
})).Message);
153+
Assert.Throws<InvalidOperationException>(() =>
154+
Generate(
155+
new InsertDataOperation
156+
{
157+
Table = "People",
158+
Schema = "dbo",
159+
Columns = ["First Name"],
160+
ColumnTypes = ["foo"],
161+
Values = new object?[,] { { null } }
162+
})).Message);
164163

165164
public override void DeleteDataOperation_all_args()
166165
{

src/Ydb.Sdk/src/Driver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ private async Task PeriodicDiscovery()
182182
try
183183
{
184184
await Task.Delay(Config.EndpointDiscoveryInterval);
185-
185+
186186
_ = await DiscoverEndpoints();
187187
}
188188
catch (RpcException e)

src/Ydb.Sdk/src/Services/Topic/Reader/Reader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,8 @@ public async Task CommitOffsetRange(OffsetsRange offsetsRange, long partitionSes
468468
{
469469
var tcsCommit = new TaskCompletionSource();
470470

471-
await using var register = _lifecycleReaderSessionCts.Token.Register(
472-
() => tcsCommit.TrySetException(new ReaderException($"ReaderSession[{SessionId}] was deactivated"))
471+
await using var register = _lifecycleReaderSessionCts.Token.Register(() =>
472+
tcsCommit.TrySetException(new ReaderException($"ReaderSession[{SessionId}] was deactivated"))
473473
);
474474

475475
var commitSending = new CommitSending(offsetsRange, tcsCommit);

src/Ydb.Sdk/tests/Ado/YdbCommandTests.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -283,18 +283,18 @@ public void GetChars_WhenSelectText_MoveCharsToBuffer()
283283
Assert.Equal($"dataOffset must be between 0 and {int.MaxValue}",
284284
Assert.Throws<IndexOutOfRangeException>(() => ydbDataReader.GetChars(0, -1, null, 0, 6)).Message);
285285
Assert.Equal($"dataOffset must be between 0 and {int.MaxValue}",
286-
Assert.Throws<IndexOutOfRangeException>(
287-
() => ydbDataReader.GetChars(0, long.MaxValue, null, 0, 6)).Message);
288-
289-
Assert.Equal("bufferOffset must be between 0 and 10", Assert.Throws<IndexOutOfRangeException>(
290-
() => ydbDataReader.GetChars(0, 0, bufferChars, -1, 6)).Message);
291-
Assert.Equal("bufferOffset must be between 0 and 10", Assert.Throws<IndexOutOfRangeException>(
292-
() => ydbDataReader.GetChars(0, 0, bufferChars, -1, 6)).Message);
293-
294-
Assert.Equal("length must be between 0 and 10", Assert.Throws<IndexOutOfRangeException>(
295-
() => ydbDataReader.GetChars(0, 0, bufferChars, 3, -1)).Message);
296-
Assert.Equal("bufferOffset must be between 0 and 5", Assert.Throws<IndexOutOfRangeException>(
297-
() => ydbDataReader.GetChars(0, 0, bufferChars, 8, 5)).Message);
286+
Assert.Throws<IndexOutOfRangeException>(() =>
287+
ydbDataReader.GetChars(0, long.MaxValue, null, 0, 6)).Message);
288+
289+
Assert.Equal("bufferOffset must be between 0 and 10",
290+
Assert.Throws<IndexOutOfRangeException>(() => ydbDataReader.GetChars(0, 0, bufferChars, -1, 6)).Message);
291+
Assert.Equal("bufferOffset must be between 0 and 10",
292+
Assert.Throws<IndexOutOfRangeException>(() => ydbDataReader.GetChars(0, 0, bufferChars, -1, 6)).Message);
293+
294+
Assert.Equal("length must be between 0 and 10",
295+
Assert.Throws<IndexOutOfRangeException>(() => ydbDataReader.GetChars(0, 0, bufferChars, 3, -1)).Message);
296+
Assert.Equal("bufferOffset must be between 0 and 5",
297+
Assert.Throws<IndexOutOfRangeException>(() => ydbDataReader.GetChars(0, 0, bufferChars, 8, 5)).Message);
298298

299299
Assert.Equal(6, ydbDataReader.GetChars(0, 0, bufferChars, 4, 6));
300300
checkBuffer[4] = 'a';

src/Ydb.Sdk/tests/Ado/YdbConnectionStringBuilderTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ public void InitDefaultValues_WhenEmptyConstructorInvoke_ReturnDefaultConnection
2424
[Fact]
2525
public void InitConnectionStringBuilder_WhenUnexpectedKey_ThrowException()
2626
{
27-
Assert.Equal("Key doesn't support: unexpectedkey", Assert.Throws<ArgumentException>(
28-
() => new YdbConnectionStringBuilder("UnexpectedKey=123;Port=2135;")).Message);
27+
Assert.Equal("Key doesn't support: unexpectedkey", Assert.Throws<ArgumentException>(() =>
28+
new YdbConnectionStringBuilder("UnexpectedKey=123;Port=2135;")).Message);
2929

30-
Assert.Equal("Key doesn't support: unexpectedkey", Assert.Throws<ArgumentException>(
31-
() => new YdbConnectionStringBuilder { ConnectionString = "UnexpectedKey=123;Port=2135;" }).Message);
30+
Assert.Equal("Key doesn't support: unexpectedkey", Assert.Throws<ArgumentException>(() =>
31+
new YdbConnectionStringBuilder { ConnectionString = "UnexpectedKey=123;Port=2135;" }).Message);
3232
}
3333

3434
[Fact]

src/Ydb.Sdk/tests/Ado/YdbDataReaderTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ public async Task BasedIteration_WhenNotCallMethodRead_ThrowException()
4848
public async Task CreateYdbDataReader_WhenAbortedStatus_ThrowException()
4949
{
5050
var statuses = new List<Status>();
51-
Assert.Equal("Status: Aborted", (await Assert.ThrowsAsync<YdbException>(
52-
() => YdbDataReader.CreateYdbDataReader(SingleEnumeratorFailed, statuses.Add)))
53-
.Message);
51+
Assert.Equal("Status: Aborted", (await Assert.ThrowsAsync<YdbException>(() =>
52+
YdbDataReader.CreateYdbDataReader(SingleEnumeratorFailed, statuses.Add))).Message);
5453
Assert.Single(statuses);
5554
Assert.Equal(StatusCode.Aborted, statuses[0].StatusCode);
5655
}

src/Ydb.Sdk/tests/Ado/YdbParameterTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,12 @@ public class TestDataGenerator : IEnumerable<object[]>
224224
new object[] { new Data<DateTime?>(DbType.DateTime2, null, value => value.GetOptionalTimestamp()) },
225225
new object[]
226226
{
227-
new Data<byte[]>(DbType.Binary, Encoding.ASCII.GetBytes("test str").ToArray(),
227+
new Data<byte[]>(DbType.Binary, Encoding.ASCII.GetBytes("test str"),
228228
value => value.GetString())
229229
},
230230
new object[]
231231
{
232-
new Data<byte[]?>(DbType.Binary, Encoding.ASCII.GetBytes("test str").ToArray(),
232+
new Data<byte[]?>(DbType.Binary, Encoding.ASCII.GetBytes("test str"),
233233
value => value.GetString(), true)
234234
},
235235
new object[] { new Data<byte[]?>(DbType.Binary, null, value => value.GetOptionalString()) },

src/Ydb.Sdk/tests/Ado/YdbSchemaTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ public async Task GetSchema_WhenTablesWithStatsCollection_ReturnAllTables()
8787
Assert.NotNull(singleTable2.Rows[0]["modification_time"]);
8888

8989
// not found case
90-
await Assert.ThrowsAsync<YdbException>(
91-
async () => await ydbConnection.GetSchemaAsync("Tables", new[] { "not_found", null })
90+
await Assert.ThrowsAsync<YdbException>(async () =>
91+
await ydbConnection.GetSchemaAsync("Tables", new[] { "not_found", null })
9292
);
9393
}
9494

src/Ydb.Sdk/tests/Auth/StaticAuthTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ private async Task CheckAuth(string? passwordCreate, string? passwordAuth)
9090
public async Task NoPasswordAuth() => await CheckAuth(null, null);
9191

9292
[Fact]
93-
public async Task WrongPassword() => await Assert.ThrowsAsync<StatusUnsuccessfulException>(
94-
async () => await CheckAuth("good_password", "wrong_password"));
93+
public async Task WrongPassword() => await Assert.ThrowsAsync<StatusUnsuccessfulException>(async () =>
94+
await CheckAuth("good_password", "wrong_password"));
9595

9696
[Fact]
9797
public async Task NotExistAuth()
@@ -101,7 +101,7 @@ public async Task NotExistAuth()
101101
database: "/local"
102102
) { User = "notexists", Password = "nopass" };
103103

104-
await Assert.ThrowsAsync<StatusUnsuccessfulException>(
105-
async () => await Driver.CreateInitialized(driverConfig, _loggerFactory));
104+
await Assert.ThrowsAsync<StatusUnsuccessfulException>(async () =>
105+
await Driver.CreateInitialized(driverConfig, _loggerFactory));
106106
}
107107
}

0 commit comments

Comments
 (0)