Coverage for metrics / cognitive / common.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-02-08 15:04 -0800

1"""Common cognitive complexity utilities.""" 

2 

3from __future__ import annotations 

4from functools import partial 

5 

6 

7def compute_cognitive(func_node, func_name: str, walk_fn) -> int: 

8 return walk_fn(func_node, nesting=0, func_name=func_name, top_func=func_node) 

9 

10 

11def make_compute_cognitive(walk_fn): 

12 return partial(compute_cognitive, walk_fn=walk_fn)