# pyscn Analysis Report

Generated: 2025-12-23 10:22:31

Health Score: 70/100 (Grade: C)

## Analysis Summary

### Quality Scores

Complexity 70/100
Avg: 5.8, High-risk: 0
Dead Code 100/100
0 issues, 0 critical
Duplication 45/100
5.3% duplication, 1 groups
Coupling (CBO) 100/100
Avg: 1.5, High-coupling: 0/4
Dependencies 85/100
No cycles, Depth: 4
Architecture 10/100
10% compliant

### File Statistics

12
Total Files
12
Analyzed Files
5.75
Avg Complexity
0
Dead Code Issues
19
Unique Fragments
5.3%
Code Duplication
4
Total Classes
0
High Coupling (CBO)
1.50
Avg CBO

### Dependencies

12
Total Modules
10
Total Dependencies
4
Max Depth
✅ 0
Circular Dependencies

### Architecture

9
Violations
10.0%
Compliance
2
Layers Analyzed
10
Total Rules

## Complexity Analysis

70/100
4
Total Functions
5.75
Average
7
Maximum

### Top Complex Functions

Function | File | Complexity | Nesting Depth | Risk
--- | --- | --- | --- | ---
_get_where_clauses | agent\tools\product_search_helpers.py | 7 | 2 | low
data_retrieval_tool | agent\tools\data_retrieval_tool.py | 6 | 2 | low
CANIFAGraph._agent_node | agent\graph.py | 5 | 4 | low
CANIFAGraph._should_continue | agent\graph.py | 5 | 1 | low

## Dead Code Detection

100/100
0
Total Issues
0
Critical
0
Warnings

✓ No dead code detected

## Clone Detection

45/100
19
Unique Fragments
1
Clone Groups
0.90
Avg Similarity

### Clone Groups

Code fragments grouped by similarity

#### Group 1 - 2 clones (Type Type-3, similarity: 0.90)

File | Lines | Size
--- | --- | ---
agent\graph.py | 105-136 | 32 lines
agent\tools\product_search_helpers.py | 13-55 | 43 lines

## Class Coupling

100/100

Coupling Between Objects (CBO) metrics

4
Total Classes
0
High Risk Classes
1.50
Average CBO
3
Max CBO

### Most Dependent Classes

Class | File | CBO | Risk Level | Dependent Classes
--- | --- | --- | --- | ---
AgentState | agent\models.py | 3 | low | TypedDict, BaseMessage, add_messages
CANIFAGraph | agent\graph.py | 1 | low | BaseChatModel
QueryRequest | agent\models.py | 1 | low | BaseModel
SearchParams | agent\tools\data_retrieval_tool.py | 1 | low | BaseModel

## Module Dependencies

85/100

Project-wide module dependency graph metrics

12
Total Modules
10
Total Dependencies
4
Max Depth
✅ 0
Circular Dependencies

### Circular Dependencies

✅ No circular dependencies detected

All modules have acyclic dependency relationships.

### Longest Dependency Chains

# | Depth | Path
--- | --- | ---
1 | 5 | agent.controller → agent.graph → agent.tools.get_tools → agent.tools.data_retrieval_tool → agent.tools.product_search_helpers
2 | 4 | agent.controller → agent.graph → agent.tools.get_tools → agent.tools.data_retrieval_tool
3 | 4 | agent.controller → agent.graph → agent.tools.get_tools → agent.tools.customer_info_tool
4 | 4 | agent.graph → agent.tools.get_tools → agent.tools.data_retrieval_tool → agent.tools.product_search_helpers
5 | 3 | agent.controller → agent.graph → agent.prompt
6 | 3 | agent.controller → agent.graph → agent.tools.get_tools
7 | 3 | agent.controller → agent.graph → agent.models
8 | 3 | agent.graph → agent.tools.get_tools → agent.tools.data_retrieval_tool
9 | 3 | agent.graph → agent.tools.get_tools → agent.tools.customer_info_tool
10 | 3 | agent.tools.get_tools → agent.tools.data_retrieval_tool → agent.tools.product_search_helpers

## Architecture Validation

10/100
2
Layers Analyzed
10
Total Rules
9
Violations
10.0%
Compliance

### Top Rule Violations

Severity | Rule | From | To
--- | --- | --- | ---
warning | strict_mode | agent.controller | agent.graph
warning | strict_mode | agent.controller | agent.memory
warning | strict_mode | agent.graph | agent.models
warning | strict_mode | agent.graph | agent.prompt
warning | strict_mode | agent.graph | agent.tools.get_tools
warning | strict_mode | agent.nodes | agent
warning | strict_mode | agent.tools.data_retrieval_tool | agent.tools.product_search_helpers
warning | strict_mode | agent.tools.get_tools | agent.tools.customer_info_tool
warning | strict_mode | agent.tools.get_tools | agent.tools.data_retrieval_tool