Skip to content

Reduce too-many-instance-attributes across piccolo codebase#1396

Open
waniasantos wants to merge 11 commits into
piccolo-orm:masterfrom
grazi-lima:refactor/too-many-instance-attributes
Open

Reduce too-many-instance-attributes across piccolo codebase#1396
waniasantos wants to merge 11 commits into
piccolo-orm:masterfrom
grazi-lima:refactor/too-many-instance-attributes

Conversation

@waniasantos

@waniasantos waniasantos commented Jun 30, 2026

Copy link
Copy Markdown

Summary

Refactors 11 occurrences of Pylint's too-many-instance-attributes (R0902) by grouping related attributes into semantic sub-dataclasses. Consistent pattern applied across the codebase: attributes moved to auxiliary classes, with properties (getter/setter) preserving full backward compatibility with the existing public API.

Refactored classes

  • TableMeta (table.py)
  • RowMeta (apps/schema/commands/generate.py)
  • Trigger (apps/schema/commands/generate.py)
  • MigrationManager (apps/migrations/auto/migration_manager.py)
  • AlterColumn (apps/migrations/auto/operations.py)
  • Select (query/methods/select.py)
  • Alter (query/methods/alter.py)
  • Objects (query/methods/objects.py)
  • SQLiteTransaction (engine/sqlite.py)
  • PostgresTransaction (engine/postgres.py)
  • ColumnMeta (columns/base.py)

Validation

  • Full test suite (pytest) passes after each refactor
  • Pylint R0902 score: 10/10 on all affected classes
  • No changes to the public API

Notes

  • MigrationManager required a custom __init__ to preserve compatibility with legacy direct calls (migration_id=...) found in real migration files
  • TransactionState was centralized in base.py, removing duplication between SQLiteTransaction and PostgresTransaction

@waniasantos waniasantos marked this pull request as draft June 30, 2026 00:51
@waniasantos waniasantos marked this pull request as ready for review June 30, 2026 04:20
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.

1 participant