Skip to content

Smell: too many instance attributes#3529

Closed
saviosoaresUFC wants to merge 2 commits into
python-discord:mainfrom
saviosoaresUFC:smell/too-many-instance-attributes
Closed

Smell: too many instance attributes#3529
saviosoaresUFC wants to merge 2 commits into
python-discord:mainfrom
saviosoaresUFC:smell/too-many-instance-attributes

Conversation

@saviosoaresUFC

Copy link
Copy Markdown

refactor: Reduce number of instance attributes across multiple classes

Problema

Diversas classes no projeto excediam o limite de 7 atributos de instância definido pelo Pylint (too-many-instance-attributes, R0902).

Solução

Os parâmetros de construtor foram agrupados em dataclasses dedicadas, reduzindo a contagem de atributos de instância das classes afetadas.

Padrão utilizado

  • Parâmetros do construtor foram extraídos para uma @dataclass.
  • A dataclass é armazenada como self.data na view.
  • As referências foram alteradas de self.param para self.data.param.
  • Os call sites foram ajustados para construir a dataclass antes de instanciar a view.
  • Propriedades foram adicionadas onde necessário para manter compatibilidade com subclasses.

@saviosoaresUFC saviosoaresUFC requested a review from mbaruh as a code owner June 28, 2026 21:52
@jb3

jb3 commented Jun 28, 2026

Copy link
Copy Markdown
Member

Hi @saviosoaresUFC, thanks for taking the time to contribute! Unfortunately we have a few concerns with this PR that will likely lead to us closing it:

  1. We ask that contributors discuss proposed changes with the team before opening a PR - especially for large refactors. The best place to do that is in the #dev-contrib channel on our Discord server. We'd appreciate chatting with you there before work like this goes ahead.

  2. Per our contributing guidelines, we ask that you don't open a pull request unless you've been assigned to an issue for it first. This is to avoid people putting work into pull requests that we are not able to merge. There isn't an existing issue for this change.

  3. Our linting setup is intentionally tailored to the code style we want to achieve. The too-many-instance-attributes rule isn't something we have enabled. If you think it is something we should enable, please raise an issue or discuss with us in Discord first.

  4. The PR description is written in Portuguese, whilst we welcome contributions from anyone we ask for them to be in English so maintainers can understand justifications for changes and other community members can follow along.

  5. Our contributing guidelines require that you disclose whether AI tools were used to assist with your contribution. Could you let us know if this applies?

If you'd like to contribute in the future, come say hi in #dev-contrib in our Discord server and we can help you get started & point you at an issue that needs solving!

@jb3

jb3 commented Jun 29, 2026

Copy link
Copy Markdown
Member

Closing this as we haven't heard back, please contact us in #dev-contrib if you have further questions.

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