Skip to content

Conversation

@ab-10
Copy link
Contributor

@ab-10 ab-10 commented Jul 4, 2025

No description provided.

from abc import ABC, abstractmethod
import copy

# Type variables for our factory system
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant comment that just states what the code itself makes clear via the TypeVar declaration. The comment adds no additional context or explanation beyond what is immediately apparent from the code.

📚 Relevant Docs

🔍 This comment matches your effective_comments.mdc rule.

Suggested change
# Type variables for our factory system

React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)


def __init__(self, schema: ModelSchema):
self.schema = schema
# Cache for generated models to avoid regeneration
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment restates what is obvious from the variable names and initialization pattern. The fact that these are caches for generated models is clear from the '_model' suffix and None initialization. The comment adds no extra insight.

📚 Relevant Docs

🔍 This comment matches your effective_comments.mdc rule.


React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)

if field_name in ['hashed_password', 'password']:
return None

# Apply standard field constraints
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant comment that simply labels the next block of code without adding any valuable context. The code itself clearly shows that standard field constraints are being applied through self-documenting variable names.

📚 Relevant Docs

🔍 This comment matches your effective_comments.mdc rule.


React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)

from .model_factory import ModelFactoryRegistry, setup_model_factories

# Initialize the factory system and generate all entity models
setup_model_factories()
Copy link

@recurseml recurseml bot Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Premature abstraction introducing a complex factory pattern that couples behaviors which may need to evolve separately. The factory system enforces a rigid CRUD pattern across all models, making it difficult to handle domain-specific variations in validation rules, update patterns, and business constraints. According to the anti-DRY principle, this abstraction should wait until clear common patterns emerge that justify the coupling.

📚 Relevant Docs

🔍 This comment matches your anti_dry.mdc rule.

Suggested change
setup_model_factories()
class UserBase(SQLModel):
email: EmailStr = Field(unique=True, index=True, max_length=255)
is_active: bool = True
is_superuser: bool = False
full_name: str | None = Field(default=None, max_length=255)

React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)

user_models = ModelFactoryRegistry.get_all_models_for("User")
item_models = ModelFactoryRegistry.get_all_models_for("Item")

# Factory-generated User models
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant comment that simply restates what is already obvious from the code and variable names. The comment adds no additional context or explanation of why the factory pattern is used, violating the principle that comments should explain why, not what.

📚 Relevant Docs

🔍 This comment matches your effective_comments.mdc rule.


React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)

UserPublic = user_models['public']
UsersPublic = user_models['list_public']

# Factory-generated Item models
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant comment that merely restates what is clear from the variable names and code structure. Comments should not state the obvious but rather provide insight into non-obvious aspects of the code.

📚 Relevant Docs

🔍 This comment matches your effective_comments.mdc rule.


React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)

ItemPublic = item_models['public']
ItemsPublic = item_models['list_public']

# Non-factory models that don't fit the standard CRUD pattern
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant comment that provides no additional context beyond what's already clear from the code structure and naming. The fact that these models don't use the factory pattern is evident from the code itself.

📚 Relevant Docs

🔍 This comment matches your effective_comments.mdc rule.


React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)

@recurseml
Copy link

recurseml bot commented Jul 4, 2025

😱 Found 8 issues. Time to roll up your sleeves! 😱

Need help? Join our Discord for support!
https://discord.gg/NCpkJ4kF

@Recurse-ML Recurse-ML deleted a comment from recurseml bot Jul 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants