|
oct
|
Classes | |
| class | FunctionComplexity |
| class | _DecisionCounter |
| class | _FunctionCollector |
Functions | |
| bool | _is_wildcard_pattern (ast.pattern pattern) |
| list[FunctionComplexity] | analyze_source (str source, str filename="<unknown>") |
| list[FunctionComplexity] | analyze_file (str|Path path) |
Purpose
-------
Compute stable per-function cyclomatic complexity from Python syntax trees.
Responsibilities
----------------
- Apply Plan 214's pinned decision-counting convention.
- Score nested functions and lambdas independently from their parents.
- Preserve file, qualname, and source-span coordinates for every result.
Diagnostics
-----------
Domain: OCT-COMPLEXITY
Levels:
L2 - lifecycle
L3 - measurement details
L4 - deep tracing
Contracts
---------
- Every function starts with complexity one.
- The engine imports only Python standard-library modules.
- Syntax errors propagate so orchestration can report them honestly.
Dependencies
------------
- ast (Python syntax tree)
- tokenize (declared source encodings)
|
protected |
| list[FunctionComplexity] oct.complexity.engine.analyze_file | ( | str | Path | path | ) |
| list[FunctionComplexity] oct.complexity.engine.analyze_source | ( | str | source, |
| str | filename = "<unknown>" ) |
Analyze Python source text and return records in source order. ``SyntaxError`` is intentionally allowed to reach the caller. Directory orchestration records that error explicitly instead of silently omitting the file.
Definition at line 212 of file engine.py.