- Updated AGENTS.md to provide comprehensive guidance on the Claude-Scripts project, including project overview, development commands, and architecture. - Added new utility functions in hooks/guards/utils.py to support code quality checks and enhance modularity. - Introduced HookResponseRequired TypedDict for stricter type checking in hook responses. - Enhanced quality guard functionality with additional checks and improved type annotations across various modules. - Updated pyproject.toml and uv.lock to include mypy as a development dependency for better type checking. - Improved type checking configurations in pyrightconfig.json to exclude unnecessary directories and suppress specific warnings. This update significantly improves the structure and maintainability of the code quality analysis toolkit, ensuring better adherence to type safety and project guidelines.
36 lines
935 B
Python
36 lines
935 B
Python
"""Type stubs for radon.complexity module."""
|
|
|
|
from typing import Any
|
|
from radon.visitors import Function, Class
|
|
|
|
SCORE: str
|
|
LINES: str
|
|
ALPHA: str
|
|
|
|
ComplexityBlock = Function | Class
|
|
|
|
def cc_rank(cc: int) -> str:
|
|
"""Rank complexity score from A to F."""
|
|
...
|
|
|
|
def average_complexity(blocks: list[ComplexityBlock]) -> float:
|
|
"""Compute average cyclomatic complexity from blocks."""
|
|
...
|
|
|
|
def sorted_results(blocks: list[ComplexityBlock], order: str = ...) -> list[ComplexityBlock]:
|
|
"""Sort blocks by complexity."""
|
|
...
|
|
|
|
def add_inner_blocks(blocks: list[ComplexityBlock]) -> list[ComplexityBlock]:
|
|
"""Add inner closures and classes as top-level blocks."""
|
|
...
|
|
|
|
def cc_visit(code: str, **kwargs: Any) -> list[ComplexityBlock]:
|
|
"""Visit code with ComplexityVisitor."""
|
|
...
|
|
|
|
def cc_visit_ast(ast_node: Any, **kwargs: Any) -> list[ComplexityBlock]:
|
|
"""Visit AST with ComplexityVisitor."""
|
|
...
|
|
|