GCC Code Coverage Report


Directory: ../
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 1 / 0 / 1
Functions: 100.0% 1 / 0 / 1
Branches: -% 0 / 0 / 0

src/linter/rules/CyclomaticComplexityRule.h
Line Branch Exec Source
1 // Copyright (c) 2021-2026 ChilliBits. All rights reserved.
2
3 #pragma once
4
5 #include <linter/LintRule.h>
6
7 namespace spice::compiler {
8
9 /**
10 * Flags functions/procedures whose body has grown too many independent branches to review or test
11 * with confidence in one piece. McCabe cyclomatic complexity: starts at 1 for the single
12 * straight-line path through the body, +1 for every `if`, loop, and `case` branch. A
13 * style/maintainability check, not a correctness one, so it lives in `spice lint` rather than as a
14 * compiler warning.
15 */
16 class CyclomaticComplexityRule final : public LintRule {
17 public:
18 8 [[nodiscard]] constexpr std::string_view id() const override { return "cyclomatic-complexity"; }
19
20 void checkFctDef(FctDefNode *node, std::vector<LintFinding> &findings) override;
21 void checkProcDef(ProcDefNode *node, std::vector<LintFinding> &findings) override;
22 };
23
24 } // namespace spice::compiler
25