Skip to content

Commit 5d470f6

Browse files
committed
style: jb reformat for 1b-iii
1 parent ac7ec7a commit 5d470f6

11 files changed

Lines changed: 82 additions & 24 deletions

File tree

src/RustPlusBot.Abstractions/Credentials/ICredentialStore.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@ Task<Guid> UpsertFromPairingAsync(
3636
/// <param name="cancellationToken">A cancellation token.</param>
3737
/// <returns>The distinct server ids whose pool changed.</returns>
3838
Task<IReadOnlyList<Guid>> RemoveForOwnerAsync(
39-
ulong guildId, ulong ownerUserId, CancellationToken cancellationToken = default);
39+
ulong guildId,
40+
ulong ownerUserId,
41+
CancellationToken cancellationToken = default);
4042

4143
/// <summary>Lists the distinct server ids the owner currently holds a credential for in the guild.</summary>
4244
/// <param name="guildId">Owning Discord guild snowflake.</param>
4345
/// <param name="ownerUserId">The Discord user.</param>
4446
/// <param name="cancellationToken">A cancellation token.</param>
4547
/// <returns>The distinct server ids the owner has a credential for.</returns>
4648
Task<IReadOnlyList<Guid>> ListServerIdsForOwnerAsync(
47-
ulong guildId, ulong ownerUserId, CancellationToken cancellationToken = default);
49+
ulong guildId,
50+
ulong ownerUserId,
51+
CancellationToken cancellationToken = default);
4852
}

src/RustPlusBot.Features.Connections/Removal/ServerRemovalService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ internal sealed class ServerRemovalService(
1515
IServerWorkspaceRemover workspace) : IServerRemovalService
1616
{
1717
/// <inheritdoc />
18-
public async Task<bool> RemoveServerAsync(ulong guildId, Guid serverId, CancellationToken cancellationToken = default)
18+
public async Task<bool> RemoveServerAsync(ulong guildId,
19+
Guid serverId,
20+
CancellationToken cancellationToken = default)
1921
{
2022
await supervisor.StopAsync(guildId, serverId).ConfigureAwait(false);
2123
var removed = await servers.RemoveAsync(guildId, serverId, cancellationToken).ConfigureAwait(false);

src/RustPlusBot.Features.Pairing/Accounts/AccountDisconnectService.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ internal sealed class AccountDisconnectService(
2222
{
2323
/// <inheritdoc />
2424
public async Task<AccountDisconnectPreview> PreviewAsync(
25-
ulong guildId, ulong ownerUserId, CancellationToken cancellationToken = default)
25+
ulong guildId,
26+
ulong ownerUserId,
27+
CancellationToken cancellationToken = default)
2628
{
2729
var registration = await registrations.GetAsync(guildId, ownerUserId, cancellationToken).ConfigureAwait(false);
2830
var serverIds = await credentials.ListServerIdsForOwnerAsync(guildId, ownerUserId, cancellationToken)
@@ -45,7 +47,9 @@ public async Task<AccountDisconnectPreview> PreviewAsync(
4547

4648
/// <inheritdoc />
4749
public async Task<int> DisconnectAsync(
48-
ulong guildId, ulong ownerUserId, CancellationToken cancellationToken = default)
50+
ulong guildId,
51+
ulong ownerUserId,
52+
CancellationToken cancellationToken = default)
4953
{
5054
await supervisor.StopListenerAsync(guildId, ownerUserId).ConfigureAwait(false);
5155

src/RustPlusBot.Features.Pairing/Accounts/IAccountDisconnectService.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ internal interface IAccountDisconnectService
99
/// <param name="cancellationToken">A cancellation token.</param>
1010
/// <returns>Whether the user is connected and the names of servers they would be removed from.</returns>
1111
Task<AccountDisconnectPreview> PreviewAsync(
12-
ulong guildId, ulong ownerUserId, CancellationToken cancellationToken = default);
12+
ulong guildId,
13+
ulong ownerUserId,
14+
CancellationToken cancellationToken = default);
1315

1416
/// <summary>
1517
/// Stops the user's FCM listener, marks their registration Disabled, removes all their pool credentials
@@ -20,7 +22,9 @@ Task<AccountDisconnectPreview> PreviewAsync(
2022
/// <param name="cancellationToken">A cancellation token.</param>
2123
/// <returns>The number of servers the user was removed from.</returns>
2224
Task<int> DisconnectAsync(
23-
ulong guildId, ulong ownerUserId, CancellationToken cancellationToken = default);
25+
ulong guildId,
26+
ulong ownerUserId,
27+
CancellationToken cancellationToken = default);
2428
}
2529

2630
/// <summary>What an account disconnect would affect.</summary>

src/RustPlusBot.Features.Pairing/Modules/CredentialModule.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ namespace RustPlusBot.Features.Pairing.Modules;
1515
public sealed class CredentialModule(IServiceScopeFactory scopeFactory)
1616
: InteractionModuleBase<SocketInteractionContext>
1717
{
18+
private const string DisconnectConfirmId = "pairing:account:disconnect:confirm";
19+
private const string DisconnectCancelId = "pairing:account:disconnect:cancel";
20+
1821
/// <summary>Opens the credentials modal when the #setup button is clicked.</summary>
1922
[ComponentInteraction(WorkspaceComponentIds.ConnectAccount)]
2023
public async Task OpenAsync()
@@ -71,9 +74,6 @@ await FollowupAsync(
7174
}
7275
}
7376

74-
private const string DisconnectConfirmId = "pairing:account:disconnect:confirm";
75-
private const string DisconnectCancelId = "pairing:account:disconnect:cancel";
76-
7777
/// <summary>Opens an ephemeral confirmation listing the servers a disconnect would affect.</summary>
7878
[ComponentInteraction(WorkspaceComponentIds.DisconnectAccount)]
7979
public async Task DisconnectPromptAsync()

src/RustPlusBot.Persistence/Credentials/CredentialStore.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ public Task<int> CountForServerAsync(
6464

6565
/// <inheritdoc />
6666
public async Task<IReadOnlyList<Guid>> RemoveForOwnerAsync(
67-
ulong guildId, ulong ownerUserId, CancellationToken cancellationToken = default)
67+
ulong guildId,
68+
ulong ownerUserId,
69+
CancellationToken cancellationToken = default)
6870
{
6971
var owned = await context.PlayerCredentials
7072
.Where(c => c.GuildId == guildId && c.OwnerUserId == ownerUserId)
@@ -83,7 +85,9 @@ public async Task<IReadOnlyList<Guid>> RemoveForOwnerAsync(
8385

8486
/// <inheritdoc />
8587
public async Task<IReadOnlyList<Guid>> ListServerIdsForOwnerAsync(
86-
ulong guildId, ulong ownerUserId, CancellationToken cancellationToken = default) =>
88+
ulong guildId,
89+
ulong ownerUserId,
90+
CancellationToken cancellationToken = default) =>
8791
await context.PlayerCredentials
8892
.Where(c => c.GuildId == guildId && c.OwnerUserId == ownerUserId)
8993
.Select(c => c.RustServerId)

tests/RustPlusBot.Features.Pairing.Tests/AccountDisconnectServiceTests.cs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,15 @@ public async Task Disconnect_StopsListener_DisablesRegistration_RemovesCreds_Pub
3333
var s1 = Guid.NewGuid();
3434
var s2 = Guid.NewGuid();
3535
regs.GetAsync(10UL, 99UL, Arg.Any<CancellationToken>())
36-
.Returns(new FcmRegistration { Id = regId, GuildId = 10UL, OwnerUserId = 99UL });
36+
.Returns(new FcmRegistration
37+
{
38+
Id = regId, GuildId = 10UL, OwnerUserId = 99UL
39+
});
3740
creds.RemoveForOwnerAsync(10UL, 99UL, Arg.Any<CancellationToken>())
38-
.Returns(new List<Guid> { s1, s2 });
41+
.Returns(new List<Guid>
42+
{
43+
s1, s2
44+
});
3945

4046
var count = await sut.DisconnectAsync(10UL, 99UL);
4147

@@ -71,11 +77,24 @@ public async Task Preview_ReportsConnectedAndServerNames()
7177
var (sut, _, regs, creds, servers, _) = Create();
7278
var s1 = Guid.NewGuid();
7379
regs.GetAsync(10UL, 99UL, Arg.Any<CancellationToken>())
74-
.Returns(new FcmRegistration { Id = Guid.NewGuid(), GuildId = 10UL, OwnerUserId = 99UL });
80+
.Returns(new FcmRegistration
81+
{
82+
Id = Guid.NewGuid(), GuildId = 10UL, OwnerUserId = 99UL
83+
});
7584
creds.ListServerIdsForOwnerAsync(10UL, 99UL, Arg.Any<CancellationToken>())
76-
.Returns(new List<Guid> { s1 });
85+
.Returns(new List<Guid>
86+
{
87+
s1
88+
});
7789
servers.GetAsync(10UL, s1, Arg.Any<CancellationToken>())
78-
.Returns(new RustServer { Id = s1, GuildId = 10UL, Name = "Rustopia", Ip = "1.1.1.1", Port = 28015 });
90+
.Returns(new RustServer
91+
{
92+
Id = s1,
93+
GuildId = 10UL,
94+
Name = "Rustopia",
95+
Ip = "1.1.1.1",
96+
Port = 28015
97+
});
7998

8099
var preview = await sut.PreviewAsync(10UL, 99UL);
81100

tests/RustPlusBot.Features.Workspace.Tests/Messages/RendererTests.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,14 @@ public async Task ServerInfo_HasRemoveServerButton()
201201
var serverId = Guid.NewGuid();
202202
var servers = Substitute.For<IServerService>();
203203
servers.GetAsync(1, serverId, Arg.Any<CancellationToken>())
204-
.Returns(new RustServer { Id = serverId, GuildId = 1, Name = "S", Ip = "1.2.3.4", Port = 28015 });
204+
.Returns(new RustServer
205+
{
206+
Id = serverId,
207+
GuildId = 1,
208+
Name = "S",
209+
Ip = "1.2.3.4",
210+
Port = 28015
211+
});
205212
var connections = Substitute.For<IConnectionStore>();
206213
connections.GetStateAsync(1, serverId, Arg.Any<CancellationToken>())
207214
.Returns(new DomainConnectionState

tests/RustPlusBot.Persistence.Tests/Connections/ConnectionStateSchemaTests.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ public async Task ConnectionState_RoundTrips_StatusAndPlayerCount()
1313
await using var _ = context;
1414
await using var __ = connection;
1515

16-
var server = new RustServer { GuildId = 10UL, Name = "S", Ip = "1.1.1.1", Port = 28015 };
16+
var server = new RustServer
17+
{
18+
GuildId = 10UL, Name = "S", Ip = "1.1.1.1", Port = 28015
19+
};
1720
context.RustServers.Add(server);
1821
await context.SaveChangesAsync();
1922
var serverId = server.Id;
@@ -40,7 +43,10 @@ public async Task ConnectionState_RoundTrips_NullPlayerCount()
4043
await using var _ = context;
4144
await using var __ = connection;
4245

43-
var server = new RustServer { GuildId = 10UL, Name = "S", Ip = "1.1.1.1", Port = 28015 };
46+
var server = new RustServer
47+
{
48+
GuildId = 10UL, Name = "S", Ip = "1.1.1.1", Port = 28015
49+
};
4450
context.RustServers.Add(server);
4551
await context.SaveChangesAsync();
4652
var serverId = server.Id;
@@ -64,7 +70,10 @@ public async Task RemovingServer_CascadeDeletesItsConnectionState()
6470
await using var _ = context;
6571
await using var __ = connection;
6672

67-
var server = new RustServer { GuildId = 10UL, Name = "S", Ip = "1.1.1.1", Port = 28015 };
73+
var server = new RustServer
74+
{
75+
GuildId = 10UL, Name = "S", Ip = "1.1.1.1", Port = 28015
76+
};
6877
context.RustServers.Add(server);
6978
context.ConnectionStates.Add(new ConnectionState
7079
{

tests/RustPlusBot.Persistence.Tests/Connections/ConnectionStoreTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ public async Task UpsertStatus_InsertsThenReportsChangeOnlyWhenDifferent()
5555
var (store, context, conn) = Create();
5656
await using var _ = conn;
5757
await using var __ = context;
58-
var server = new RustServer { GuildId = 10UL, Name = "S", Ip = "1.1.1.1", Port = 28015 };
58+
var server = new RustServer
59+
{
60+
GuildId = 10UL, Name = "S", Ip = "1.1.1.1", Port = 28015
61+
};
5962
context.RustServers.Add(server);
6063
await context.SaveChangesAsync();
6164
var serverId = server.Id;

0 commit comments

Comments
 (0)