Skip to content

Commit

Permalink
[Bot] Resolve most CA suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Pythonic-Rainbow committed Feb 7, 2024
1 parent cf229bf commit a4f1ca2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
1 change: 1 addition & 0 deletions Bot/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dotnet_diagnostic.CA1852.severity = suggestion
[*.cs]
# ReSharper
resharper_function_never_returns_highlighting = none
resharper_arrange_object_creation_when_type_not_evident_highlighting = none

# New line preferences
csharp_new_line_before_open_brace = all
Expand Down
19 changes: 7 additions & 12 deletions Bot/Clash/ClanUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,15 @@ internal static ClanUtil FromInit(Clan clan)
IEnumerable<string> existingMembers = Db.GetMembers().Select(m => m.CocId);
foreach (string dbMember in existingMembers)
{
bool stillExists = false;
foreach (ClanMember clanMember in clan.MemberList!)
ClanMember? clanMember = clan.MemberList!.FirstOrDefault(m => m.Tag == dbMember);
if (clanMember == null)
{
if (clanMember.Tag.Equals(dbMember))
{
c._members[dbMember] = clanMember;
clan.MemberList.Remove(clanMember);
stillExists = true;
break;
}
c._members[dbMember] = new(); // Fake a member
}
if (!stillExists)
else
{
c._members[dbMember] = new(); // Fake a member
c._members[dbMember] = clanMember;
clan.MemberList!.Remove(clanMember);
}
}
return c;
Expand All @@ -61,6 +56,6 @@ internal static ClanUtil FromPoll(Clan clan)
return c;
}

internal bool HasMember(ClanMember member) => _members.ContainsKey(member.Tag);
private bool HasMember(ClanMember member) => _members.ContainsKey(member.Tag);

Check notice on line 59 in Bot/Clash/ClanUtil.cs

View workflow job for this annotation

GitHub Actions / inspect

"[SuggestBaseTypeForParameter] Parameter can be of type 'ClashOfClans.Models.Identity'" on /home/runner/work/Hyperstellar/Hyperstellar/Bot/Clash/ClanUtil.cs(59,1808)
}

6 changes: 2 additions & 4 deletions Bot/Clash/Coc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private static async Task PollAsync()
CheckMembersJoined(clanUtil);
CheckMembersLeft(clanUtil);
await Task.WhenAll([
CheckDonationsAsync(clanUtil),
CheckDonationsAsync(clanUtil)
]);
Clan = clanUtil;
}
Expand Down Expand Up @@ -141,10 +141,8 @@ private static async Task CheckDonationsAsync(ClanUtil clan)
}

// Everyone is main now, begin processing Donate25
foreach (KeyValuePair<string, DonationTuple> delta in foldedDelta)
foreach ((string tag, DonationTuple dt) in foldedDelta)
{
string tag = delta.Key;
DonationTuple dt = delta.Value;
int donated = dt._donated;
int received = dt._received;

Expand Down

0 comments on commit a4f1ca2

Please sign in to comment.