-
-
Notifications
You must be signed in to change notification settings - Fork 40
DRAFT: v0.1.0 #1020
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
DRAFT: v0.1.0 #1020
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found. |
@sourcery-ai review |
Reviewer's GuideThis PR modernizes the Tux codebase by reorganizing source files under a Entity relationship diagram for database controller module reorganizationerDiagram
AfkController ||--o{ DatabaseController : provides
CaseController ||--o{ DatabaseController : provides
GuildController ||--o{ DatabaseController : provides
GuildConfigController ||--o{ DatabaseController : provides
LevelsController ||--o{ DatabaseController : provides
NoteController ||--o{ DatabaseController : provides
ReminderController ||--o{ DatabaseController : provides
SnippetController ||--o{ DatabaseController : provides
StarboardController ||--o{ DatabaseController : provides
StarboardMessageController ||--o{ DatabaseController : provides
DatabaseController }o--|| IDatabaseService : implements
Class diagram for Tux bot and dependency injection changesclassDiagram
class Tux {
+ServiceContainer container
+SentryManager sentry_manager
+EmojiManager emoji_manager
+DatabaseService db
+setup()
+_setup_container()
+_validate_container()
+_raise_container_validation_error()
+_cleanup_container()
}
class ServiceContainer {
+get_optional(interface)
}
class ServiceRegistry {
+configure_container(bot)
+validate_container(container)
+get_registered_services(container)
}
class SentryManager {
+setup()
+capture_exception()
+finish_transaction_on_error()
+set_command_context()
+flush_async()
+is_initialized
}
Tux --> ServiceContainer
Tux --> SentryManager
Tux --> EmojiManager
Tux --> DatabaseService
ServiceRegistry --> ServiceContainer
ServiceContainer --> SentryManager
ServiceContainer --> EmojiManager
ServiceContainer --> DatabaseService
Class diagram for ConfigSet* UI views with DI changesclassDiagram
class ConfigSetPrivateLogs {
+__init__(timeout, bot, db_service)
-db: GuildConfigController
}
class ConfigSetPublicLogs {
+__init__(timeout, bot, db_service)
-db: GuildConfigController
}
class ConfigSetChannels {
+__init__(timeout, bot, db_service)
-db: GuildConfigController
}
class IDatabaseService {
+get_controller()
}
class GuildConfigController {
}
ConfigSetPrivateLogs --> IDatabaseService
ConfigSetPublicLogs --> IDatabaseService
ConfigSetChannels --> IDatabaseService
IDatabaseService --> GuildConfigController
Class diagram for Setup cog refactor to use DI and base classclassDiagram
class Setup {
+__init__(bot)
-config: GuildConfigController
}
class BaseCog {
+__init__(bot)
-db: IDatabaseService
}
class IDatabaseService {
+get_controller()
}
class GuildConfigController {
}
Setup --|> BaseCog
BaseCog --> IDatabaseService
IDatabaseService --> GuildConfigController
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @kzndotsh - I've reviewed your changes and they look great!
Blocking issues:
- By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than 'root'. (link)
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/tux/services/tracing.py:80` </location>
<code_context>
+# --- Common Helpers ---
+
+
+def safe_set_name(obj: Any, name: str) -> None:
+ """
+ Safely set the name on a span or transaction object.
</code_context>
<issue_to_address>
safe_set_name may fail silently if set_name is not callable.
Add a check to ensure set_name is callable before invoking it to prevent silent failures.
</issue_to_address>
### Comment 2
<location> `src/tux/services/tracing.py:598` </location>
<code_context>
+ raise
+
+
+def instrument_bot_commands(bot: commands.Bot) -> None:
+ """
+ Automatically instruments all bot commands with Sentry transactions.
</code_context>
<issue_to_address>
Instrumenting bot commands by replacing callbacks may interfere with other decorators.
Directly replacing the command callback can disrupt existing decorators or attributes. Using a wrapper or middleware would help maintain original metadata.
</issue_to_address>
### Comment 3
<location> `src/tux/core/container.py:244` </location>
<code_context>
+ return descriptor.instance
+
+ # Create new instance
+ self._resolution_stack.add(service_type)
+
+ try:
</code_context>
<issue_to_address>
Using a set for _resolution_stack may not preserve dependency order for error reporting.
Consider replacing the set with a list or stack to maintain resolution order, which will improve error messages for circular dependencies.
Suggested implementation:
```python
# Create new instance
self._resolution_stack.append(service_type)
```
```python
try:
```
```python
except Exception as e:
stack_trace = " -> ".join([t.__name__ for t in self._resolution_stack])
logger.error(f"Failed to resolve {service_type.__name__}: {e}\nResolution stack: {stack_trace}")
error_msg = f"Cannot resolve {service_type.__name__} (resolution stack: {stack_trace})"
raise ServiceResolutionError(error_msg) from e
```
```python
else:
resolution_time = time.perf_counter() - start_time
# Only log if resolution takes longer than expected or fails
if resolution_time > 0.001: # Log if takes more than 1ms
logger.debug(f"Slow resolution: {service_type.__name__} took {resolution_time:.4f}s")
self._resolution_stack.pop()
```
You will also need to:
1. Change the initialization of `self._resolution_stack` from a set to a list (e.g., `self._resolution_stack = []`).
2. Update any other code that checks membership (`in`) or removes items from `_resolution_stack` to use list semantics.
3. If you have circular dependency checks, you can still use `if service_type in self._resolution_stack:` for lists.
</issue_to_address>
### Comment 4
<location> `src/tux/core/container.py:299` </location>
<code_context>
+ # Resolve the dependency
+ dependency = self._resolve_service(param_type)
+
+ if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD:
+ if param.default is inspect.Parameter.empty:
+ args.append(dependency)
+ else:
+ kwargs[param.name] = dependency
+ elif param.kind == inspect.Parameter.KEYWORD_ONLY:
+ kwargs[param.name] = dependency
+
</code_context>
<issue_to_address>
Does not handle VAR_POSITIONAL or VAR_KEYWORD constructor parameters.
Currently, *args and **kwargs in service constructors are not processed. Please add explicit handling for VAR_POSITIONAL and VAR_KEYWORD parameters, either by raising an error or documenting their unsupported status.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
# Resolve the dependency
dependency = self._resolve_service(param_type)
if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD:
if param.default is inspect.Parameter.empty:
args.append(dependency)
else:
kwargs[param.name] = dependency
elif param.kind == inspect.Parameter.KEYWORD_ONLY:
kwargs[param.name] = dependency
=======
# Resolve the dependency
dependency = self._resolve_service(param_type)
if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD:
if param.default is inspect.Parameter.empty:
args.append(dependency)
else:
kwargs[param.name] = dependency
elif param.kind == inspect.Parameter.KEYWORD_ONLY:
kwargs[param.name] = dependency
elif param.kind == inspect.Parameter.VAR_POSITIONAL:
raise ServiceResolutionError(
f"Constructor parameter '*{param.name}' in {impl_type.__name__} is not supported by the DI container"
)
elif param.kind == inspect.Parameter.VAR_KEYWORD:
raise ServiceResolutionError(
f"Constructor parameter '**{param.name}' in {impl_type.__name__} is not supported by the DI container"
)
>>>>>>> REPLACE
</suggested_fix>
### Comment 5
<location> `docs/content/dev/local_development.md:37` </location>
<code_context>
The project includes a hot-reloading utility (`tux/utils/hot_reload.py`).
-When the bot is running locally via `poetry run tux --dev start`, this utility watches for changes in the `tux/cogs/` directory. It attempts to automatically reload modified cogs or cogs affected by changes in watched utility files without requiring a full bot restart.
+When the bot is running locally via `uv run tux --dev start`, this utility watches for changes in the `tux/cogs/` directory. It attempts to automatically reload modified cogs or cogs affected by changes in watched utility files without requiring a full bot restart.
-This significantly speeds up development for cog-related changes. Note that changes outside the watched directories (e.g., core bot logic, dependencies) may still require a manual restart (`Ctrl+C` and run the start command again).
</code_context>
<issue_to_address>
Update directory and terminology to match new module structure.
Please update all directory and terminology references to align with the new module structure for consistency.
</issue_to_address>
## Security Issues
### Issue 1
<location> `Dockerfile:259` </location>
<issue_to_address>
**security (dockerfile.security.missing-user):** By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than 'root'.
```suggestion
USER non-root
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"]
```
*Source: opengrep*
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
# --- Common Helpers --- | ||
|
||
|
||
def safe_set_name(obj: Any, name: str) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): safe_set_name may fail silently if set_name is not callable.
Add a check to ensure set_name is callable before invoking it to prevent silent failures.
raise | ||
|
||
|
||
def instrument_bot_commands(bot: commands.Bot) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: Instrumenting bot commands by replacing callbacks may interfere with other decorators.
Directly replacing the command callback can disrupt existing decorators or attributes. Using a wrapper or middleware would help maintain original metadata.
src/tux/core/container.py
Outdated
return descriptor.instance | ||
|
||
# Create new instance | ||
self._resolution_stack.add(service_type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Using a set for _resolution_stack may not preserve dependency order for error reporting.
Consider replacing the set with a list or stack to maintain resolution order, which will improve error messages for circular dependencies.
Suggested implementation:
# Create new instance
self._resolution_stack.append(service_type)
try:
except Exception as e:
stack_trace = " -> ".join([t.__name__ for t in self._resolution_stack])
logger.error(f"Failed to resolve {service_type.__name__}: {e}\nResolution stack: {stack_trace}")
error_msg = f"Cannot resolve {service_type.__name__} (resolution stack: {stack_trace})"
raise ServiceResolutionError(error_msg) from e
else:
resolution_time = time.perf_counter() - start_time
# Only log if resolution takes longer than expected or fails
if resolution_time > 0.001: # Log if takes more than 1ms
logger.debug(f"Slow resolution: {service_type.__name__} took {resolution_time:.4f}s")
self._resolution_stack.pop()
You will also need to:
- Change the initialization of
self._resolution_stack
from a set to a list (e.g.,self._resolution_stack = []
). - Update any other code that checks membership (
in
) or removes items from_resolution_stack
to use list semantics. - If you have circular dependency checks, you can still use
if service_type in self._resolution_stack:
for lists.
src/tux/core/container.py
Outdated
# Resolve the dependency | ||
dependency = self._resolve_service(param_type) | ||
|
||
if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD: | ||
if param.default is inspect.Parameter.empty: | ||
args.append(dependency) | ||
else: | ||
kwargs[param.name] = dependency | ||
elif param.kind == inspect.Parameter.KEYWORD_ONLY: | ||
kwargs[param.name] = dependency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Does not handle VAR_POSITIONAL or VAR_KEYWORD constructor parameters.
Currently, *args and **kwargs in service constructors are not processed. Please add explicit handling for VAR_POSITIONAL and VAR_KEYWORD parameters, either by raising an error or documenting their unsupported status.
# Resolve the dependency | |
dependency = self._resolve_service(param_type) | |
if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD: | |
if param.default is inspect.Parameter.empty: | |
args.append(dependency) | |
else: | |
kwargs[param.name] = dependency | |
elif param.kind == inspect.Parameter.KEYWORD_ONLY: | |
kwargs[param.name] = dependency | |
# Resolve the dependency | |
dependency = self._resolve_service(param_type) | |
if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD: | |
if param.default is inspect.Parameter.empty: | |
args.append(dependency) | |
else: | |
kwargs[param.name] = dependency | |
elif param.kind == inspect.Parameter.KEYWORD_ONLY: | |
kwargs[param.name] = dependency | |
elif param.kind == inspect.Parameter.VAR_POSITIONAL: | |
raise ServiceResolutionError( | |
f"Constructor parameter '*{param.name}' in {impl_type.__name__} is not supported by the DI container" | |
) | |
elif param.kind == inspect.Parameter.VAR_KEYWORD: | |
raise ServiceResolutionError( | |
f"Constructor parameter '**{param.name}' in {impl_type.__name__} is not supported by the DI container" | |
) |
The project includes a hot-reloading utility (`tux/utils/hot_reload.py`). | ||
|
||
When the bot is running locally via `poetry run tux --dev start`, this utility watches for changes in the `tux/cogs/` directory. It attempts to automatically reload modified cogs or cogs affected by changes in watched utility files without requiring a full bot restart. | ||
When the bot is running locally via `uv run tux --dev start`, this utility watches for changes in the `tux/cogs/` directory. It attempts to automatically reload modified cogs or cogs affected by changes in watched utility files without requiring a full bot restart. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Update directory and terminology to match new module structure.
Please update all directory and terminology references to align with the new module structure for consistency.
Dockerfile
Outdated
# WORKFLOW: Regenerates Prisma client and starts the bot in development mode | ||
# This ensures the database client is always up-to-date with schema changes | ||
CMD ["sh", "-c", "poetry run prisma generate && exec poetry run tux --dev start"] | ||
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
security (dockerfile.security.missing-user): By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than 'root'.
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"] | |
USER non-root | |
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"] |
Source: opengrep
tests/e2e/test_smoke_e2e.py
Outdated
# Keep E2E minimal and deterministic; expand with CLI or HTTP flows later | ||
assert True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code-quality): Remove assert True
statements (remove-assert-true
)
# Keep E2E minimal and deterministic; expand with CLI or HTTP flows later | |
assert True | |
pass |
# Example of an integration placeholder; expand with real IO later | ||
assert 1 + 1 == 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code-quality): We've found these issues:
- Remove
assert True
statements (remove-assert-true
) - Simplify numeric comparison (
simplify-numeric-comparison
) - Simplify x == x -> True and x != x -> False (
equality-identity
)
# Example of an integration placeholder; expand with real IO later | |
assert 1 + 1 == 2 | |
pass |
tests/unit/test_smoke.py
Outdated
|
||
@pytest.mark.unit | ||
def test_smoke() -> None: | ||
assert True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code-quality): Remove assert True
statements (remove-assert-true
)
assert True | |
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @kzndotsh - I've reviewed your changes and they look great!
Blocking issues:
- By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than 'root'. (link)
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/tux/services/sentry_manager.py:582` </location>
<code_context>
+ for key, value in tags.items():
+ scope.set_tag(key, value)
+
+ def set_user_context(self, user: discord.User | discord.Member) -> None:
+ """
+ Sets the user context for the current Sentry scope.
</code_context>
<issue_to_address>
set_user_context may expose sensitive user information.
Review the user and member fields being attached to Sentry to ensure only essential, non-sensitive information is included, particularly for production use.
</issue_to_address>
### Comment 2
<location> `src/tux/core/container.py:57` </location>
<code_context>
+ """Initialize an empty service container."""
+ self._services: dict[type, ServiceDescriptor] = {}
+ self._singleton_instances: dict[type, Any] = {}
+ self._resolution_stack: set[type] = set()
+
+ def register_singleton(self, service_type: type[T], implementation: type[T] | None = None) -> "ServiceContainer":
</code_context>
<issue_to_address>
Using a set for the resolution stack may obscure the actual dependency chain in circular dependency errors.
Using a list for the resolution stack will preserve the order of dependencies, making circular dependency errors easier to trace.
Suggested implementation:
```python
self._resolution_stack: list[type] = []
```
You will need to update all usages of `_resolution_stack` throughout the file:
- Replace `.add(x)` with `.append(x)`
- Replace `.remove(x)` with `.pop()` (if popping the last item) or `del` (if removing by index)
- If checking for membership, `x in self._resolution_stack` still works
- When reporting circular dependencies, you can now print the stack in order for better error messages
</issue_to_address>
### Comment 3
<location> `src/tux/core/container.py:235` </location>
<code_context>
+ descriptor = self._services[service_type]
+
+ # Return existing instance for singletons
+ if descriptor.lifetime == ServiceLifetime.SINGLETON:
+ if service_type in self._singleton_instances:
+ return self._singleton_instances[service_type]
+
+ # If we have a pre-registered instance, return it
+ if descriptor.instance is not None:
+ return descriptor.instance
+
</code_context>
<issue_to_address>
Singleton instance caching logic may be redundant if both instance and _singleton_instances are used.
Consolidate singleton instance handling to ensure a single source of truth and prevent precedence ambiguity.
Suggested implementation:
```python
# Return existing instance for singletons
if descriptor.lifetime == ServiceLifetime.SINGLETON:
if service_type in self._singleton_instances:
return self._singleton_instances[service_type]
```
To fully implement this, you must ensure that any pre-registered singleton instance (previously stored in `descriptor.instance`) is instead stored in `_singleton_instances` at registration time. This may require updating your service registration logic elsewhere in the codebase to move any instance assignment to `_singleton_instances`.
</issue_to_address>
### Comment 4
<location> `src/tux/core/context.py:95` </location>
<code_context>
+ A dictionary with standardized context keys like `user_id`,
+ `command_name`, `guild_id`, `command_type`, etc.
+ """
+ user = source.user if isinstance(source, Interaction) else source.author
+
+ # Base context is common to both types
</code_context>
<issue_to_address>
Assumes that both Context and Interaction have user/author attributes, which may not always be true.
Add error handling or a fallback to prevent AttributeError if the expected attribute is missing.
</issue_to_address>
## Security Issues
### Issue 1
<location> `Dockerfile:259` </location>
<issue_to_address>
**security (dockerfile.security.missing-user):** By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than 'root'.
```suggestion
USER non-root
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"]
```
*Source: opengrep*
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
src/tux/services/sentry_manager.py
Outdated
for key, value in tags.items(): | ||
scope.set_tag(key, value) | ||
|
||
def set_user_context(self, user: discord.User | discord.Member) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 suggestion (security): set_user_context may expose sensitive user information.
Review the user and member fields being attached to Sentry to ensure only essential, non-sensitive information is included, particularly for production use.
src/tux/core/container.py
Outdated
"""Initialize an empty service container.""" | ||
self._services: dict[type, ServiceDescriptor] = {} | ||
self._singleton_instances: dict[type, Any] = {} | ||
self._resolution_stack: set[type] = set() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Using a set for the resolution stack may obscure the actual dependency chain in circular dependency errors.
Using a list for the resolution stack will preserve the order of dependencies, making circular dependency errors easier to trace.
Suggested implementation:
self._resolution_stack: list[type] = []
You will need to update all usages of _resolution_stack
throughout the file:
- Replace
.add(x)
with.append(x)
- Replace
.remove(x)
with.pop()
(if popping the last item) ordel
(if removing by index) - If checking for membership,
x in self._resolution_stack
still works - When reporting circular dependencies, you can now print the stack in order for better error messages
src/tux/core/container.py
Outdated
if descriptor.lifetime == ServiceLifetime.SINGLETON: | ||
if service_type in self._singleton_instances: | ||
return self._singleton_instances[service_type] | ||
|
||
# If we have a pre-registered instance, return it | ||
if descriptor.instance is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Singleton instance caching logic may be redundant if both instance and _singleton_instances are used.
Consolidate singleton instance handling to ensure a single source of truth and prevent precedence ambiguity.
Suggested implementation:
# Return existing instance for singletons
if descriptor.lifetime == ServiceLifetime.SINGLETON:
if service_type in self._singleton_instances:
return self._singleton_instances[service_type]
To fully implement this, you must ensure that any pre-registered singleton instance (previously stored in descriptor.instance
) is instead stored in _singleton_instances
at registration time. This may require updating your service registration logic elsewhere in the codebase to move any instance assignment to _singleton_instances
.
src/tux/core/context.py
Outdated
A dictionary with standardized context keys like `user_id`, | ||
`command_name`, `guild_id`, `command_type`, etc. | ||
""" | ||
user = source.user if isinstance(source, Interaction) else source.author |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: Assumes that both Context and Interaction have user/author attributes, which may not always be true.
Add error handling or a fallback to prevent AttributeError if the expected attribute is missing.
Dockerfile
Outdated
# WORKFLOW: Regenerates Prisma client and starts the bot in development mode | ||
# This ensures the database client is always up-to-date with schema changes | ||
CMD ["sh", "-c", "poetry run prisma generate && exec poetry run tux --dev start"] | ||
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
security (dockerfile.security.missing-user): By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than 'root'.
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"] | |
USER non-root | |
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"] |
Source: opengrep
tests/e2e/test_smoke_e2e.py
Outdated
# Keep E2E minimal and deterministic; expand with CLI or HTTP flows later | ||
assert True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code-quality): Remove assert True
statements (remove-assert-true
)
# Keep E2E minimal and deterministic; expand with CLI or HTTP flows later | |
assert True | |
pass |
# Example of an integration placeholder; expand with real IO later | ||
assert 1 + 1 == 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code-quality): We've found these issues:
- Remove
assert True
statements (remove-assert-true
) - Simplify numeric comparison (
simplify-numeric-comparison
) - Simplify x == x -> True and x != x -> False (
equality-identity
)
# Example of an integration placeholder; expand with real IO later | |
assert 1 + 1 == 2 | |
pass |
tests/unit/test_smoke.py
Outdated
|
||
@pytest.mark.unit | ||
def test_smoke() -> None: | ||
assert True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code-quality): Remove assert True
statements (remove-assert-true
)
assert True | |
pass |
|
src/tux/database/migrations/versions/2025_08_19_0437-12574673e637_initial_baseline_migration.py
Outdated
Show resolved
Hide resolved
src/tux/database/migrations/versions/2025_08_19_0437-12574673e637_initial_baseline_migration.py
Outdated
Show resolved
Hide resolved
src/tux/database/migrations/versions/2025_08_19_0437-12574673e637_initial_baseline_migration.py
Outdated
Show resolved
Hide resolved
src/tux/database/migrations/versions/2025_08_19_0437-12574673e637_initial_baseline_migration.py
Outdated
Show resolved
Hide resolved
src/tux/database/migrations/versions/2025_08_19_0437-12574673e637_initial_baseline_migration.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
ruff
from .fixtures.database_fixtures import *
used; unable to detect undefined names
Line 268 in 08bde8f
from .fixtures.database_fixtures import * # type: ignore[import-untyped] |
Import block is un-sorted or un-formatted
Line 268 in 08bde8f
from .fixtures.database_fixtures import * # type: ignore[import-untyped] |
import
should be at the top-level of a file
Line 375 in 08bde8f
from tux.database.controllers.guild import GuildController |
import
should be at the top-level of a file
Line 382 in 08bde8f
from tux.database.controllers.guild_config import GuildConfigController |
import
should be at the top-level of a file
Line 465 in 08bde8f
import json |
Single quotes found but double quotes preferred
Line 549 in 08bde8f
if any(fixture in item.fixturenames for fixture in ['async_db_service']): |
Single quotes found but double quotes preferred
Line 553 in 08bde8f
elif any(fixture in item.fixturenames for fixture in ['db_session', 'pglite_engine']): |
Single quotes found but double quotes preferred
Line 553 in 08bde8f
elif any(fixture in item.fixturenames for fixture in ['db_session', 'pglite_engine']): |
Redefinition of unused pytest_configure
from line 44
Line 577 in 08bde8f
def pytest_configure(config): |
Use a single if
statement instead of nested if
statements
Lines 585 to 586 in 08bde8f
if item.config.getoption("--unit-only"): | |
if "integration" in [mark.name for mark in item.iter_markers()]: |
Use a single if
statement instead of nested if
statements
Lines 589 to 590 in 08bde8f
if not item.config.getoption("--integration"): | |
if "integration" in [mark.name for mark in item.iter_markers()]: |
Import block is un-sorted or un-formatted
tux/tests/fixtures/database_fixtures.py
Lines 15 to 21 in 08bde8f
from typing import Any | |
import pytest | |
import pytest_asyncio | |
from sqlmodel import Session | |
from tux.database.service import DatabaseService | |
from tux.database.models.models import Guild, GuildConfig |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 82 in 08bde8f
'guild': guild, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 83 in 08bde8f
'config': config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 84 in 08bde8f
'guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 85 in 08bde8f
'channel_ids': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 86 in 08bde8f
'mod_log': TEST_CHANNEL_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 87 in 08bde8f
'audit_log': TEST_CHANNEL_ID + 1, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 88 in 08bde8f
'starboard': TEST_CHANNEL_ID + 2, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 135 in 08bde8f
'guild': guild, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 136 in 08bde8f
'config': config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 137 in 08bde8f
'guild_id': guild_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 144 in 08bde8f
db_session.refresh(data['guild']) |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 145 in 08bde8f
db_session.refresh(data['config']) |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 148 in 08bde8f
'guilds': guilds_data, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 149 in 08bde8f
'total_guilds': len(guilds_data), |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 150 in 08bde8f
'test_constants': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 151 in 08bde8f
'base_guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 152 in 08bde8f
'base_channel_id': TEST_CHANNEL_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 183 in 08bde8f
'guild': guild, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 184 in 08bde8f
'config': config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 185 in 08bde8f
'guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 186 in 08bde8f
'guild_controller': async_db_service.guild, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 187 in 08bde8f
'guild_config_controller': async_db_service.guild_config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 188 in 08bde8f
'channel_ids': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 189 in 08bde8f
'mod_log': TEST_CHANNEL_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 190 in 08bde8f
'audit_log': TEST_CHANNEL_ID + 1, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 191 in 08bde8f
'starboard': TEST_CHANNEL_ID + 2, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 219 in 08bde8f
'guild': guild, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 220 in 08bde8f
'config': config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 221 in 08bde8f
'db_service': async_db_service, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 222 in 08bde8f
'test_constants': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 223 in 08bde8f
'guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 224 in 08bde8f
'user_id': TEST_USER_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 225 in 08bde8f
'channel_id': TEST_CHANNEL_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 226 in 08bde8f
'moderator_id': TEST_MODERATOR_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 259 in 08bde8f
'guild': guild, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 260 in 08bde8f
'config': config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 261 in 08bde8f
'session': db_session, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 262 in 08bde8f
'relationship_data': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 263 in 08bde8f
'guild_to_config': guild.guild_id == config.guild_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 264 in 08bde8f
'log_channels': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 265 in 08bde8f
'mod_log_id': config.mod_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 266 in 08bde8f
'audit_log_id': config.audit_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 267 in 08bde8f
'join_log_id': config.join_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 268 in 08bde8f
'private_log_id': config.private_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 269 in 08bde8f
'report_log_id': config.report_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 270 in 08bde8f
'dev_log_id': config.dev_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 294 in 08bde8f
'guild': guild, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 295 in 08bde8f
'config': config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 296 in 08bde8f
'db_service': async_db_service, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 297 in 08bde8f
'relationship_data': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 298 in 08bde8f
'guild_to_config': guild.guild_id == config.guild_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 299 in 08bde8f
'log_channels': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 300 in 08bde8f
'mod_log_id': config.mod_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 301 in 08bde8f
'audit_log_id': config.audit_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 302 in 08bde8f
'join_log_id': config.join_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 303 in 08bde8f
'private_log_id': config.private_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 304 in 08bde8f
'report_log_id': config.report_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 305 in 08bde8f
'dev_log_id': config.dev_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 319 in 08bde8f
'invalid_guild_id': 999999999999999999, # Non-existent guild |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 320 in 08bde8f
'valid_guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 321 in 08bde8f
'test_prefix': "!invalid", |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 329 in 08bde8f
'guild_config_controller': async_db_service.guild_config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 330 in 08bde8f
'invalid_guild_id': 999999999999999999, # Non-existent guild |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 331 in 08bde8f
'valid_guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 332 in 08bde8f
'test_prefix': "!invalid", |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 343 in 08bde8f
hasattr(guild, 'guild_id') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 344 in 08bde8f
hasattr(guild, 'case_count') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 345 in 08bde8f
hasattr(guild, 'guild_joined_at') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 354 in 08bde8f
hasattr(config, 'guild_id') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 355 in 08bde8f
hasattr(config, 'prefix') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 395 in 08bde8f
'guilds': guilds, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 396 in 08bde8f
'configs': configs, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 397 in 08bde8f
'session': db_session, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 398 in 08bde8f
'count': 10, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 422 in 08bde8f
'guilds': guilds, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 423 in 08bde8f
'configs': configs, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 424 in 08bde8f
'db_service': async_db_service, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 425 in 08bde8f
'count': 10, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 436 in 08bde8f
'guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 437 in 08bde8f
'case_count': 0, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 438 in 08bde8f
'guild_joined_at': None, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 445 in 08bde8f
'guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 446 in 08bde8f
'prefix': "!", |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 447 in 08bde8f
'mod_log_id': TEST_CHANNEL_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 448 in 08bde8f
'audit_log_id': TEST_CHANNEL_ID + 1, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 449 in 08bde8f
'starboard_channel_id': TEST_CHANNEL_ID + 2, |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_controllers.py
Lines 1 to 12 in 08bde8f
import pytest | |
from collections.abc import Generator | |
from sqlalchemy.orm import Session, sessionmaker | |
from sqlalchemy.engine import Engine | |
from py_pglite.config import PGliteConfig | |
from py_pglite.sqlalchemy import SQLAlchemyPGliteManager | |
from tux.database.controllers import ( | |
GuildController, GuildConfigController, | |
) |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_migrations.py
Lines 19 to 28 in 08bde8f
import pytest | |
from sqlalchemy.engine import Engine | |
from sqlalchemy import text | |
from tux.database.service import DatabaseService | |
from tux.database.controllers import ( | |
GuildController, GuildConfigController, | |
) | |
from tux.database.models import Guild |
import
should be at the top-level of a file
import urllib.parse |
Single quotes found but double quotes preferred
if socket_path := query_params.get('host', [''])[0]: |
Single quotes found but double quotes preferred
if socket_path := query_params.get('host', [''])[0]: |
Use contextlib.suppress(Exception)
instead of try
-except
-pass
tux/tests/unit/test_database_migrations.py
Lines 364 to 369 in 08bde8f
try: | |
await guild_controller.create_guild(guild_id=TEST_GUILD_ID) | |
# If we get here, the service should handle disconnection gracefully | |
except Exception: | |
# Expected when not connected | |
pass |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_models.py
Lines 17 to 31 in 08bde8f
import pytest | |
from datetime import datetime | |
from typing import Any | |
from sqlalchemy import text | |
from sqlmodel import desc | |
from sqlmodel import Session, select | |
from tux.database.models.models import Guild, GuildConfig, CaseType, Case | |
from tests.fixtures.database_fixtures import ( | |
validate_guild_structure, | |
validate_guild_config_structure, | |
validate_relationship_integrity, | |
TEST_GUILD_ID, | |
TEST_CHANNEL_ID, | |
) |
Do not assert blind exception: Exception
tux/tests/unit/test_database_models.py
Line 178 in 08bde8f
with pytest.raises(Exception): # SQLAlchemy integrity error |
Do not assert blind exception: Exception
tux/tests/unit/test_database_models.py
Line 193 in 08bde8f
with pytest.raises(Exception): # Unique constraint violation |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 237 in 08bde8f
assert 'guild_id' in guild_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 238 in 08bde8f
assert 'case_count' in guild_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 239 in 08bde8f
assert 'guild_joined_at' in guild_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 242 in 08bde8f
assert guild_dict['guild_id'] == sample_guild.guild_id |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 243 in 08bde8f
assert guild_dict['case_count'] == sample_guild.case_count |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 252 in 08bde8f
assert 'guild_id' in config_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 253 in 08bde8f
assert 'prefix' in config_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 256 in 08bde8f
assert config_dict['guild_id'] == sample_guild_config.guild_id |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 257 in 08bde8f
assert config_dict['prefix'] == sample_guild_config.prefix |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 282 in 08bde8f
assert case_dict['case_type'] == CaseType.WARN.name # Should be enum name |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 495 in 08bde8f
guilds_data: list[dict[str, Any]] = populated_test_database['guilds'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 500 in 08bde8f
guild_dict = data['guild'].to_dict() # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 501 in 08bde8f
config_dict = data['config'].to_dict() # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 502 in 08bde8f
results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 502 in 08bde8f
results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 504 in 08bde8f
assert len(results) == populated_test_database['total_guilds'] # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 508 in 08bde8f
assert 'guild' in result |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 509 in 08bde8f
assert 'config' in result |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 510 in 08bde8f
assert 'guild_id' in result['guild'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 510 in 08bde8f
assert 'guild_id' in result['guild'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 511 in 08bde8f
assert 'guild_id' in result['config'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 511 in 08bde8f
assert 'guild_id' in result['config'] |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_postgresql_features.py
Lines 17 to 21 in 08bde8f
import pytest | |
from sqlmodel import Session | |
from tux.database.models.models import Guild, GuildConfig, CaseType, Case | |
from tests.fixtures.database_fixtures import TEST_GUILD_ID |
Use a list comprehension to create a transformed list
tux/tests/unit/test_database_postgresql_features.py
Lines 155 to 161 in 08bde8f
guild_data.append({ | |
"guild_id": TEST_GUILD_ID + 100 + i, | |
"case_count": i, | |
"tags": [f"tag_{i}", "common_tag"], | |
"guild_metadata": {"batch_id": 1, "index": i}, | |
"feature_flags": {"active": i % 2 == 0}, | |
}) |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_service.py
Lines 18 to 23 in 08bde8f
import pytest | |
from sqlalchemy import text | |
from sqlmodel import SQLModel, Session, select | |
from tux.database.models.models import Guild, GuildConfig | |
from tux.database.service import DatabaseService |
sqlmodel.SQLModel
imported but unused
tux/tests/unit/test_database_service.py
Line 20 in 08bde8f
from sqlmodel import SQLModel, Session, select |
Do not assert blind exception: Exception
tux/tests/unit/test_database_service.py
Line 132 in 08bde8f
with pytest.raises(Exception): # SQLAlchemy integrity error |
import
should be at the top-level of a file
tux/tests/unit/test_database_service.py
Line 268 in 08bde8f
import random |
import
should be at the top-level of a file
tux/tests/unit/test_database_service.py
Line 344 in 08bde8f
from sqlalchemy.orm import selectinload |
sqlalchemy.orm.selectinload
imported but unused
tux/tests/unit/test_database_service.py
Line 344 in 08bde8f
from sqlalchemy.orm import selectinload |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
ruff
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 184 in 2740b35
'config': config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 185 in 2740b35
'guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 186 in 2740b35
'guild_controller': async_db_service.guild, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 187 in 2740b35
'guild_config_controller': async_db_service.guild_config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 188 in 2740b35
'channel_ids': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 189 in 2740b35
'mod_log': TEST_CHANNEL_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 190 in 2740b35
'audit_log': TEST_CHANNEL_ID + 1, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 191 in 2740b35
'starboard': TEST_CHANNEL_ID + 2, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 219 in 2740b35
'guild': guild, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 220 in 2740b35
'config': config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 221 in 2740b35
'db_service': async_db_service, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 222 in 2740b35
'test_constants': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 223 in 2740b35
'guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 224 in 2740b35
'user_id': TEST_USER_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 225 in 2740b35
'channel_id': TEST_CHANNEL_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 226 in 2740b35
'moderator_id': TEST_MODERATOR_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 259 in 2740b35
'guild': guild, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 260 in 2740b35
'config': config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 261 in 2740b35
'session': db_session, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 262 in 2740b35
'relationship_data': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 263 in 2740b35
'guild_to_config': guild.guild_id == config.guild_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 264 in 2740b35
'log_channels': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 265 in 2740b35
'mod_log_id': config.mod_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 266 in 2740b35
'audit_log_id': config.audit_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 267 in 2740b35
'join_log_id': config.join_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 268 in 2740b35
'private_log_id': config.private_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 269 in 2740b35
'report_log_id': config.report_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 270 in 2740b35
'dev_log_id': config.dev_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 294 in 2740b35
'guild': guild, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 295 in 2740b35
'config': config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 296 in 2740b35
'db_service': async_db_service, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 297 in 2740b35
'relationship_data': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 298 in 2740b35
'guild_to_config': guild.guild_id == config.guild_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 299 in 2740b35
'log_channels': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 300 in 2740b35
'mod_log_id': config.mod_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 301 in 2740b35
'audit_log_id': config.audit_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 302 in 2740b35
'join_log_id': config.join_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 303 in 2740b35
'private_log_id': config.private_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 304 in 2740b35
'report_log_id': config.report_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 305 in 2740b35
'dev_log_id': config.dev_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 319 in 2740b35
'invalid_guild_id': 999999999999999999, # Non-existent guild |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 320 in 2740b35
'valid_guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 321 in 2740b35
'test_prefix': "!invalid", |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 329 in 2740b35
'guild_config_controller': async_db_service.guild_config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 330 in 2740b35
'invalid_guild_id': 999999999999999999, # Non-existent guild |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 331 in 2740b35
'valid_guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 332 in 2740b35
'test_prefix': "!invalid", |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 343 in 2740b35
hasattr(guild, 'guild_id') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 344 in 2740b35
hasattr(guild, 'case_count') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 345 in 2740b35
hasattr(guild, 'guild_joined_at') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 354 in 2740b35
hasattr(config, 'guild_id') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 355 in 2740b35
hasattr(config, 'prefix') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 395 in 2740b35
'guilds': guilds, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 396 in 2740b35
'configs': configs, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 397 in 2740b35
'session': db_session, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 398 in 2740b35
'count': 10, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 422 in 2740b35
'guilds': guilds, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 423 in 2740b35
'configs': configs, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 424 in 2740b35
'db_service': async_db_service, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 425 in 2740b35
'count': 10, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 436 in 2740b35
'guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 437 in 2740b35
'case_count': 0, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 438 in 2740b35
'guild_joined_at': None, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 445 in 2740b35
'guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 446 in 2740b35
'prefix': "!", |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 447 in 2740b35
'mod_log_id': TEST_CHANNEL_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 448 in 2740b35
'audit_log_id': TEST_CHANNEL_ID + 1, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 449 in 2740b35
'starboard_channel_id': TEST_CHANNEL_ID + 2, |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_controllers.py
Lines 1 to 12 in 2740b35
import pytest | |
from collections.abc import Generator | |
from sqlalchemy.orm import Session, sessionmaker | |
from sqlalchemy.engine import Engine | |
from py_pglite.config import PGliteConfig | |
from py_pglite.sqlalchemy import SQLAlchemyPGliteManager | |
from tux.database.controllers import ( | |
GuildController, GuildConfigController, | |
) |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_migrations.py
Lines 19 to 28 in 2740b35
import pytest | |
from sqlalchemy.engine import Engine | |
from sqlalchemy import text | |
from tux.database.service import DatabaseService | |
from tux.database.controllers import ( | |
GuildController, GuildConfigController, | |
) | |
from tux.database.models import Guild |
import
should be at the top-level of a file
import urllib.parse |
Single quotes found but double quotes preferred
if socket_path := query_params.get('host', [''])[0]: |
Single quotes found but double quotes preferred
if socket_path := query_params.get('host', [''])[0]: |
Use contextlib.suppress(Exception)
instead of try
-except
-pass
tux/tests/unit/test_database_migrations.py
Lines 364 to 369 in 2740b35
try: | |
await guild_controller.create_guild(guild_id=TEST_GUILD_ID) | |
# If we get here, the service should handle disconnection gracefully | |
except Exception: | |
# Expected when not connected | |
pass |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_models.py
Lines 17 to 31 in 2740b35
import pytest | |
from datetime import datetime | |
from typing import Any | |
from sqlalchemy import text | |
from sqlmodel import desc | |
from sqlmodel import Session, select | |
from tux.database.models.models import Guild, GuildConfig, CaseType, Case | |
from tests.fixtures.database_fixtures import ( | |
validate_guild_structure, | |
validate_guild_config_structure, | |
validate_relationship_integrity, | |
TEST_GUILD_ID, | |
TEST_CHANNEL_ID, | |
) |
Do not assert blind exception: Exception
tux/tests/unit/test_database_models.py
Line 178 in 2740b35
with pytest.raises(Exception): # SQLAlchemy integrity error |
Do not assert blind exception: Exception
tux/tests/unit/test_database_models.py
Line 193 in 2740b35
with pytest.raises(Exception): # Unique constraint violation |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 237 in 2740b35
assert 'guild_id' in guild_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 238 in 2740b35
assert 'case_count' in guild_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 239 in 2740b35
assert 'guild_joined_at' in guild_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 242 in 2740b35
assert guild_dict['guild_id'] == sample_guild.guild_id |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 243 in 2740b35
assert guild_dict['case_count'] == sample_guild.case_count |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 252 in 2740b35
assert 'guild_id' in config_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 253 in 2740b35
assert 'prefix' in config_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 256 in 2740b35
assert config_dict['guild_id'] == sample_guild_config.guild_id |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 257 in 2740b35
assert config_dict['prefix'] == sample_guild_config.prefix |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 282 in 2740b35
assert case_dict['case_type'] == CaseType.WARN.name # Should be enum name |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 495 in 2740b35
guilds_data: list[dict[str, Any]] = populated_test_database['guilds'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 500 in 2740b35
guild_dict = data['guild'].to_dict() # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 501 in 2740b35
config_dict = data['config'].to_dict() # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 502 in 2740b35
results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 502 in 2740b35
results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 504 in 2740b35
assert len(results) == populated_test_database['total_guilds'] # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 508 in 2740b35
assert 'guild' in result |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 509 in 2740b35
assert 'config' in result |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 510 in 2740b35
assert 'guild_id' in result['guild'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 510 in 2740b35
assert 'guild_id' in result['guild'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 511 in 2740b35
assert 'guild_id' in result['config'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 511 in 2740b35
assert 'guild_id' in result['config'] |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_postgresql_features.py
Lines 17 to 21 in 2740b35
import pytest | |
from sqlmodel import Session | |
from tux.database.models.models import Guild, GuildConfig, CaseType, Case | |
from tests.fixtures.database_fixtures import TEST_GUILD_ID |
Use a list comprehension to create a transformed list
tux/tests/unit/test_database_postgresql_features.py
Lines 155 to 161 in 2740b35
guild_data.append({ | |
"guild_id": TEST_GUILD_ID + 100 + i, | |
"case_count": i, | |
"tags": [f"tag_{i}", "common_tag"], | |
"guild_metadata": {"batch_id": 1, "index": i}, | |
"feature_flags": {"active": i % 2 == 0}, | |
}) |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_service.py
Lines 18 to 23 in 2740b35
import pytest | |
from sqlalchemy import text | |
from sqlmodel import SQLModel, Session, select | |
from tux.database.models.models import Guild, GuildConfig | |
from tux.database.service import DatabaseService |
sqlmodel.SQLModel
imported but unused
tux/tests/unit/test_database_service.py
Line 20 in 2740b35
from sqlmodel import SQLModel, Session, select |
Do not assert blind exception: Exception
tux/tests/unit/test_database_service.py
Line 132 in 2740b35
with pytest.raises(Exception): # SQLAlchemy integrity error |
import
should be at the top-level of a file
tux/tests/unit/test_database_service.py
Line 268 in 2740b35
import random |
import
should be at the top-level of a file
tux/tests/unit/test_database_service.py
Line 344 in 2740b35
from sqlalchemy.orm import selectinload |
sqlalchemy.orm.selectinload
imported but unused
tux/tests/unit/test_database_service.py
Line 344 in 2740b35
from sqlalchemy.orm import selectinload |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
ruff
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 296 in 8a693b1
'db_service': async_db_service, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 297 in 8a693b1
'relationship_data': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 298 in 8a693b1
'guild_to_config': guild.guild_id == config.guild_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 299 in 8a693b1
'log_channels': { |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 300 in 8a693b1
'mod_log_id': config.mod_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 301 in 8a693b1
'audit_log_id': config.audit_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 302 in 8a693b1
'join_log_id': config.join_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 303 in 8a693b1
'private_log_id': config.private_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 304 in 8a693b1
'report_log_id': config.report_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 305 in 8a693b1
'dev_log_id': config.dev_log_id, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 319 in 8a693b1
'invalid_guild_id': 999999999999999999, # Non-existent guild |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 320 in 8a693b1
'valid_guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 321 in 8a693b1
'test_prefix': "!invalid", |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 329 in 8a693b1
'guild_config_controller': async_db_service.guild_config, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 330 in 8a693b1
'invalid_guild_id': 999999999999999999, # Non-existent guild |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 331 in 8a693b1
'valid_guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 332 in 8a693b1
'test_prefix': "!invalid", |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 343 in 8a693b1
hasattr(guild, 'guild_id') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 344 in 8a693b1
hasattr(guild, 'case_count') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 345 in 8a693b1
hasattr(guild, 'guild_joined_at') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 354 in 8a693b1
hasattr(config, 'guild_id') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 355 in 8a693b1
hasattr(config, 'prefix') and |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 395 in 8a693b1
'guilds': guilds, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 396 in 8a693b1
'configs': configs, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 397 in 8a693b1
'session': db_session, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 398 in 8a693b1
'count': 10, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 422 in 8a693b1
'guilds': guilds, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 423 in 8a693b1
'configs': configs, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 424 in 8a693b1
'db_service': async_db_service, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 425 in 8a693b1
'count': 10, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 436 in 8a693b1
'guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 437 in 8a693b1
'case_count': 0, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 438 in 8a693b1
'guild_joined_at': None, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 445 in 8a693b1
'guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 446 in 8a693b1
'prefix': "!", |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 447 in 8a693b1
'mod_log_id': TEST_CHANNEL_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 448 in 8a693b1
'audit_log_id': TEST_CHANNEL_ID + 1, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 449 in 8a693b1
'starboard_channel_id': TEST_CHANNEL_ID + 2, |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_controllers.py
Lines 1 to 12 in 8a693b1
import pytest | |
from collections.abc import Generator | |
from sqlalchemy.orm import Session, sessionmaker | |
from sqlalchemy.engine import Engine | |
from py_pglite.config import PGliteConfig | |
from py_pglite.sqlalchemy import SQLAlchemyPGliteManager | |
from tux.database.controllers import ( | |
GuildController, GuildConfigController, | |
) |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_migrations.py
Lines 19 to 28 in 8a693b1
import pytest | |
from sqlalchemy.engine import Engine | |
from sqlalchemy import text | |
from tux.database.service import DatabaseService | |
from tux.database.controllers import ( | |
GuildController, GuildConfigController, | |
) | |
from tux.database.models import Guild |
import
should be at the top-level of a file
import urllib.parse |
Single quotes found but double quotes preferred
if socket_path := query_params.get('host', [''])[0]: |
Single quotes found but double quotes preferred
if socket_path := query_params.get('host', [''])[0]: |
Use contextlib.suppress(Exception)
instead of try
-except
-pass
tux/tests/unit/test_database_migrations.py
Lines 364 to 369 in 8a693b1
try: | |
await guild_controller.create_guild(guild_id=TEST_GUILD_ID) | |
# If we get here, the service should handle disconnection gracefully | |
except Exception: | |
# Expected when not connected | |
pass |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_models.py
Lines 17 to 31 in 8a693b1
import pytest | |
from datetime import datetime | |
from typing import Any | |
from sqlalchemy import text | |
from sqlmodel import desc | |
from sqlmodel import Session, select | |
from tux.database.models.models import Guild, GuildConfig, CaseType, Case | |
from tests.fixtures.database_fixtures import ( | |
validate_guild_structure, | |
validate_guild_config_structure, | |
validate_relationship_integrity, | |
TEST_GUILD_ID, | |
TEST_CHANNEL_ID, | |
) |
Do not assert blind exception: Exception
tux/tests/unit/test_database_models.py
Line 178 in 8a693b1
with pytest.raises(Exception): # SQLAlchemy integrity error |
Do not assert blind exception: Exception
tux/tests/unit/test_database_models.py
Line 193 in 8a693b1
with pytest.raises(Exception): # Unique constraint violation |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 237 in 8a693b1
assert 'guild_id' in guild_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 238 in 8a693b1
assert 'case_count' in guild_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 239 in 8a693b1
assert 'guild_joined_at' in guild_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 242 in 8a693b1
assert guild_dict['guild_id'] == sample_guild.guild_id |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 243 in 8a693b1
assert guild_dict['case_count'] == sample_guild.case_count |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 252 in 8a693b1
assert 'guild_id' in config_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 253 in 8a693b1
assert 'prefix' in config_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 256 in 8a693b1
assert config_dict['guild_id'] == sample_guild_config.guild_id |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 257 in 8a693b1
assert config_dict['prefix'] == sample_guild_config.prefix |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 282 in 8a693b1
assert case_dict['case_type'] == CaseType.WARN.name # Should be enum name |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 495 in 8a693b1
guilds_data: list[dict[str, Any]] = populated_test_database['guilds'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 500 in 8a693b1
guild_dict = data['guild'].to_dict() # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 501 in 8a693b1
config_dict = data['config'].to_dict() # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 502 in 8a693b1
results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 502 in 8a693b1
results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 504 in 8a693b1
assert len(results) == populated_test_database['total_guilds'] # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 508 in 8a693b1
assert 'guild' in result |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 509 in 8a693b1
assert 'config' in result |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 510 in 8a693b1
assert 'guild_id' in result['guild'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 510 in 8a693b1
assert 'guild_id' in result['guild'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 511 in 8a693b1
assert 'guild_id' in result['config'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 511 in 8a693b1
assert 'guild_id' in result['config'] |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_postgresql_features.py
Lines 17 to 21 in 8a693b1
import pytest | |
from sqlmodel import Session | |
from tux.database.models.models import Guild, GuildConfig, CaseType, Case | |
from tests.fixtures.database_fixtures import TEST_GUILD_ID |
Use a list comprehension to create a transformed list
tux/tests/unit/test_database_postgresql_features.py
Lines 155 to 161 in 8a693b1
guild_data.append({ | |
"guild_id": TEST_GUILD_ID + 100 + i, | |
"case_count": i, | |
"tags": [f"tag_{i}", "common_tag"], | |
"guild_metadata": {"batch_id": 1, "index": i}, | |
"feature_flags": {"active": i % 2 == 0}, | |
}) |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_service.py
Lines 18 to 23 in 8a693b1
import pytest | |
from sqlalchemy import text | |
from sqlmodel import SQLModel, Session, select | |
from tux.database.models.models import Guild, GuildConfig | |
from tux.database.service import DatabaseService |
sqlmodel.SQLModel
imported but unused
tux/tests/unit/test_database_service.py
Line 20 in 8a693b1
from sqlmodel import SQLModel, Session, select |
Do not assert blind exception: Exception
tux/tests/unit/test_database_service.py
Line 132 in 8a693b1
with pytest.raises(Exception): # SQLAlchemy integrity error |
import
should be at the top-level of a file
tux/tests/unit/test_database_service.py
Line 268 in 8a693b1
import random |
import
should be at the top-level of a file
tux/tests/unit/test_database_service.py
Line 344 in 8a693b1
from sqlalchemy.orm import selectinload |
sqlalchemy.orm.selectinload
imported but unused
tux/tests/unit/test_database_service.py
Line 344 in 8a693b1
from sqlalchemy.orm import selectinload |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
ruff
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 436 in 65c39f1
'guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 437 in 65c39f1
'case_count': 0, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 438 in 65c39f1
'guild_joined_at': None, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 445 in 65c39f1
'guild_id': TEST_GUILD_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 446 in 65c39f1
'prefix': "!", |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 447 in 65c39f1
'mod_log_id': TEST_CHANNEL_ID, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 448 in 65c39f1
'audit_log_id': TEST_CHANNEL_ID + 1, |
Single quotes found but double quotes preferred
tux/tests/fixtures/database_fixtures.py
Line 449 in 65c39f1
'starboard_channel_id': TEST_CHANNEL_ID + 2, |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_controllers.py
Lines 1 to 12 in 65c39f1
import pytest | |
from collections.abc import Generator | |
from sqlalchemy.orm import Session, sessionmaker | |
from sqlalchemy.engine import Engine | |
from py_pglite.config import PGliteConfig | |
from py_pglite.sqlalchemy import SQLAlchemyPGliteManager | |
from tux.database.controllers import ( | |
GuildController, GuildConfigController, | |
) |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_migrations.py
Lines 19 to 28 in 65c39f1
import pytest | |
from sqlalchemy.engine import Engine | |
from sqlalchemy import text | |
from tux.database.service import DatabaseService | |
from tux.database.controllers import ( | |
GuildController, GuildConfigController, | |
) | |
from tux.database.models import Guild |
import
should be at the top-level of a file
import urllib.parse |
Single quotes found but double quotes preferred
if socket_path := query_params.get('host', [''])[0]: |
Single quotes found but double quotes preferred
if socket_path := query_params.get('host', [''])[0]: |
Use contextlib.suppress(Exception)
instead of try
-except
-pass
tux/tests/unit/test_database_migrations.py
Lines 364 to 369 in 65c39f1
try: | |
await guild_controller.create_guild(guild_id=TEST_GUILD_ID) | |
# If we get here, the service should handle disconnection gracefully | |
except Exception: | |
# Expected when not connected | |
pass |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_models.py
Lines 17 to 31 in 65c39f1
import pytest | |
from datetime import datetime | |
from typing import Any | |
from sqlalchemy import text | |
from sqlmodel import desc | |
from sqlmodel import Session, select | |
from tux.database.models.models import Guild, GuildConfig, CaseType, Case | |
from tests.fixtures.database_fixtures import ( | |
validate_guild_structure, | |
validate_guild_config_structure, | |
validate_relationship_integrity, | |
TEST_GUILD_ID, | |
TEST_CHANNEL_ID, | |
) |
Do not assert blind exception: Exception
tux/tests/unit/test_database_models.py
Line 178 in 65c39f1
with pytest.raises(Exception): # SQLAlchemy integrity error |
Do not assert blind exception: Exception
tux/tests/unit/test_database_models.py
Line 193 in 65c39f1
with pytest.raises(Exception): # Unique constraint violation |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 237 in 65c39f1
assert 'guild_id' in guild_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 238 in 65c39f1
assert 'case_count' in guild_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 239 in 65c39f1
assert 'guild_joined_at' in guild_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 242 in 65c39f1
assert guild_dict['guild_id'] == sample_guild.guild_id |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 243 in 65c39f1
assert guild_dict['case_count'] == sample_guild.case_count |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 252 in 65c39f1
assert 'guild_id' in config_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 253 in 65c39f1
assert 'prefix' in config_dict |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 256 in 65c39f1
assert config_dict['guild_id'] == sample_guild_config.guild_id |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 257 in 65c39f1
assert config_dict['prefix'] == sample_guild_config.prefix |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 282 in 65c39f1
assert case_dict['case_type'] == CaseType.WARN.name # Should be enum name |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 495 in 65c39f1
guilds_data: list[dict[str, Any]] = populated_test_database['guilds'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 500 in 65c39f1
guild_dict = data['guild'].to_dict() # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 501 in 65c39f1
config_dict = data['config'].to_dict() # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 502 in 65c39f1
results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 502 in 65c39f1
results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 504 in 65c39f1
assert len(results) == populated_test_database['total_guilds'] # type: ignore |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 508 in 65c39f1
assert 'guild' in result |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 509 in 65c39f1
assert 'config' in result |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 510 in 65c39f1
assert 'guild_id' in result['guild'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 510 in 65c39f1
assert 'guild_id' in result['guild'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 511 in 65c39f1
assert 'guild_id' in result['config'] |
Single quotes found but double quotes preferred
tux/tests/unit/test_database_models.py
Line 511 in 65c39f1
assert 'guild_id' in result['config'] |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_postgresql_features.py
Lines 17 to 21 in 65c39f1
import pytest | |
from sqlmodel import Session | |
from tux.database.models.models import Guild, GuildConfig, CaseType, Case | |
from tests.fixtures.database_fixtures import TEST_GUILD_ID |
Use a list comprehension to create a transformed list
tux/tests/unit/test_database_postgresql_features.py
Lines 155 to 161 in 65c39f1
guild_data.append({ | |
"guild_id": TEST_GUILD_ID + 100 + i, | |
"case_count": i, | |
"tags": [f"tag_{i}", "common_tag"], | |
"guild_metadata": {"batch_id": 1, "index": i}, | |
"feature_flags": {"active": i % 2 == 0}, | |
}) |
Import block is un-sorted or un-formatted
tux/tests/unit/test_database_service.py
Lines 18 to 23 in 65c39f1
import pytest | |
from sqlalchemy import text | |
from sqlmodel import SQLModel, Session, select | |
from tux.database.models.models import Guild, GuildConfig | |
from tux.database.service import DatabaseService |
sqlmodel.SQLModel
imported but unused
tux/tests/unit/test_database_service.py
Line 20 in 65c39f1
from sqlmodel import SQLModel, Session, select |
Do not assert blind exception: Exception
tux/tests/unit/test_database_service.py
Line 132 in 65c39f1
with pytest.raises(Exception): # SQLAlchemy integrity error |
import
should be at the top-level of a file
tux/tests/unit/test_database_service.py
Line 268 in 65c39f1
import random |
import
should be at the top-level of a file
tux/tests/unit/test_database_service.py
Line 344 in 65c39f1
from sqlalchemy.orm import selectinload |
sqlalchemy.orm.selectinload
imported but unused
tux/tests/unit/test_database_service.py
Line 344 in 65c39f1
from sqlalchemy.orm import selectinload |
…ctions This commit updates the README.md to enhance the layout of the metrics and contributors sections by centering headings and images, and adding small captions for better presentation. The overall structure is refined to improve readability and visual appeal.
…ontributors sections This commit modifies the README.md to change the alignment of headings and captions in the metrics and contributors sections from center to left and right, respectively. These adjustments aim to enhance the overall readability and presentation of the documentation.
This commit modifies the README.md to change the headings from h3 to h2 in the metrics and contributors sections, and updates the captions from "Made with" to "via" for better consistency and clarity in presentation.
…ed configurations This commit renames the Dockerfile to Containerfile and updates all references in configuration files, CI workflows, and scripts accordingly. Additionally, a new compose.yaml file is introduced to replace the previous docker-compose.yml format. The Python version is also updated to 3.13.8 across relevant files.
This commit adds the Containerfile to the hadolint configuration in the CI workflow, ensuring that linting checks are applied to the newly renamed file. This change aligns the CI process with recent updates to the project's container management.
This commit modifies the GitHub Actions workflow for Docker to refine the conditions under which the validation job runs, ensuring it triggers correctly for pull requests. Additionally, it updates the build settings to load the Docker image during validation and adjusts the target for the Trivy scan to use the output tags, enhancing the overall CI process for container management.
… controller initialization This commit refines the database service architecture by consolidating the DatabaseService and AsyncDatabaseService into a single class, improving clarity and maintainability. It also updates the BaseController to implement lazy initialization for specialized controllers, optimizing resource usage. Additionally, the documentation within the code has been enhanced for better understanding of the database service functionalities.
This commit enhances the unload_if_missing_config method in BaseCog to provide clearer logging and better handling of missing configurations. It updates the documentation to reflect the new behavior, ensuring that cogs can exit early during initialization if required configurations are absent. Additionally, it modifies the logging messages to include visual indicators for warnings and errors, improving the overall clarity of the logs. The cog_loader and flags modules are also updated to use constants directly, enhancing code consistency.
…s and delete timing This commit updates the help components to use specific constants for embed colors and delete timing, improving code clarity and maintainability. The changes involve replacing references to the CONST module with direct imports of EMBED_COLORS and DEFAULT_DELETE_AFTER, ensuring a more consistent approach to managing these values across the help system.
…nctionality This commit introduces several new features to the Tux Bot, including a Bookmark service for managing important messages, a GIF limiter to control GIF posting rates, an InfluxDB logger for performance metrics, a Levels service for XP tracking, a Starboard for highlighting popular messages, Status Roles for automatic role assignment based on user status, and a Temp VC service for managing temporary voice channels. Each service is designed to improve user experience and enhance community engagement within Discord servers.
…ocumentation This commit refines the ModerationCogBase class by implementing a factory pattern for service initialization, eliminating the need for asynchronous setup and preventing duplicate service creation. Additionally, it enhances method documentation with detailed parameter descriptions and return types, improving clarity and maintainability of the moderation functionalities.
… for improved clarity This commit updates various modules to replace references to the CONST module with specific constants, enhancing code readability and maintainability. The changes include adjustments in the Random, Avatar, Info, Moderation, and Snippets modules, ensuring a more consistent approach to managing constants across the codebase.
…D_ICONS for improved clarity This commit updates the EmbedCreator class to utilize specific constants for embed colors and icons, enhancing code readability and maintainability. The changes ensure a consistent approach to managing embed settings across the application.
…guration sources This commit refactors the configuration loaders by introducing an abstract base class, FileConfigSource, which consolidates common functionality for loading configuration from TOML, YAML, and JSON files. The individual loaders (TomlConfigSource, YamlConfigSource, JsonConfigSource) are updated to inherit from this base class, streamlining the parsing logic and enhancing code maintainability. Additionally, references to the CONST module are replaced with specific constants for improved clarity in settings management.
…for improved clarity This commit updates the Mail class to replace the CONST.HTTP_OK reference with the specific HTTP_OK constant, enhancing code readability and maintainability. This change aligns with previous updates aimed at using specific constants throughout the codebase for better clarity in handling HTTP status codes.
…s for improved clarity This commit updates the HotReloadConfig class to replace references to the CONST module with specific constants for reload timeout, maximum dependency depth, and dependency cache size. This change enhances code readability and maintainability, aligning with the ongoing effort to use specific constants throughout the codebase.
…zed service creation This commit adds a new ModerationServiceFactory to streamline the creation of moderation service instances, ensuring consistent dependency injection across moderation cogs. Additionally, it updates the CommunicationService to use specific embed colors instead of the CONST module, enhancing code clarity and maintainability. The __all__ list in the __init__.py file is also updated to include the new factory.
… constants for improved clarity This commit updates the Godbolt service wrapper to replace references to the CONST module with specific constants for HTTP_OK and HTTP_NOT_FOUND. This change enhances code readability and maintainability, aligning with the ongoing effort to use specific constants throughout the codebase for better clarity in handling HTTP responses.
… for HTTP client service This commit improves the HTTP client service by expanding the module and class docstrings to provide detailed information on lifecycle management, usage examples, configuration, and thread safety. The changes clarify the singleton pattern implementation, lazy initialization, and resource cleanup during bot shutdown. Additionally, the request methods are documented with examples and error handling details, enhancing overall code readability and maintainability.
…rity and maintainability This commit refactors the constants module by introducing a structured organization of constants into categories such as embed colors, icons, interaction limits, and API URLs. The __all__ attribute is updated to include all public constants, enhancing code readability and maintainability. Additionally, specific constants for various functionalities are defined, ensuring a consistent approach to managing configuration values across the codebase.
…eService for consistency This commit updates the test fixtures and integration tests to use DatabaseService instead of AsyncDatabaseService, ensuring consistency across the codebase. The changes enhance clarity in service initialization and align with the ongoing refactor to streamline database service usage.
This commit refactors the jail functionality by simplifying the role management process and enhancing error handling. The code now uses a more straightforward approach to add the jail role and remove old roles, ensuring that exceptions are logged and handled gracefully. This improves clarity and maintainability of the moderation logic.
…odules This commit introduces the loguru logging library into multiple modules, enhancing the logging capabilities for debugging and monitoring. Key changes include the addition of debug and info logs in the TuxFlagConverter, BulkOperationsController, QueryController, and various cogs, providing better insights into operations and error handling. This improvement aims to facilitate easier troubleshooting and improve overall maintainability of the codebase.
This commit introduces a comprehensive suite of integration tests for the jail and unjail system. The tests cover role management logic, database operations for storing and retrieving jail cases, and role restoration during unjail. Key functionalities tested include filtering manageable roles, creating and retrieving jail cases, and handling edge cases related to role metadata. This enhancement aims to ensure the reliability and correctness of the jail system's functionality.
This commit refines the logging setup across the application by integrating a more structured configuration approach using loguru. Key changes include the addition of environment-based log level settings, improved logging for third-party libraries, and enhanced formatting for log messages. The logging configuration is now centralized, allowing for better control over log levels and output formatting, which aims to improve debugging and monitoring capabilities throughout the codebase.
This commit simplifies the logging configuration by removing the debug mode verification details and associated logging statements. The changes streamline the logging setup, enhancing clarity and maintainability without compromising functionality.
This commit updates the `_run_tool_command` method in the DevCLI class to include an optional parameter for printing stderr output on successful command execution. Additionally, the docstring coverage command is modified to run with verbose output, improving the visibility of potential issues during execution. These changes aim to enhance the debugging experience and provide clearer feedback during tool command operations.
This commit enhances the documentation for various functions and classes by replacing "Args" with "Parameters" and providing clearer descriptions of each parameter's type and purpose. The changes aim to improve code readability and maintainability, ensuring that the documentation accurately reflects the expected inputs for each method. Additionally, new configuration options are added to the `pyproject.toml` for improved linting and type checking.
Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. If this change fixes any issues please put "Fixes #XX" in the description. Please also ensure to add the appropriate labels to the PR.
Guidelines
My code follows the style guidelines of this project (formatted with Ruff)
I have performed a self-review of my own code
I have commented my code, particularly in hard-to-understand areas
I have made corresponding changes to the documentation if needed
My changes generate no new warnings
I have tested this change
Any dependent changes have been merged and published in downstream modules
I have added all appropriate labels to this PR
I have followed all of these guidelines.
How Has This Been Tested? (if applicable)
Please describe how you tested your code. e.g describe what commands you ran, what arguments, and any config stuff (if applicable)
Screenshots (if applicable)
Please add screenshots to help explain your changes.
Additional Information
Please add any other information that is important to this PR.
Summary by Sourcery
Migrate project from Poetry to Uv (Hatch) as the dependency and build tool, restructure code under src/, introduce a dependency injection container with BaseCog for service resolution, centralize Sentry integration via a new SentryManager, and overhaul tracing/error handling instrumentation. Update CLI commands, Docker configurations, CI workflows, documentation, and tests to use Uv, add unit/integration/e2e test markers with isolation, and bump version to v0.1.0.
New Features:
Enhancements:
Build:
CI:
Documentation:
Tests:
Chores: