You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Final CCN-10 ratchet: three near-bar refactors + bar to 10
Closes out the v2.0 cyclomatic-complexity sweep by retiring the last
three CCN-over-10 functions and lowering CCN_MAX to its long-term
target (10, matching artistai's [lint.mccabe] max-complexity = 10).
radix_tree::find (header-only template, CCN 12 -> 7):
Extracted match_root_terminus -- the exact-first-then-prefix scan on
the root node for empty-segment paths ("/"). The descent loop is
unchanged; only the leading early-return ladder is pulled out.
http_method::to_string (CCN 11 -> 2):
Replaced the 10-arm switch with a constexpr std::array<string_view>
indexed by the underlying enum value. The array size is tied to
http_method::count_, so a future enum addition that forgets to
extend the table fails compilation rather than silently returning
an empty view. The constexpr noexcept contract is preserved.
normalize_path (file-scope static, CCN 11 -> 7):
Extracted apply_normalized_segment -- per-segment dispatch ("" / "."
skip / ".." pop / push). normalize_path is now the tokenize-and-
rebuild loop without inline segment logic.
scripts/check-complexity.sh CCN_MAX 13 -> 10. The header comment is
updated to reflect that the bar is now stable: new offenders must be
brought below 10 at the same commit they are introduced; lifting
CCN_MAX is not allowed.
Final state summary (v2.0 branch):
* 14 v1 offenders -> 0 (largest was webserver::start at CCN 51,
finalize_answer at 46, ip_representation ctor at 34).
* New helpers across the sweep: 40+ small functions, each <= 10 CCN.
* No new public API surface added; every helper lives on
detail::webserver_impl, ip_representation private section,
http_request_impl private section, or in anonymous-namespace
file-scope statics. Public headers are unchanged from a consumer
standpoint.
* Duplication gate (PMD CPD --minimum-tokens 100) was clean from
commit 1 and remains so.
Verified locally: full `make check` (passes both gates + 48 unit tests
+ check-headers / hygiene / install-layout / examples / readme /
release-notes / doxygen).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments