object
cogc_metric
Cognitive complexity metric (approximation). For each non-auxiliary predicate, the score contribution is the number of extra clauses (i.e. number of clauses minus one, for multi-clause branching) plus one if the predicate is directly recursive. The entity score is the sum of all predicate contributions. Protocols are not scored as they cannot define predicates.
logtalk_load(code_metrics(loader))static, context_switching_calls
Limitations: The reflection API does not expose control constructs such as cuts, conditionals, or disjunctions. This metric approximates cognitive complexity using only clause-level branching and direct recursion.
Branching: A predicate with N clauses contributes N-1 to the score, representing the N-1 extra choices a reader must track.
Recursion: A predicate that directly calls itself (within the same entity) contributes an additional 1 to the score.
Score interpretation: The score is represented by a non-negative integer. Higher scores indicate predicates or entities that are harder to understand due to more branching choices or self-recursion. A score of 0 means all predicates are single-clause and non-recursive.
Aggregation: File, directory, and library scores are computed by summing the individual entity scores.
Public predicates
(no local declarations; see entity ancestors if any)
Protected predicates
(no local declarations; see entity ancestors if any)
Private predicates
(no local declarations; see entity ancestors if any)
Operators
(none)