Skip to content

Clean up dead code and what the compiler and qmllint warn about - #428

Merged
No0ne558 merged 1 commit into
ViewTouch:mainfrom
No0ne558:cleanup
Oct 26, 2026
Merged

No0ne558 merged 1 commit into
ViewTouch:mainfrom
No0ne558:cleanup

Conversation

@No0ne558

Copy link
Copy Markdown
Contributor

A pass for dead code and bugs, using:

  • a build with -Wall -Wextra and more (-Wshadow, -Wnull-dereference, -Wduplicated-cond, -Wlogical-op…);
  • qmllint on all 101 QML files;
  • the whole test suite under AddressSanitizer and UBSan: no memory errors and no undefined behavior in any of the 640 tests.

No real bugs turned up. Nothing here changes what the app does.

Dead code removed

  • LayoutController::commandRequested: sent for unknown commands, heard by nothing.
  • schema::pageRoles(): never called.
  • PosService::lowStock(): only a test used it.
  • Two helpers never called: schema's options(QStringList) and print's dropChars.
  • Unused QtQuick.Dialogs / QtQuick.Controls.Fusion imports in 14 QML files.

QML properties that hid Qt's own

  • The network page's dots had a state property (an Item's own); renamed status.
  • The check's seat row had a count (a ListView's own); renamed seatCount, including two uses that would otherwise have switched to the list's built-in count.

Clearer code

  • Parentheses where && sits inside || (a picture's name).
  • A report loop's id that hid the report's own.
  • A stress-test count nobody read.

Tests

  • The update-by-itself test could send the update to its "busy" phone in the moment between connecting and logging in. That's correct behavior, and it only showed up under AddressSanitizer, which slows everything down. The test now logs that phone in with the setting off; it passed three runs in a row under the sanitizers.
  • A /proc read now checks that the file opened, and loops over string literals no longer copy each one.

Checked and left as they are

  • The 11 possible null dereferences GCC reports are all guarded (QPointer checks, user() && …).
  • The 174 translations that tools/i18n.py stale lists include menu item names and layout descriptions it can't see, so none were deleted.

The full suite passes (640 cases).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Weg3awu6SARK7jYrtvDfuw

Found with a -Wall -Wextra (and more) build, qmllint, and the whole test
suite under AddressSanitizer and UBSan (no memory errors or undefined
behavior). Nothing here changes what the app does.

- Dead code: the commandRequested signal (sent for unknown commands,
  heard by nothing), schema::pageRoles(), PosService::lowStock() (only a
  test used it), and two helpers never called (schema's options(QStringList),
  print's dropChars).
- QML: a property named "state" (the network page's dots) and one named
  "count" (the check's seat row) hid an Item's and a ListView's own;
  renamed status and seatCount. Unused imports of QtQuick.Dialogs and
  QtQuick.Controls.Fusion taken out of 14 files.
- Clearer: parentheses where && sits in || (a picture's name), a report
  loop's id that hid the report's, a stress-test count nobody read.
- Tests: the update-by-itself test could send the update to the "busy"
  phone in the moment between connecting and logging in (seen under
  AddressSanitizer, which slows everything); it logs that phone in with
  the setting off. A /proc read checks the file opened; loops over string
  literals no longer copy each one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Weg3awu6SARK7jYrtvDfuw
@No0ne558
No0ne558 merged commit 1fadaac into ViewTouch:main Oct 26, 2026
1 check passed
@No0ne558
No0ne558 deleted the cleanup branch October 26, 2026 00:23
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