Skip to content

Commit 6d54d3e

Browse files
authored
Apply Sonarcloud recommendations (#569)
1 parent 5a7c2a3 commit 6d54d3e

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

bot/cogs/meta.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,16 @@ async def about(self, ctx: commands.Context) -> None:
119119
total_members = 0
120120
total_unique = len(self.bot.users)
121121

122-
text = 0
123-
voice = 0
124122
guilds = 0
125123
for guild in self.bot.guilds:
126124
guilds += 1
127125
if guild.unavailable:
128126
continue
129127

130128
total_members += guild.member_count or 0
131-
for channel in guild.channels:
132-
if isinstance(channel, discord.TextChannel):
133-
text += 1
134-
elif isinstance(channel, discord.VoiceChannel):
135-
voice += 1
136129

137130
memory_usage = self.process.memory_full_info().uss / 1024**2
138-
cpu_usage = self.process.cpu_percent() / psutil.cpu_count() # type: ignore # I'm not sure why pyright is complaining about this
131+
cpu_usage = self.process.cpu_percent() / psutil.cpu_count() # type: ignore # I'm not sure why pyright is complaining about this
139132

140133
revisions = self.get_last_commits()
141134

bot/cogs/redirects.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ async def resolved(self, ctx: GuildContext) -> None:
239239
# Permissions.add_reaction and Permissions.read_message_history is required
240240
await ctx.message.add_reaction(discord.PartialEmoji(name="\U00002705"))
241241
await self.mark_as_resolved(channel, ctx.author)
242-
return
243242
else:
244243
prompt_message = f"<@!{channel.owner_id}>, would you like to mark this thread as solved? If this thread is not marked as resolved, then it will not be resolved. This has been requested by {ctx.author.mention}."
245244
view = ConfirmResolvedView(

bot/libs/utils/time.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self, value: int):
1212

1313
def __format__(self, format_spec: str) -> str:
1414
v = self.value
15-
singular, sep, plural = format_spec.partition("|")
15+
singular, _, plural = format_spec.partition("|")
1616
plural = plural or f"{singular}s"
1717
if abs(v) != 1:
1818
return f"{v} {plural}"

0 commit comments

Comments
 (0)