Skip to content

Commit

Permalink
Fixed more IDE warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingsman0530 committed Jan 16, 2024
1 parent 2afb302 commit 74085b7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Bot/Coc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace Hyperstellar;

internal class Coc
internal sealed class Coc

Check notice on line 6 in Bot/Coc.cs

View workflow job for this annotation

GitHub Actions / inspect

"[ClassNeverInstantiated.Global] Class 'Coc' is never instantiated" on /home/runner/work/coc-clan/coc-clan/Bot/Coc.cs(6,95)
{
private class ClanUtil
private sealed class ClanUtil
{
internal readonly Clan _clan;

Check warning on line 10 in Bot/Coc.cs

View workflow job for this annotation

GitHub Actions / inspect

"[NotAccessedField.Local] Field '_clan' is assigned but its value is never used" on /home/runner/work/coc-clan/coc-clan/Bot/Coc.cs(10,172)
internal readonly Dictionary<string, ClanMember> _members = [];
Expand Down Expand Up @@ -52,7 +52,7 @@ internal readonly struct DonationTuple(int donated, int received)
}

private const string ClanId = "#2QU2UCJJC";
internal static readonly ClashOfClansClient s_client = new(Secrets.Coc);
internal static readonly ClashOfClansClient s_client = new(Secrets.s_coc);

Check notice on line 55 in Bot/Coc.cs

View workflow job for this annotation

GitHub Actions / inspect

"[MemberCanBePrivate.Global] Field 's_client' can be made private" on /home/runner/work/coc-clan/coc-clan/Bot/Coc.cs(55,1671)

#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
private static ClanUtil s_prevClan;
Expand Down
4 changes: 2 additions & 2 deletions Bot/Discord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Hyperstellar;

internal class Discord
internal sealed class Discord

Check notice on line 7 in Bot/Discord.cs

View workflow job for this annotation

GitHub Actions / inspect

"[ClassNeverInstantiated.Global] Class 'Discord' is never instantiated" on /home/runner/work/coc-clan/coc-clan/Bot/Discord.cs(7,119)
{
#if DEBUG
private const ulong BotLogId = 666431254312517633;
Expand Down Expand Up @@ -34,7 +34,7 @@ internal static async Task InitAsync()
{
s_bot.Log += Log;
s_bot.Ready += Ready;
await s_bot.LoginAsync(TokenType.Bot, Secrets.Discord);
await s_bot.LoginAsync(TokenType.Bot, Secrets.s_discord);
await s_bot.StartAsync();
}

Expand Down
10 changes: 5 additions & 5 deletions Bot/Secrets.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using Newtonsoft.Json;

internal class Secrets
internal sealed class Secrets

Check warning on line 3 in Bot/Secrets.cs

View workflow job for this annotation

GitHub Actions / inspect

"[CheckNamespace] Namespace does not correspond to file location, must be: 'Hyperstellar'" on /home/runner/work/coc-clan/coc-clan/Bot/Secrets.cs(3,46)
{
internal static readonly string Discord;
internal static readonly string Coc;
internal static readonly string s_discord;
internal static readonly string s_coc;

static Secrets()
{
string json = File.ReadAllText("secrets.json");
Dictionary<string, string> dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(json)!;
Discord = dict["discord"];
Coc = dict["coc"];
s_discord = dict["discord"];
s_coc = dict["coc"];
}
}
2 changes: 1 addition & 1 deletion Bot/Sql/Db.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Hyperstellar.Sql;

internal class Db
internal sealed class Db
{
private static readonly SQLiteConnection s_db = new("Hyperstellar.db");

Check warning on line 7 in Bot/Sql/Db.cs

View workflow job for this annotation

GitHub Actions / build

Private member 'Db.s_db' can be removed as the value assigned to it is never read (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0052)

Check warning on line 7 in Bot/Sql/Db.cs

View workflow job for this annotation

GitHub Actions / inspect

"[UnusedMember.Local] Field 's_db' is never used" on /home/runner/work/coc-clan/coc-clan/Bot/Sql/Db.cs(7,116)

Check warning on line 7 in Bot/Sql/Db.cs

View workflow job for this annotation

GitHub Actions / inspect

"[IDE0052] Private member 'Db.s_db' can be removed as the value assigned to it is never read" on /home/runner/work/coc-clan/coc-clan/Bot/Sql/Db.cs(7,116)
}

0 comments on commit 74085b7

Please sign in to comment.