junepark678 / GIRRewrite

Unnecessary else/elif used after raise PYL-R1720
Style
Minor
a year agoa year old
Unnecessary "else" after "raise", remove the "else" and de-indent the code inside it
 21        # these are phrases that when said by a whitename, automatically bans them.
 22        # for example: known scam URLs
 23        done = guild_service.add_raid_phrase(phrase)
 24        if not done: 25            raise commands.BadArgument("That phrase is already in the list.")
 26        else:
 27            await ctx.send_success(description=f"Added `{phrase}` to the raid phrase list!", delete_after=5)
Unnecessary "elif" after "raise", remove the leading "el" from "elif"
301    @app_commands.describe(amount="Number of messages to purge")
302    @transform_context
303    async def purge(self, ctx: GIRContext, amount: app_commands.Range[int, 1, 100]) -> None:
304        if amount <= 0:305            raise commands.BadArgument(
306                "Number of messages to purge must be greater than 0")
307        elif amount >= 100:
Unnecessary "elif" after "raise", remove the leading "el" from "elif"
327        reason = escape_mentions(reason)
328
329        # sanity checks
330        if case is None:331            raise commands.BadArgument(
332                message=f"{member} has no case with ID {case_id}")
333        elif case._type != "WARN":
Unnecessary "elif" after "raise", remove the leading "el" from "elif"
110    @transform_context
111    async def end(self, ctx: GIRContext, message_id: str):
112        giveaway = guild_service.get_giveaway(_id=int(message_id))
113        if giveaway is None:114            raise commands.BadArgument(
115                "A giveaway with that ID was not found.")
116        elif giveaway.is_ended:
Unnecessary "elif" after "raise", remove the leading "el" from "elif"
 77    async def reroll(self, ctx: GIRContext, message_id: str):
 78        g = guild_service.get_giveaway(_id=int(message_id))
 79
 80        if g is None: 81            raise commands.BadArgument(
 82                "Couldn't find an ended giveaway by the provided ID.")
 83        elif not g.is_ended: