Ignore more Ruff rules so we don't spam noqas everywhere

This commit is contained in:
2025-02-24 17:16:06 +01:00
parent ae8949f396
commit b61ea5af19
3 changed files with 20 additions and 13 deletions

View File

@ -244,14 +244,14 @@ class RemindGroup(discord.app_commands.Group):
# /remind add # /remind add
@discord.app_commands.command(name="add", description="Add a new reminder") @discord.app_commands.command(name="add", description="Add a new reminder")
async def add( # noqa: PLR0913, PLR0917, PLR6301 async def add(
self, self,
interaction: discord.Interaction, interaction: discord.Interaction,
message: str, message: str,
time: str, time: str,
channel: discord.TextChannel | None = None, channel: discord.TextChannel | None = None,
user: discord.User | None = None, user: discord.User | None = None,
dm_and_current_channel: bool | None = None, # noqa: FBT001 dm_and_current_channel: bool | None = None,
) -> None: ) -> None:
"""Add a new reminder. """Add a new reminder.
@ -337,7 +337,7 @@ class RemindGroup(discord.app_commands.Group):
# /remind event # /remind event
@discord.app_commands.command(name="event", description="Add a new Discord event.") @discord.app_commands.command(name="event", description="Add a new Discord event.")
async def add_event( # noqa: C901, PLR0913, PLR0917, PLR6301 async def add_event(
self, self,
interaction: discord.Interaction, interaction: discord.Interaction,
message: str, message: str,
@ -422,7 +422,7 @@ class RemindGroup(discord.app_commands.Group):
# /remind list # /remind list
@discord.app_commands.command(name="list", description="List, pause, unpause, and remove reminders.") @discord.app_commands.command(name="list", description="List, pause, unpause, and remove reminders.")
async def list(self, interaction: discord.Interaction) -> None: # noqa: PLR6301 async def list(self, interaction: discord.Interaction) -> None:
"""List all reminders with pagination and buttons for deleting and modifying jobs. """List all reminders with pagination and buttons for deleting and modifying jobs.
Args: Args:
@ -471,7 +471,7 @@ class RemindGroup(discord.app_commands.Group):
# /remind cron # /remind cron
@discord.app_commands.command(name="cron", description="Create new cron job. Works like UNIX cron.") @discord.app_commands.command(name="cron", description="Create new cron job. Works like UNIX cron.")
async def cron( # noqa: PLR0913, PLR0917, PLR6301 async def cron(
self, self,
interaction: discord.Interaction, interaction: discord.Interaction,
message: str, message: str,
@ -489,7 +489,7 @@ class RemindGroup(discord.app_commands.Group):
jitter: int | None = None, jitter: int | None = None,
channel: discord.TextChannel | None = None, channel: discord.TextChannel | None = None,
user: discord.User | None = None, user: discord.User | None = None,
dm_and_current_channel: bool | None = None, # noqa: FBT001 dm_and_current_channel: bool | None = None,
) -> None: ) -> None:
"""Create a new cron job. """Create a new cron job.
@ -513,7 +513,7 @@ class RemindGroup(discord.app_commands.Group):
channel (discord.TextChannel, optional): The channel to send the reminder to. Defaults to current channel. channel (discord.TextChannel, optional): The channel to send the reminder to. Defaults to current channel.
user (discord.User, optional): Send reminder as a DM to this user. Defaults to None. user (discord.User, optional): Send reminder as a DM to this user. Defaults to None.
dm_and_current_channel (bool, optional): If user is provided, send reminder as a DM to the user and in this channel. Defaults to only the user. dm_and_current_channel (bool, optional): If user is provided, send reminder as a DM to the user and in this channel. Defaults to only the user.
""" # noqa: E501 """
await interaction.response.defer() await interaction.response.defer()
# Log kwargs # Log kwargs
@ -600,7 +600,7 @@ class RemindGroup(discord.app_commands.Group):
name="interval", name="interval",
description="Create a new reminder that triggers based on an interval.", description="Create a new reminder that triggers based on an interval.",
) )
async def interval( # noqa: PLR0913, PLR0917, PLR6301 async def interval(
self, self,
interaction: discord.Interaction, interaction: discord.Interaction,
message: str, message: str,
@ -615,7 +615,7 @@ class RemindGroup(discord.app_commands.Group):
jitter: int | None = None, jitter: int | None = None,
channel: discord.TextChannel | None = None, channel: discord.TextChannel | None = None,
user: discord.User | None = None, user: discord.User | None = None,
dm_and_current_channel: bool | None = None, # noqa: FBT001 dm_and_current_channel: bool | None = None,
) -> None: ) -> None:
"""Create a new reminder that triggers based on an interval. """Create a new reminder that triggers based on an interval.
@ -634,7 +634,7 @@ class RemindGroup(discord.app_commands.Group):
channel (discord.TextChannel, optional): The channel to send the reminder to. Defaults to current channel. channel (discord.TextChannel, optional): The channel to send the reminder to. Defaults to current channel.
user (discord.User, optional): Send reminder as a DM to this user. Defaults to None. user (discord.User, optional): Send reminder as a DM to this user. Defaults to None.
dm_and_current_channel (bool, optional): If user is provided, send reminder as a DM to the user and in this channel. Defaults to only the user. dm_and_current_channel (bool, optional): If user is provided, send reminder as a DM to the user and in this channel. Defaults to only the user.
""" # noqa: E501 """
await interaction.response.defer() await interaction.response.defer()
logger.info(f"New interval job from {interaction.user} ({interaction.user.id}) in {interaction.channel}") logger.info(f"New interval job from {interaction.user} ({interaction.user.id}) in {interaction.channel}")
@ -723,7 +723,7 @@ class RemindGroup(discord.app_commands.Group):
# /remind backup # /remind backup
@discord.app_commands.command(name="backup", description="Backup all reminders to a file.") @discord.app_commands.command(name="backup", description="Backup all reminders to a file.")
async def backup(self, interaction: discord.Interaction, all_servers: bool = False) -> None: # noqa: FBT001, FBT002, PLR6301 async def backup(self, interaction: discord.Interaction, all_servers: bool = False) -> None:
"""Backup all reminders to a file. """Backup all reminders to a file.
Args: Args:
@ -798,7 +798,7 @@ class RemindGroup(discord.app_commands.Group):
# /remind restore # /remind restore
@discord.app_commands.command(name="restore", description="Restore reminders from a file.") @discord.app_commands.command(name="restore", description="Restore reminders from a file.")
async def restore(self, interaction: discord.Interaction) -> None: # noqa: PLR6301 async def restore(self, interaction: discord.Interaction) -> None:
"""Restore reminders from a file. """Restore reminders from a file.
Args: Args:

View File

@ -95,13 +95,20 @@ lint.isort.required-imports = ["from __future__ import annotations"]
lint.pycodestyle.ignore-overlong-task-comments = true lint.pycodestyle.ignore-overlong-task-comments = true
lint.ignore = [ lint.ignore = [
"C901", # Checks for functions with a high McCabe complexity.
"CPY001", # Checks for the absence of copyright notices within Python files. "CPY001", # Checks for the absence of copyright notices within Python files.
"D100", # Checks for undocumented public module definitions. "D100", # Checks for undocumented public module definitions.
"D104", # Checks for undocumented public package definitions. "D104", # Checks for undocumented public package definitions.
"D106", # Checks for undocumented public class definitions, for nested classes. "D106", # Checks for undocumented public class definitions, for nested classes.
"E501", # Checks for lines that exceed the specified maximum character length.
"ERA001", # Checks for commented-out Python code. "ERA001", # Checks for commented-out Python code.
"FBT001", # Checks for the use of boolean positional arguments in function definitions, as determined by the presence of a bool type hint.
"FBT002", # Checks for the use of boolean positional arguments in function definitions, as determined by the presence of a boolean default value.
"FIX002", # Checks for "TODO" comments. "FIX002", # Checks for "TODO" comments.
"PLR0913", # Checks for function definitions that include too many arguments.
"PLR0917", # Checks for function definitions that include too many positional arguments.
"PLR2004", # Checks for magic values used in comparison. "PLR2004", # Checks for magic values used in comparison.
"PLR6301", # Checks for the presence of unused self parameter in methods definitions.
# Conflicting lint rules when using Ruff's formatter # Conflicting lint rules when using Ruff's formatter
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules

View File

@ -54,7 +54,7 @@ def test_parse_time_invalid_timezone() -> None:
def test_parse_time_with_env_timezone(monkeypatch: pytest.MonkeyPatch) -> None: def test_parse_time_with_env_timezone(monkeypatch: pytest.MonkeyPatch) -> None:
"""Test the `parse_time` function to ensure it correctly parses a date string into a datetime object using the timezone from the environment.""" # noqa: E501 """Test the `parse_time` function to ensure it correctly parses a date string into a datetime object using the timezone from the environment."""
date_to_parse = "2023-10-10 10:00:00" date_to_parse = "2023-10-10 10:00:00"
result: datetime | None = parse_time(date_to_parse, "UTC") result: datetime | None = parse_time(date_to_parse, "UTC")