Compute and store the structural complexity metrics for a definition. */
| 3458 | |
| 3459 | /* Compute and store the structural complexity metrics for a definition. */ |
| 3460 | static void set_def_complexity(CBMDefinition *def, TSNode body, const CBMLangSpec *spec) { |
| 3461 | cbm_complexity_t cx; |
| 3462 | cbm_compute_complexity(body, spec->branching_node_types, &cx); |
| 3463 | def->complexity = cx.cyclomatic; |
| 3464 | def->cognitive = cx.cognitive; |
| 3465 | def->loop_count = cx.loop_count; |
| 3466 | def->loop_depth = cx.loop_depth; |
| 3467 | def->max_access_depth = cx.max_access_depth; |
| 3468 | } |
| 3469 | |
| 3470 | /* Extract the bare type name from a Go method receiver node. |
| 3471 | * The receiver is a parameter_list, e.g. "(s *OrderService)" or "(s Order)". |
no test coverage detected