mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
1.3 KiB
1.3 KiB
| applyTo |
|---|
| **/commonMain/**/*.kt |
KMP commonMain Rules
- NEVER import
java.*orandroid.*incommonMain. - Use
org.meshtastic.core.common.util.ioDispatcherinstead ofDispatchers.IO. - Use Okio (
BufferedSource/BufferedSink) instead ofjava.io.*. - Use
kotlinx.coroutines.sync.Mutexinstead ofjava.util.concurrent.locks.*. - Use
atomicfuor Mutex-guardedmutableMapOf()instead ofConcurrentHashMap. - Use
jetbrains-*catalog aliases for lifecycle/navigation dependencies. - Use
compose-multiplatform-*catalog aliases for CMP dependencies. - Never use plain
androidx.composedependencies incommonMain. - Strings: use
stringResource(Res.string.key)fromcore:resources. No hardcoded strings. - CMP
stringResourceonly supports%N$sand%N$d— pre-format floats withNumberFormatter.format(). - Use
MetricFormatterfromcore:commonfor display strings (temperature, voltage, percent, signal). Avoid scatteredformatString("%.1f°C", val)calls. - Check
gradle/libs.versions.tomlbefore adding dependencies. - Use
safeCatching {}fromcore:commoninstead ofrunCatching {}in coroutine/suspend contexts. KeeprunCatchingonly in cleanup/teardown code. - Use
kotlinx.coroutines.CancellationException, notkotlin.coroutines.cancellation.CancellationException.