Skip to content

Code improvements to make Scribe ready for future features #426

@linreal

Description

@linreal

Terms

Description

After working on Add invalid state to keyboard commands and show localized Not in Wikidata and app crashing at startup on api 30 I've noticed some issues, which could lead to maintenance problems in future, and also push away potential maintainers.

Specifically, I see problems with GeneralKeyboardIME and and classes inheriting it.

Main things that, in my opinion, should be addressed:

  • GeneralKeyboardIME mixes view management, database access, state handling, and business logic in ~2,100 lines. The suppression of TooManyFunctions and LargeClass hints at maintainability issues. This makes it difficult for potential contributors to understand or extend the code.
  • isTablet duplicates in every subclass
  • heavy use of non-null assertions (!!) in the subclasses when setting up the keyboard view
  • fuzzy state management without stateholder
  • base class knows about classes inheriting it (i.e baseKeyboardOfAnyLanguage function and many others)
  • languages logic is based on strings comparison instead enums or sealed classes (i.e getLanguageAlias function)
  • various code style issues (like using "when" in setupCommandBarTheme function), invalid log tags (like "my-tag") and so on

Contribution

I would like to discuss if necessary and fix some of listed problems in one (or multiple) separate PR's
Let me know, if you ok with it

Metadata

Metadata

Assignees

Labels

hacktoberfest-acceptedAccepted as a part of HacktoberfestrefactorRefactor code to improve quality

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions