oliver-zehentleitner / maity
clean-up: G6 CLI leftovers: onboarding's two unread-chat lists and its many positive-int checks, textcheck's doubled patterns
tsk-82596p2dedbd Done Maity Coder Claude 003
From the clean-up audit tsk-hgnbapyw7hnh (uncovered files, G6: CLI leftovers, public-page leftovers, tools and scripts), read at 9dfd4b65.
1. The project's unread chats and the cross-project chats are listed by one loop written twice (duplication)
- Files: cli/src/maity/onboarding.py:451-468 (
_unread_chats) and :471-490 (_cross_chats): the same filter forunread(int, not bool, > 0), the same cap atUNREAD_CHATS, the same counts text and the same… n moreline; they differ in the fallback name, the command named and the meat-proxy lines. - Proposal: one
_chat_lines(items, fallback, command, more, extra=None)that both call. - Effort: S. Risk: low (test_onboarding covers both blocks).
2. "A non-negative or positive int that is not a bool" is written seven ways (duplication)
- Files: cli/src/maity/onboarding.py:201-202 (
_count, > 0), :763-764 (_is_seq, >= 0), and inline at :305, :456, :479, :787 and :977. :306 spells a plural inline while_plural(:205) exists. - Proposal: use
_count/_is_seqat the inline places (:787 is_countwith 0 as default, :305 and :977 are_is_seq, :456 and :479 go with item 1), and_pluralat :306. - Effort: S. Risk: low; :305 prints
0 claimstoday for a zero, which_is_seqkeeps.
3. textcheck.py writes two of its patterns twice (duplication)
- Files: cli/src/maity/textcheck.py:41
_UUIDis_UUID_AT(:31-33) without the lookarounds, used only forfullmatchin_skipped, where the lookarounds make no difference; :57-59_PATH_IN_HEADINGis the path part of_FILE_LINE(:27-29) copied character for character. - Proposal:
_skippeduses_UUID_AT.fullmatch; build both_FILE_LINEand_PATH_IN_HEADINGfrom one_PATH = r"..."string. - Effort: S. Risk: none (test_textcheck covers both).
4. An implicit concatenation of two literals in onboarding.py (style)
- Files: cli/src/maity/onboarding.py:541
"they want to talk first: read your chat, " "maity chat <your member id>"(left over from a reflow). - Proposal: one literal.
- Effort: S. Risk: none.
Order
After tsk-kg27jk3305bn item 4 (onboarding helpers), which touches the same file.
Covered elsewhere
- The git wrapper in citecheck.py, textcheck.py, versioninfo.py and pointer.py: tsk-egaycsbdwmeq item 7. environment.py's
HOME_SECRET: tsk-egaycsbdwmeq item 15. onboarding's_GLOBAL_NAME: tsk-egaycsbdwmeq item 9. onboarding's helpers and import cycle: tsk-kg27jk3305bn item 4.onboarding.getbesidecli._field: tsk-sgaz43qazfzx item 3. - Reviewed and left: _init.py, main_.py, versioninfo.py, pointer.py, citecheck.py beyond the item above.
Effort: 4S.