Skip to content
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

Settings: Refactor code to reduce complexity and dependencies #2659

Open
MattHag opened this issue Nov 3, 2024 · 0 comments
Open

Settings: Refactor code to reduce complexity and dependencies #2659

MattHag opened this issue Nov 3, 2024 · 0 comments

Comments

@MattHag
Copy link
Collaborator

MattHag commented Nov 3, 2024

The Setting class in logitech_receiver/settings contains dozens of subclasses, which are expected to contain specific properties. However, that's not ensured via implementation and makes it so hard to reafactor and maintain.

A dependency graph for the logitech_receiver module can be created via pyreverse

pyreverse --filter PUB_ONLY --output-directory pyreverse_output --output dot ./lib/logitech_receiver/* && dot -T svg classes.dot -o modeling_full.svg && open modeling_full.svg 

The existing problems are

  • Complex code with many hard connections, "big ball of mud"
    • NamedInts
    • No type hints
  • Hard to maintain with several levels of subclasses
  • No documentation of available/expected properties nor enforced
    • Maybe data classes to specify properties, e.g. for RegisterDpi works better.

Information

  • Solaar version: 1.1.13
@MattHag MattHag changed the title Settings: Reduce complexity and dependencies Settings: Refactor code to reduce complexity and dependencies Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant