Skip to content

Commit

Permalink
Seal implicitly used classes (#309)
Browse files Browse the repository at this point in the history
Apparently the `[UsedImplicitly]` annotation suppresses the "Class has
no inheritors and can be marked sealed" warning. Cool to know.

Signed-off-by: Octol1ttle <[email protected]>
  • Loading branch information
Octol1ttle authored May 23, 2024
1 parent ebcdcb3 commit d03e250
Show file tree
Hide file tree
Showing 19 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions TeamOctolings.Octobot/Commands/AboutCommandGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles the command to show information about this bot: /about.
/// </summary>
[UsedImplicitly]
public class AboutCommandGroup : CommandGroup
public sealed class AboutCommandGroup : CommandGroup
{
private static readonly (string Username, Snowflake Id)[] Developers =
[
Expand All @@ -36,9 +36,9 @@ private static readonly (string Username, Snowflake Id)[] Developers =

private readonly ICommandContext _context;
private readonly IFeedbackService _feedback;
private readonly IDiscordRestGuildAPI _guildApi;
private readonly GuildDataService _guildData;
private readonly IDiscordRestUserAPI _userApi;
private readonly IDiscordRestGuildAPI _guildApi;

public AboutCommandGroup(
ICommandContext context, GuildDataService guildData,
Expand Down
2 changes: 1 addition & 1 deletion TeamOctolings.Octobot/Commands/BanCommandGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles commands related to ban management: /ban and /unban.
/// </summary>
[UsedImplicitly]
public class BanCommandGroup : CommandGroup
public sealed class BanCommandGroup : CommandGroup
{
private readonly AccessControlService _access;
private readonly IDiscordRestChannelAPI _channelApi;
Expand Down
2 changes: 1 addition & 1 deletion TeamOctolings.Octobot/Commands/ClearCommandGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles the command to clear messages in a channel: /clear.
/// </summary>
[UsedImplicitly]
public class ClearCommandGroup : CommandGroup
public sealed class ClearCommandGroup : CommandGroup
{
private readonly IDiscordRestChannelAPI _channelApi;
private readonly ICommandContext _context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace TeamOctolings.Octobot.Commands.Events;
/// Handles error logging for slash command groups.
/// </summary>
[UsedImplicitly]
public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent
public sealed class ErrorLoggingPostExecutionEvent : IPostExecutionEvent
{
private readonly IFeedbackService _feedback;
private readonly ILogger<ErrorLoggingPostExecutionEvent> _logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace TeamOctolings.Octobot.Commands.Events;
/// Handles error logging for slash commands that couldn't be successfully prepared.
/// </summary>
[UsedImplicitly]
public class LoggingPreparationErrorEvent : IPreparationErrorEvent
public sealed class LoggingPreparationErrorEvent : IPreparationErrorEvent
{
private readonly ILogger<LoggingPreparationErrorEvent> _logger;

Expand Down
2 changes: 1 addition & 1 deletion TeamOctolings.Octobot/Commands/InfoCommandGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles info commands: /userinfo, /guildinfo.
/// </summary>
[UsedImplicitly]
public class InfoCommandGroup : CommandGroup
public sealed class InfoCommandGroup : CommandGroup
{
private readonly ICommandContext _context;
private readonly IFeedbackService _feedback;
Expand Down
2 changes: 1 addition & 1 deletion TeamOctolings.Octobot/Commands/KickCommandGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles the command to kick members of a guild: /kick.
/// </summary>
[UsedImplicitly]
public class KickCommandGroup : CommandGroup
public sealed class KickCommandGroup : CommandGroup
{
private readonly AccessControlService _access;
private readonly IDiscordRestChannelAPI _channelApi;
Expand Down
2 changes: 1 addition & 1 deletion TeamOctolings.Octobot/Commands/MuteCommandGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles commands related to mute management: /mute and /unmute.
/// </summary>
[UsedImplicitly]
public class MuteCommandGroup : CommandGroup
public sealed class MuteCommandGroup : CommandGroup
{
private readonly AccessControlService _access;
private readonly ICommandContext _context;
Expand Down
2 changes: 1 addition & 1 deletion TeamOctolings.Octobot/Commands/PingCommandGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles the command to get the time taken for the gateway to respond to the last heartbeat: /ping
/// </summary>
[UsedImplicitly]
public class PingCommandGroup : CommandGroup
public sealed class PingCommandGroup : CommandGroup
{
private readonly IDiscordRestChannelAPI _channelApi;
private readonly DiscordGatewayClient _client;
Expand Down
4 changes: 2 additions & 2 deletions TeamOctolings.Octobot/Commands/RemindCommandGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles commands to manage reminders: /remind, /listremind, /delremind
/// </summary>
[UsedImplicitly]
public class RemindCommandGroup : CommandGroup
public sealed class RemindCommandGroup : CommandGroup
{
private readonly IInteractionCommandContext _context;
private readonly IFeedbackService _feedback;
private readonly GuildDataService _guildData;
private readonly IDiscordRestUserAPI _userApi;
private readonly IDiscordRestInteractionAPI _interactionApi;
private readonly IDiscordRestUserAPI _userApi;

public RemindCommandGroup(
IInteractionCommandContext context, GuildDataService guildData, IFeedbackService feedback,
Expand Down
2 changes: 1 addition & 1 deletion TeamOctolings.Octobot/Commands/SettingsCommandGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles the commands to list and modify per-guild settings: /settings and /settings list.
/// </summary>
[UsedImplicitly]
public class SettingsCommandGroup : CommandGroup
public sealed class SettingsCommandGroup : CommandGroup
{
/// <summary>
/// Represents all options as an array of objects implementing <see cref="IGuildOption" />.
Expand Down
2 changes: 1 addition & 1 deletion TeamOctolings.Octobot/Commands/ToolsCommandGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles tool commands: /random, /timestamp, /8ball.
/// </summary>
[UsedImplicitly]
public class ToolsCommandGroup : CommandGroup
public sealed class ToolsCommandGroup : CommandGroup
{
private static readonly TimestampStyle[] AllStyles =
[
Expand Down
2 changes: 1 addition & 1 deletion TeamOctolings.Octobot/Responders/GuildLoadedResponder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace TeamOctolings.Octobot.Responders;
/// has <see cref="GuildSettings.ReceiveStartupMessages" /> enabled
/// </summary>
[UsedImplicitly]
public class GuildLoadedResponder : IResponder<IGuildCreate>
public sealed class GuildLoadedResponder : IResponder<IGuildCreate>
{
private readonly IDiscordRestChannelAPI _channelApi;
private readonly GuildDataService _guildData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace TeamOctolings.Octobot.Responders;
/// </summary>
/// <seealso cref="GuildSettings.WelcomeMessage" />
[UsedImplicitly]
public class GuildMemberJoinedResponder : IResponder<IGuildMemberAdd>
public sealed class GuildMemberJoinedResponder : IResponder<IGuildMemberAdd>
{
private readonly IDiscordRestChannelAPI _channelApi;
private readonly IDiscordRestGuildAPI _guildApi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace TeamOctolings.Octobot.Responders;
/// </summary>
/// <seealso cref="GuildSettings.LeaveMessage" />
[UsedImplicitly]
public class GuildMemberLeftResponder : IResponder<IGuildMemberRemove>
public sealed class GuildMemberLeftResponder : IResponder<IGuildMemberRemove>
{
private readonly IDiscordRestChannelAPI _channelApi;
private readonly IDiscordRestGuildAPI _guildApi;
Expand Down
2 changes: 1 addition & 1 deletion TeamOctolings.Octobot/Responders/GuildUnloadedResponder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace TeamOctolings.Octobot.Responders;
/// Handles removing guild ID from <see cref="GuildData" /> if the guild becomes unavailable.
/// </summary>
[UsedImplicitly]
public class GuildUnloadedResponder : IResponder<IGuildDelete>
public sealed class GuildUnloadedResponder : IResponder<IGuildDelete>
{
private readonly GuildDataService _guildData;
private readonly ILogger<GuildUnloadedResponder> _logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace TeamOctolings.Octobot.Responders;
/// to a guild's <see cref="GuildSettings.PrivateFeedbackChannel" /> if one is set.
/// </summary>
[UsedImplicitly]
public class MessageDeletedResponder : IResponder<IMessageDelete>
public sealed class MessageDeletedResponder : IResponder<IMessageDelete>
{
private readonly IDiscordRestAuditLogAPI _auditLogApi;
private readonly IDiscordRestChannelAPI _channelApi;
Expand Down
2 changes: 1 addition & 1 deletion TeamOctolings.Octobot/Responders/MessageEditedResponder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace TeamOctolings.Octobot.Responders;
/// to a guild's <see cref="GuildSettings.PrivateFeedbackChannel" /> if one is set.
/// </summary>
[UsedImplicitly]
public class MessageEditedResponder : IResponder<IMessageUpdate>
public sealed class MessageEditedResponder : IResponder<IMessageUpdate>
{
private readonly CacheService _cacheService;
private readonly IDiscordRestChannelAPI _channelApi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace TeamOctolings.Octobot.Responders;
/// Handles sending replies to easter egg messages.
/// </summary>
[UsedImplicitly]
public class MessageCreateResponder : IResponder<IMessageCreate>
public sealed class MessageCreateResponder : IResponder<IMessageCreate>
{
private readonly IDiscordRestChannelAPI _channelApi;

Expand Down

0 comments on commit d03e250

Please sign in to comment.