Technical Debt

Code quality issues and improvements

Technical Debt

This document tracks technical debt items in the OctoMY™ codebase. Items at the top should be fixed first. New items are added at the bottom.

Procedure for Fixing Technical Debt

For every item fixed, follow these 5 steps:

  1. Fix the code - Make the necessary changes to address the issue
  2. Build - Run incremental build to uncover and fix obvious errors
  3. Build clean - Run clean build to catch any hidden errors from shadowed sources
  4. Update this document - Remove the fixed item from the list below
  5. Commit - Summarize changes in a git commit

Code Conventions

Switch Case Fallthrough Policy

Switch case fallthrough is a common source of bugs. Follow these rules:

  1. Unintentional fallthrough - Add break; statement at the end of each case
  2. Intentional fallthrough - Add [[fallthrough]]; attribute before the next case label

Example of intentional fallthrough:

switch(value) {
case A:
    doSomething();
    [[fallthrough]];  // Explicitly mark intentional fallthrough
case B:
    doSomethingElse();
    break;
}

The [[fallthrough]] attribute (C++17) silences compiler warnings and documents intent for other developers.

Unused Variables and Parameters Policy

Use Q_UNUSED() macro to suppress warnings for intentionally unused variables and parameters. This approach:

  1. Documents intent - Makes it clear the parameter is intentionally unused
  2. Preserves API - Keeps parameter names visible for documentation and future use
  3. Silences warnings - Prevents compiler warnings without removing information
void MyClass::configure(KeyStore *keystore, AddressBook *peers)
{
    Q_UNUSED(keystore);
    Q_UNUSED(peers);
    // Implementation pending or parameters reserved for future use
}

When to use Q_UNUSED:

  • Parameters required by interface/virtual function but not used in implementation
  • Parameters reserved for future functionality
  • Loop variables in WIP code with commented-out body

When NOT to use Q_UNUSED:

  • If the parameter can be removed from the signature entirely
  • If the code should actually use the parameter (fix the implementation instead)

Qt5 Legacy References

The project targets Qt6 only. The following files contain Qt5 references that need cleanup or migration.

Android Build Files (Need Qt6 Migration)

These files reference org.qtproject.qt5.android.bindings and need updating to Qt6's Android structure:

  • src/agent/android/gradle.properties
  • src/agent/android/build.gradle
  • src/agent/android/AndroidManifest.xml
  • src/agent/android/src/org/octomy/agent/Agent.java
  • src/agent/android/res/values/libs.xml
  • src/remote/android/gradle.properties
  • src/remote/android/build.gradle
  • src/remote/android/AndroidManifest.xml
  • src/remote/android/src/org/octomy/remote/Remote.java
  • src/remote/android/res/values/libs.xml
  • src/hub/android/gradle.properties
  • src/hub/android/build.gradle
  • src/hub/android/AndroidManifest.xml
  • src/hub/android/src/org/octomy/hub/Hub.java
  • src/hub/android/res/values/libs.xml

Legacy Release/Docker Files

Old build infrastructure targeting Qt 5.10.0:

  • integration/release_management/Dockerfile.qt5.10.0_static_ubuntu_amd64
  • integration/release_management/Dockerfile.deb_file
  • integration/release_management/Dockerfile.deb_test
  • integration/release_management/build.sh
  • integration/release_management/README.md
  • integration/local/tool.sh (XKB fixes comment for Qt5.4x)

Source Code with Qt5 Version Checks

  • src/libs/libpair/pairing/camera/CameraPairingWidget.cpp:184 - #ifdef QT5_STUFF (guards disabled legacy code awaiting Qt6 QMultimedia rewrite)

Build Warnings

Enum/Integer Mismatch (libmarkdown)

  • src/libs/libmarkdown/markdown/autolink.c:151,188,245 - conflicting types due to enum/integer mismatch

#warning Directives

  • src/libs/libclt/clt/CLWorker.cpp:327 - "CL STUFF DISABLED BECAUSE... QT6"

Debug Statements to Remove

XXX Debug Statements

These debug statements with "XXX" markers should be cleaned up:

  • src/libs/libpair/delivery/BirthControl.cpp:146,186,191,194,199,200
  • src/libs/libpair/delivery/ControlDeliveryActivity.cpp:96,119,189,191,196,197
  • src/libs/libpair/delivery/AgentDeliveryActivity.cpp:89

TODO Comments (Categorized)

High Priority - Implementation Incomplete

  • src/libs/libnode/node/Node.cpp:657 - "TODO: Implement"
  • src/libs/libnode/node/Node.hpp:405 - "TODO: Implement"
  • src/libs/libardumy/ardumy/ArduMYController.cpp:567 - "TODO: Implement"

Medium Priority - Needs Refactoring

  • src/libs/libpair/pairing/camera/CameraPairingWidget.hpp:37,57 - "TODO: Rework this with new qmultimedia primitives for Qt6"
  • src/libs/libpair/pairing/camera/CameraPairingWidget.cpp:23,67,83,162 - "TODO: Rework this with new qmultimedia primitives for Qt6"
  • src/libs/libremote/remote/ControlUnboxingWizard.cpp:187 - "TODO: refactor activity system"

Low Priority - Improvements/Features

  • src/libs/libstore/store/DataStore.cpp:45 - unnecessary load prevention
  • src/libs/libstore/store/AsyncStore.hpp:228,779 - load/error handling
  • src/libs/libnode/node/Node.cpp:108 - simplify init system
  • src/libs/libpair/discovery/DiscoveryClient.cpp:457 - remove old unused couriers
  • src/libs/libpair/address/AddressList.cpp:203,212 - implement if needed

Security-Related

  • src/libs/libpair/address/Associate.cpp:70,74 - intensify security check
  • src/libs/libardumy/ardumy_arduino/parser/ArduMYCommandParser.hpp:15 - escaping for magic sequence

Code Quality Issues

Q_UNUSED Macro Usage

425 occurrences of Q_UNUSED across 175 files. Many may indicate incomplete implementations or unnecessary parameters that should be refactored.

Large Debug Output Count

Approximately 399 qDebug()/qWarning() calls across 50 files (first 50). Consider:

  • Adding log levels
  • Using centralized logging (liblog)
  • Removing debug statements before release builds

Incomplete Features

CameraPairingWidget

Multiple TODO comments indicate this needs complete rework for Qt6 QMultimedia:

  • src/libs/libpair/pairing/camera/CameraPairingWidget.cpp
  • src/libs/libpair/pairing/camera/CameraPairingWidget.hpp

OpenCL Support (libclt)

  • src/libs/libclt/clt/CLWorker.cpp:327 - OpenCL disabled for Qt6, needs reimplementation

Widget Consolidation

All widgets should live in libwidgets. The following widgets are scattered across other libraries and should be migrated:

Widgets in libpair (should move to libwidgets)

  • src/libs/libpair/pairing/trust/TrustSymbolWidget.*
  • src/libs/libpair/pairing/list/PairingListWidget.*
  • src/libs/libpair/connection/ConnectionStatusWidget.*
  • src/libs/libpair/connection/SignalStrengthWidget.*
  • src/libs/libpair/discovery/PingWidget.* (if exists)

Widgets in libnode (should move to libwidgets)

  • src/libs/libnode/node/PortableIDWidget.*

Note: When migrating, update all include paths and ensure library dependencies are correct.


Style/Convention Issues

Inconsistent Naming

Review these for naming convention compliance:

  • Methods named same as class types causing compiler warnings (fixed in AutomationBookModel)
In this section
Topics
internal technical-debt code-quality maintenance
See also