Skip to content

Commit 54bc8e9

Browse files
fix linter
1 parent f92b96a commit 54bc8e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+876
-2170
lines changed

examples/src/BasicExample/Program.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,9 @@ internal class CmdOptions
2222

2323
internal static class Program
2424
{
25-
private static ServiceProvider GetServiceProvider()
26-
{
27-
return new ServiceCollection()
28-
.AddLogging(configure => configure.AddConsole().SetMinimumLevel(LogLevel.Information))
29-
.BuildServiceProvider();
30-
}
25+
private static ServiceProvider GetServiceProvider() => new ServiceCollection()
26+
.AddLogging(configure => configure.AddConsole().SetMinimumLevel(LogLevel.Information))
27+
.BuildServiceProvider();
3128

3229
private static async Task Run(CmdOptions cmdOptions)
3330
{

examples/src/Common/AuthUtils.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,10 @@ public static async Task<ICredentialsProvider> MakeCredentialsFromEnv(
5252
throw new InvalidOperationException("Failed to parse credentials from environmet, no valid options found.");
5353
}
5454

55-
public static X509Certificate GetCustomServerCertificate()
56-
{
57-
return YcCerts.GetDefaultServerCertificate();
58-
}
55+
public static X509Certificate GetCustomServerCertificate() => YcCerts.GetDefaultServerCertificate();
5956

60-
private static bool IsTrueValue(string value)
61-
{
62-
return
63-
value == "1" ||
64-
value.ToLower() == "yes" ||
65-
value.ToLower() == "true";
66-
}
57+
private static bool IsTrueValue(string value) =>
58+
value == "1" ||
59+
value.ToLower() == "yes" ||
60+
value.ToLower() == "true";
6761
}

examples/src/Common/DataUtils.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,14 @@ public record Season(ulong SeriesId, ulong SeasonId, string Title, DateTime Firs
2222

2323
public record Episode(ulong SeriesId, ulong SeasonId, ulong EpisodeId, string Title, DateTime AirDate)
2424
{
25-
public static Episode FromRow(Value.ResultSet.Row row)
26-
{
27-
return new Episode(
25+
public static Episode FromRow(Value.ResultSet.Row row) =>
26+
new(
2827
SeriesId: (ulong)row["series_id"].GetOptionalUint64()!,
2928
SeasonId: (ulong)row["season_id"].GetOptionalUint64()!,
3029
EpisodeId: (ulong)row["episode_id"].GetOptionalUint64()!,
3130
Title: (string)row["title"]!,
3231
AirDate: (DateTime)row["air_date"].GetOptionalDate()!
3332
);
34-
}
3533
}
3634

3735
public static class DataUtils

examples/src/Common/TableExampleBase.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,5 @@ protected TableExampleBase(TableClient client, string database, string path)
1313
BasePath = string.Join('/', database, path);
1414
}
1515

16-
protected string FullTablePath(string table)
17-
{
18-
return string.Join('/', BasePath, table);
19-
}
16+
protected string FullTablePath(string table) => string.Join('/', BasePath, table);
2017
}

examples/src/QueryExample/Program.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ internal class CmdOptions
2424

2525
internal static class Program
2626
{
27-
private static ServiceProvider GetServiceProvider()
28-
{
29-
return new ServiceCollection()
27+
private static ServiceProvider GetServiceProvider() =>
28+
new ServiceCollection()
3029
.AddLogging(configure => configure.AddConsole().SetMinimumLevel(LogLevel.Information))
3130
.BuildServiceProvider();
32-
}
3331

3432
private static async Task Run(CmdOptions cmdOptions)
3533
{

examples/src/QueryExample/QueryExample.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,8 @@ await Client.Exec(
180180
}
181181

182182

183-
private async Task InteractiveTx()
184-
{
185-
await Client.DoTx(async tx =>
183+
private Task InteractiveTx() =>
184+
Client.DoTx(async tx =>
186185
{
187186
var query1 = @$"
188187
PRAGMA TablePathPrefix('{BasePath}');
@@ -217,7 +216,6 @@ UPSERT INTO seasons (series_id, season_id, first_aired) VALUES
217216
await tx.Exec(query2, parameters2);
218217
}
219218
);
220-
}
221219

222220
private async Task StreamSelect()
223221
{

slo/src/Internal/ConfigBinders.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ public class CreateConfigBinder(
1313
Option<int> writeTimeoutOption)
1414
: BinderBase<CreateConfig>
1515
{
16-
protected override CreateConfig GetBoundValue(BindingContext bindingContext)
17-
{
18-
return new CreateConfig(
16+
protected override CreateConfig GetBoundValue(BindingContext bindingContext) =>
17+
new(
1918
bindingContext.ParseResult.GetValueForArgument(endpointArgument),
2019
bindingContext.ParseResult.GetValueForArgument(dbArgument),
2120
bindingContext.ParseResult.GetValueForOption(resourceYdbPath)!,
@@ -24,7 +23,6 @@ protected override CreateConfig GetBoundValue(BindingContext bindingContext)
2423
bindingContext.ParseResult.GetValueForOption(initialDataCountOption),
2524
bindingContext.ParseResult.GetValueForOption(writeTimeoutOption)
2625
);
27-
}
2826
}
2927

3028
internal class RunConfigBinder(
@@ -40,9 +38,8 @@ internal class RunConfigBinder(
4038
Option<int> timeOption)
4139
: BinderBase<RunConfig>
4240
{
43-
protected override RunConfig GetBoundValue(BindingContext bindingContext)
44-
{
45-
return new RunConfig(
41+
protected override RunConfig GetBoundValue(BindingContext bindingContext) =>
42+
new(
4643
bindingContext.ParseResult.GetValueForArgument(endpointArgument),
4744
bindingContext.ParseResult.GetValueForArgument(dbArgument),
4845
bindingContext.ParseResult.GetValueForOption(resourceYdbPath)!,
@@ -54,5 +51,4 @@ protected override RunConfig GetBoundValue(BindingContext bindingContext)
5451
bindingContext.ParseResult.GetValueForOption(writeTimeoutOption),
5552
bindingContext.ParseResult.GetValueForOption(timeOption)
5653
);
57-
}
5854
}

slo/src/TableService/SloTableContext.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ protected override async Task Create(TableClient client, string createTableSql,
7777
response.Status.IsSuccess ? response.Result.ResultSets[0].Rows[0][0].GetOptionalInt32() : null);
7878
}
7979

80-
protected override async Task<TableClient> CreateClient(Config config)
81-
{
82-
return new TableClient(await Driver.CreateInitialized(new DriverConfig(config.Endpoint, config.Db),
83-
ISloContext.Factory));
84-
}
80+
protected override async Task<TableClient> CreateClient(Config config) => new(
81+
await Driver.CreateInitialized(new DriverConfig(config.Endpoint, config.Db), ISloContext.Factory)
82+
);
8583
}

slo/src/TopicService/SloTopicContext.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,10 @@ private static void CheckMessage(ConcurrentDictionary<long, ConcurrentQueue<stri
346346
throw new Exception("FAILED SLO TEST: NOT FOUND PARTITION FOR PRODUCER_ID!");
347347
}
348348

349-
private static string PrintLocalStore(ConcurrentDictionary<long, ConcurrentQueue<string>> localStore)
350-
{
351-
return "[" +
352-
string.Join("\n", localStore.Select(pair => pair.Key + ": " + string.Join(", ", pair.Value))) +
353-
"]";
354-
}
349+
private static string PrintLocalStore(ConcurrentDictionary<long, ConcurrentQueue<string>> localStore) =>
350+
"[" +
351+
string.Join("\n", localStore.Select(pair => pair.Key + ": " + string.Join(", ", pair.Value))) +
352+
"]";
355353

356354
private static void AssertMessage(Ydb.Sdk.Services.Topic.Reader.Message<string> message, string expectedMessageData)
357355
{

src/Ydb.Sdk/src/Ado/ThrowHelper.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@ namespace Ydb.Sdk.Ado;
44

55
internal static class ThrowHelper
66
{
7-
internal static T ThrowInvalidCast<T>(YdbValue ydbValue)
8-
{
7+
internal static T ThrowInvalidCast<T>(YdbValue ydbValue) =>
98
throw new InvalidCastException($"Field YDB type {ydbValue.TypeId} can't be cast to {typeof(T)} type.");
10-
}
119

12-
internal static void ThrowIndexOutOfRangeException(int columnCount)
13-
{
10+
internal static void ThrowIndexOutOfRangeException(int columnCount) =>
1411
throw new IndexOutOfRangeException("Ordinal must be between 0 and " + (columnCount - 1));
15-
}
1612

17-
internal static void ThrowInvalidCastException(string expectedType, string actualType)
18-
{
13+
internal static void ThrowInvalidCastException(string expectedType, string actualType) =>
1914
throw new InvalidCastException($"Invalid type of YDB value, expected: {expectedType}, actual: {actualType}.");
20-
}
2115
}

0 commit comments

Comments
 (0)