# pyscn Analysis Report

Generated: 2025-12-23 10:20:55

Health Score: 61/100 (Grade: C)

## Analysis Summary

### Quality Scores

Complexity 70/100
Avg: 6.0, High-risk: 0
Dead Code 100/100
0 issues, 0 critical
Duplication 0/100
15.0% duplication, 3 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
6.00
Avg Complexity
0
Dead Code Issues
20
Unique Fragments
15.0%
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
5
Total Functions
6.00
Average
7
Maximum

### Top Complex Functions

Function | File | Complexity | Nesting Depth | Risk
--- | --- | --- | --- | ---
chat_controller | agent\controller.py | 7 | 5 | low
_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

0/100
20
Unique Fragments
3
Clone Groups
0.91
Avg Similarity

### Clone Groups

Code fragments grouped by similarity

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

File | Lines | Size
--- | --- | ---
agent\controller.py | 37-107 | 71 lines
agent\graph.py | 50-85 | 36 lines

#### Group 0 - 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

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

File | Lines | Size
--- | --- | ---
agent\controller.py | 25-107 | 83 lines
agent\tools\product_search_helpers.py | 58-174 | 117 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.tools.get_tools
6 | 3 | agent.controller → agent.graph → agent.models
7 | 3 | agent.controller → agent.graph → agent.prompt
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