Skip to main content

Module annotate

Module annotate 

Source
Expand description

Read-time code-health annotations.

Produces sparse, deterministic per-function annotations (cc=18) for the over-threshold functions in a file, so an agent reading signatures or the map sees complexity hotspots inline and can decide not to read a giant function in full. Only functions above the threshold are annotated, keeping output byte-stable and cheap (#498-safe).

Structs§

ReadAnnotation
One inline annotation for a function in a read view.

Functions§

annotations_for_file
Annotations for the over-threshold functions in source of file ext. Sorted by line then name. Empty when tree-sitter is off, the extension is unsupported, or nothing is over threshold.
by_name
Index annotations by function name for renderers that match on the symbol name (more robust than line numbers when attributes/decorators shift lines).
cognitive_for_symbol
Cognitive complexity of the function named name defined nearest start_line in source (file extension ext). Unlike annotations_for_file this is not threshold-gated, so a targeted ctx_symbol query can show the exact cc of any function. None when tree-sitter is off, the extension is unsupported, or no function with that name is present (e.g. a struct symbol).