duklog Coding Standards
Style
- •Iterators over loops, expressions over
return,matchoverif let - •No
.unwrap()/.expect()in lib code (only tests andmain.rs) - •Derive order: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize
- •Specific imports (no globs), grouped: std / external / crate-internal
- •Each module has its own
thiserrorerror type; propagate with?
Testing
- •Every
pub fntested with success and failure paths - •Assert on specific values, not
is_ok()/is_empty()— critical for mutation testing - •Test boundary values (e.g., activation threshold at 9, 10, 11 QSOs)
- •Use quickcheck for string-input functions
- •Use
tempfile::tempdir()for storage tests — never real paths - •Deterministic and fast; no surviving mutants per module
- •90% minimum line coverage
Coverage Exclusions
- •Allowed:
main.rssetup, event loop methods requiring a real terminal - •Test
draw_*functions withTestBackendrender tests (not excluded from coverage) - •Keep
#[mutants::skip]on draw functions (mutation testing visual layout isn't productive) - •Never exclude:
src/model/,src/adif/,src/storage/,handle_key()methods
ADIF/POTA Correctness
- •Field format:
<FIELDNAME:length>value(length = byte length) - •Required:
STATION_CALLSIGN,CALL,QSO_DATE(YYYYMMDD),TIME_ON(HHMMSS),BAND,MODE - •Park ref format:
[A-Z]{1,3}-\d{4,5} - •Activation threshold: 10 QSOs, single park, one UTC day
Documentation
- •Rustdoc (
///) on allpubitems - •Update
docs/when implementing or changing features:- •
docs/user-guide.md— screen descriptions, keybindings, workflows - •
docs/architecture.md— module layout, Action enum, design decisions - •
docs/implementation-plan.md— move completed phases, update remaining work - •
docs/adif-format.md— if ADIF fields or format changes
- •
- •No feature is complete without documentation updates