project, docs: the linter goes

The Catcrafts house-style rules (Crafter.LintRules) rode in project.cpp
as a dependency crafter-build cloned once and built on every load; the tree
never passed them (111 findings on the 1.1.0 tree, 156 on an early freeze
of this range (2e87e26), 100 of the 156 the shared naming rule's, each
for a variable whose name begins with a capital — the
fp6 journal's lint captures, lint-tip-2e87e26), CI never ran them,
and AGENTS.md kept a census nobody acted on. Out: the dependency, the
import and the five AddRules calls, the lint-disable comments in 25
files and on 4 lines, §4.2 and the census of §6 — now "Code style", the
three rules that were never the linter's; the cross-compiling section
becomes §4.2 and its six citations — §4.1's sysroot sentence, §9.1, the CI
workflow, the APKBUILD, build-package.sh, make-sysroot.sh — follow. Jorijn, 2026-10-17: "just
remove the linter, we are ignoring it anyway".
This commit is contained in:
Jorijn van der Graaf 2026-10-18 00:05:06 +02:00
commit 910e2594a0
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
30 changed files with 17 additions and 95 deletions

View file

@ -6,7 +6,7 @@ name: package
# plain 'apk upgrade' without an fp6-img image run.
#
# Build: crafter-build cross-compiles against an Alpine aarch64 sysroot
# (packaging/build-package.sh — AGENTS.md §4.3's cross-compiling flow), the
# (packaging/build-package.sh — AGENTS.md §4.2's cross-compiling flow), the
# test suite runs natively, and packaging/APKBUILD.binary wraps the result.
# crafter-build is the Crafter.Build Flatpak, and bubblewrap inside the job
# container needs a privileged runner: the job runs on the `flatpak` label

View file

@ -196,7 +196,6 @@ crafter-build -- --product=dialerd # bin/imsd-dialerd-…/imsd-dialerd
crafter-build -- --product=ofonod # bin/imsd-ofonod-…/imsd-ofonod
crafter-build -- --product=pcscf # bin/imsd-pcscf-…/imsd-pcscf
crafter-build test # the nine unit-test suites
crafter-build lint # the house-style rules (§4.2, §6)
```
Output directories under `bin/` are named `<product>-<target>-<march>-<mtune>-<id>`;
@ -208,36 +207,9 @@ net.catcrafts.CrafterBuild//stable`, with `--socket=session-bus` for §8.3's
daemons — the sandbox's own session bus is a filter that refuses their names;
`crafter-build test` runs the suites there
anyway). A sysroot
build (§4.3) gets no such rpath — it links the sysroot's libc++.
build (§4.2) gets no such rpath — it links the sysroot's libc++.
### 4.2 The lint rules, a dependency of project.cpp
`project.cpp` imports the house-style rules (§6) from their own repository:
```cpp
#pragma crafter dependency "https://forgejo.catcrafts.net/Catcrafts/Crafter.LintRules.git" commit "<sha>"
import Crafter.LintRules;
```
crafter-build clones that repository — and updates the clone on later loads —
and builds it for the host whenever it loads `project.cpp`: every build does
this, CI's included, not only `lint`. The commit is pinned, so a change to
the rules reaches imsd when the pin moves. `LintRules::AddRules` registers
the rules on each product's configuration.
```sh
crafter-build lint # report every finding; exit 1 on any
crafter-build lint 'naming' # one rule (the argument is a glob)
crafter-build format # apply the transform rules in place
```
Six rules read the AST (`naming`, `no-char-pointer`, `const-local`,
`constexpr-constant`, `fixed-width-types`, `single-declaration`) and need the
module PCMs: build the five programs and the tests first. With crafter-build
2.1.0 they still do not run on every file — `implementations/main.cpp` is
among the misses (`'type_traits' file not found`).
### 4.3 Cross-compiling for a phone (aarch64 Alpine / postmarketOS)
### 4.2 Cross-compiling for a phone (aarch64 Alpine / postmarketOS)
```sh
packaging/make-sysroot.sh # one-time: Alpine aarch64 sysroot from the CDN (edge)
@ -712,29 +684,12 @@ Rules:
- `imsd --session` and `imsd-ofonod --session` own their names on the session
bus for development without root, polkit or a phone (§8.3).
## 6. Code style and lint
## 6. Code style
The rules are the Catcrafts house style,
[Crafter.LintRules](https://forgejo.catcrafts.net/Catcrafts/Crafter.LintRules),
pulled in by `project.cpp` (§4.2); that repository's README lists the
seventeen of them. `// lint-disable-file <rule>` (by convention on line 4,
after the SPDX header and a blank line) and `// lint-disable-next-line <rule>`
suppress a rule where a file needs it; nearly every source file disables
`fixed-width-types`.
The tree was written under an earlier, project-local copy of the rules and
does not pass the shared ones yet: `crafter-build lint` reports findings in
most files — `naming` first (constants and statics are PascalCase here, the
shared rule wants camelCase), then `format-concat`, `const-local`,
`wrap-join`, `single-declaration` and `no-char-pointer` (`const-local` and
`single-declaration` the copy did not report) — and the count moves (72 on
2026-10-06, before the Qmi files; 108 in 16 of 20 files on the tree that
added them, 2026-10-13; 109 on the 1.0.0 tree, 2026-10-13: `naming` 69,
`format-concat` 23, `const-local` 10, `wrap-join` 3, `single-declaration` 2,
`no-char-pointer` 1 and `if-single-line` 1, the last new since). CI does not
run lint.
Beyond the rules:
No linter since 1.2.0: the Catcrafts house-style rules (Crafter.LintRules)
rode in `project.cpp` as a dependency from 0.3.x to 1.1.0, the tree never
passed them, CI never ran them, and the census kept here was dead weight
(Jorijn, 2026-10-17: "we are ignoring it anyway"). What holds:
- Comments explain constraints the code cannot show — a network's observed
behaviour, a spec clause, the reason a shape was chosen — and name their
@ -1944,7 +1899,7 @@ id and a `failed: imsd is not registered` state (2026-10-16,
### 9.1 The APKBUILD
`packaging/APKBUILD.binary` is **the** packaging since 2026-09-02: it wraps
a crafter-build binary cross-compiled per §4.3 (bundled by
a crafter-build binary cross-compiled per §4.2 (bundled by
`packaging/make-bin-tarball.sh` together with the units, scripts and
policies) into the apks CI publishes. `pkgver` is taken from the `Version`
constant in `implementations/main.cpp` by `build-package.sh`.

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types no-char-pointer
/*
imsd-dialerd — Plasma Dialer backend for imsd.

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types no-char-pointer
/*
imsd — the userspace IMS/VoLTE daemon (control plane).

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types no-char-pointer
/*
imsd-media — the RTP media leg for a userspace VoLTE call, spawned as its
own process by the daemon (imsd) exactly as the Python prototype spawned

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types no-char-pointer
/*
imsd-ofonod — GNOME Calls backend for imsd (Phosh, GNOME Mobile).

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types no-char-pointer
/*
imsd-pcscf — prints the P-CSCF list the network delivered in the ims PDN's
Protocol Configuration Options, read from the modem over QMI.

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
/*
Imsd:Aka — USIM AKA (3GPP TS 33.102) glue for IMS registration:

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
/*
Imsd:Engine — the daemon's decisions as pure reducers: the call state
machine (CallMachine), the registration recovery policy (RegRecovery,
@ -1322,7 +1321,7 @@ export namespace imsd::engine {
};
std::string FormatStoredSms(const StoredSms& r) {
auto hex = [](std::string_view s) { return imsd::util::ToHex(std::span<const std::uint8_t>(reinterpret_cast<const std::uint8_t*>(s.data()), s.size())); }; // lint-disable-line no-char-pointer
auto hex = [](std::string_view s) { return imsd::util::ToHex(std::span<const std::uint8_t>(reinterpret_cast<const std::uint8_t*>(s.data()), s.size())); };
std::string out;
out += std::format("id={}\n", r.id);
out += std::format("received={}\n", r.receivedAt);
@ -1503,7 +1502,7 @@ export namespace imsd::engine {
r.actions.push_back(SmsAction{SmsAction::Type::Log, std::format("short message over IP from {} ({} bytes) while SMS_OVER_IMS is off: 480", from, body.size())});
return r;
}
std::span<const std::uint8_t> bytes(reinterpret_cast<const std::uint8_t*>(body.data()), body.size()); // lint-disable-line no-char-pointer
std::span<const std::uint8_t> bytes(reinterpret_cast<const std::uint8_t*>(body.data()), body.size());
r.rp = imsd::sms::ParseRp(bytes, true);
if (!r.rp) {
r.actions.push_back(SmsAction{SmsAction::Type::Log, std::format("MESSAGE from {} with {} bytes that are no RP message: {}", from, body.size(), imsd::util::ToHex(bytes))});

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
/*
Imsd:Ipsec — IMS security-association plumbing expressed as `ip xfrm` command
lines, plus a reader for an SA already installed in the kernel.

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
/*
Imsd:Messages — the SIP request/response text the engine puts on the wire.
@ -598,7 +597,7 @@ export namespace imsd::msg {
l.push_back(std::format("Content-Length: {}", rp.size()));
l.push_back("");
std::string out = detail::Join(l);
out.append(reinterpret_cast<const char*>(rp.data()), rp.size()); // lint-disable-line no-char-pointer
out.append(reinterpret_cast<const char*>(rp.data()), rp.size());
return out;
}
}

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
/*
Imsd:Qmi — the bytes of the QMI WDS exchanges imsd-pcscf has with the modem
to learn the ims PDN's P-CSCF list, and the readers of the answers.

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
/*
Imsd:Sdp — SDP offer/answer building + parsing for the voice media plane.

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
/*
Imsd:Sip — SIP message text layer + TCP framing.

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
/*
Imsd:Sms — the short message codecs SMS over IP rides on (TS 24.341 carries
the same bytes a 2G/3G phone puts in an RP-DATA, inside a SIP MESSAGE body of

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
/*
Imsd:Util — small self-contained primitives the rest of the engine builds on:
random SIP tokens, IPv6 detection + host/port formatting, the RFC 5952

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types no-char-pointer
/*
ImsdBus — what the two system-bus daemons (imsd, imsd-ofonod) share on the
bus side: the polkit gate in front of call control and messaging.

View file

@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
# Maintainer: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>
# Binary packaging: wraps a crafter-build binary cross-compiled per the
# cross-compiling flow of AGENTS.md §4.3 into a proper apk — used by this repo's
# cross-compiling flow of AGENTS.md §4.2 into a proper apk — used by this repo's
# package CI (packaging/build-package.sh, which also seds pkgver from
# implementations/main.cpp) and runnable by hand. The source tarball is
# produced by packaging/make-bin-tarball.sh; the desktop/preset files and

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
# CI package build: cross-compile imsd for aarch64 with crafter-build (the
# cross-compiling flow of AGENTS.md §4.3), run the test suite natively, and package
# cross-compiling flow of AGENTS.md §4.2), run the test suite natively, and package
# the result via packaging/APKBUILD.binary. Expects an x86_64 Alpine
# environment with root — the workflow runs it in an alpine:edge job
# container on the privileged `flatpak` runner: crafter-build is the

View file

@ -10,7 +10,7 @@
#
# packaging/make-sysroot.sh [dir] # default: ~/.cache/imsd/sysroot-aarch64-alpine
# crafter-build -- --target=aarch64-alpine-linux-musl --sysroot=<dir> \
# --march=… --mtune=… # the phone's values: AGENTS.md §4.3
# --march=… --mtune=… # the phone's values: AGENTS.md §4.2
set -eu
SYSROOT="${1:-$HOME/.cache/imsd/sysroot-aarch64-alpine}"

View file

@ -1,11 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file no-char-pointer
import std;
import Crafter.Build;
#pragma crafter dependency "https://forgejo.catcrafts.net/Catcrafts/Crafter.LintRules.git" commit "e906f797da2cd0b1776dd1b420f9b04d3cd24baf"
import Crafter.LintRules;
namespace fs = std::filesystem;
using namespace Crafter;
@ -120,7 +117,6 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
ofonod.GetInterfacesAndImplementations(ifaces, impls);
}
ApplyGioFlags(ofonod);
LintRules::AddRules(ofonod);
return ofonod;
}
if (wantDialerd) {
@ -136,7 +132,6 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
dialerd.GetInterfacesAndImplementations(ifaces, impls);
}
ApplyGioFlags(dialerd);
LintRules::AddRules(dialerd);
return dialerd;
}
if (wantMedia) {
@ -153,7 +148,6 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
}
media.linkFlags.push_back("-ldl"); // dlopen the AMR-WB codecs
media.linkFlags.push_back("-lpthread"); // std::jthread playout/mic
LintRules::AddRules(media);
return media;
}
@ -196,7 +190,6 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
std::array<fs::path, 1> impls = { "implementations/pcscf" };
pcscf.GetInterfacesAndImplementations(ifaces, impls);
}
LintRules::AddRules(pcscf);
return pcscf;
}
@ -229,7 +222,5 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
cfg.AddTest("Sdp").Dependencies({ Core.get() });
cfg.AddTest("Sms").Dependencies({ Core.get() });
LintRules::AddRules(cfg);
return cfg;
}

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
// Imsd:Aka unit tests — the AKAv1-MD5 digest against a vector cross-computed
// with the Python reference, identity assembly, the qmicli/mmcli text
// parsers (fed real device output), and the AUTHENTICATE APDU build/parse.

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
// Imsd:Engine unit tests — the call state machine driven through recorded
// network dialogs. Outgoing: reliable-18x PRACK, 2xx ACK + media start,
// media-plane far-end hangup, local hang-up (CANCEL before answer, BYE
@ -1256,7 +1255,7 @@ int main() {
auto findSms = [](const std::vector<SmsAction>& a, SmsAction::Type t) -> const SmsAction* { for (const auto& x : a) if (x.type == t) return &x; return nullptr; };
auto bodyRp = [](std::string_view msg) {
std::string_view body = imsd::sip::Body(msg);
return ParseRp(std::span<const std::uint8_t>(reinterpret_cast<const std::uint8_t*>(body.data()), body.size()), false); // lint-disable-line no-char-pointer
return ParseRp(std::span<const std::uint8_t>(reinterpret_cast<const std::uint8_t*>(body.data()), body.size()), false);
};
auto final = [](std::string_view callid, int code, std::string_view text) { return std::format("SIP/2.0 {} {}\r\nCall-ID: {}\r\nCSeq: 1 MESSAGE\r\nContent-Length: 0\r\n\r\n", code, text, callid); };
const auto kpnSc = *imsd::util::FromHex("07911356131313f3");

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
// Imsd:Ipsec unit tests — the `ip xfrm` setup command sequence (byte-exact
// argv), the warm-SA reader, fed `ip xfrm state`/`policy` output in the
// exact shape captured from a registered FP6 (addresses/keys synthetic), and

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
// Imsd:Messages unit tests — the initial and the protected REGISTER and the INVITE
// compared byte-for-byte against a reference message cross-generated from the
// Python VoLTE stack with pinned tags/branches/SPIs; their variants and the other

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
// Imsd:Qmi unit tests — the request bytes imsd-pcscf sends (pinned to the
// bytes the dev-phone probe sent, which are protocol only), a Get Current
// Settings answer in the exact TLV shape the Fairphone 6's modem returned

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
// Imsd:Sdp unit tests — offer building (byte-exact) and answer parsing
// (payload-type preference, octet-align, address family). The IPv6 answer
// mirrors what a live commercial IMS core actually returns (AMR-WB pt=97

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
// Imsd:Sip unit tests — header access, status-line parsing, granted-expires
// extraction, caller-identity extraction, and the TCP frame buffer (split
// delivery, keepalive pongs, pipelined messages). These pin the module's

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
// Imsd:Sms unit tests — the short message codecs byte for byte: the GSM
// 7-bit alphabet, its extension table and the septet packing (the classic
// "hellohello" vector), UCS-2, the address fields, SMS-SUBMIT (the classic

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// lint-disable-file fixed-width-types
// Imsd:Util unit tests — MD5 against the RFC 1321 test suite, base64/hex
// decoding, host/port formatting, the RFC 5952 canonical IPv6 text and the
// address-list parser, and the deterministic-seed RNG. MD5 and