pyscn Analysis Report

Generated: 2026-07-04 02:26:26

Health Score: 69/100 (Grade: C)

Analysis Summary

Quality Scores

Complexity 65/100
Avg: 6.6, High-risk: 0
Dead Code 100/100
0 issues, 0 critical
Duplication 0/100
73.5% duplication, 1 groups
Coupling (CBO) 90/100
Avg: 1.5, High-coupling: 0/100
Dependencies 85/100
2 cycles, Depth: 4
Architecture 100/100
100% compliant

File Statistics

81
Total Files
81
Analyzed Files
6.61
Avg Complexity
0
Dead Code Issues
298
Unique Fragments
73.5%
Code Duplication
100
Total Classes
0
High Coupling (CBO)
1.48
Avg CBO

Dependencies

81
Total Modules
68
Total Dependencies
4
Max Depth
❌ 1
Circular Dependencies

Architecture

0
Violations
100.0%
Compliance
2
Layers Analyzed
68
Total Rules

Complexity Analysis

65/100
88
Total Functions
6.61
Average
14
Maximum

Top Complex Functions

Function File Complexity Nesting Depth Risk
verify_token mcp_common/auth/core.py 14 2 medium
FallbackChain.execute mcp_common/llm/fallback.py 14 5 medium
create_ssl_context mcp_common/websocket/tls.py 12 3 medium
ensure_dual_use mcp_common/interfaces/__init__.py 12 2 medium
run mcp_common/apple_script/bridge.py 12 2 medium
PromptToolkitBackend.prompt_choice mcp_common/backends/toolkit.py 11 5 medium
sanitize_path mcp_common/security/sanitization.py 11 3 medium
trim_description mcp_common/tools/descriptions.py 10 3 medium
PromptToolkitBackend.select_file mcp_common/backends/toolkit.py 10 3 medium
PythonHandler._extract_function mcp_common/parsing/tree_sitter/handlers/python.py 10 5 medium

Showing top 10 of 88 functions

Dead Code Detection

100/100
0
Total Issues
0
Critical
0
Warnings

✓ No dead code detected

Clone Detection

0/100
298
Unique Fragments
1
Clone Groups
0.91
Avg Similarity

Clone Groups

Code fragments grouped by similarity

Group 0 - 298 clones (Type Type-3, similarity: 0.91)

File Lines Size
mcp_common/apple_script/bridge.py 42-76 35 lines
mcp_common/auth/audit.py 19-44 26 lines
mcp_common/auth/audit.py 47-60 14 lines
mcp_common/auth/config.py 26-72 47 lines
mcp_common/auth/config.py 32-55 24 lines
mcp_common/auth/core.py 26-34 9 lines
mcp_common/auth/core.py 37-55 19 lines
mcp_common/auth/core.py 58-95 38 lines
mcp_common/auth/decorator.py 32-131 100 lines
mcp_common/auth/decorator.py 39-129 91 lines
... and 288 more clones

Class Coupling

90/100

Coupling Between Objects (CBO) metrics

100
Total Classes
0
High Risk Classes
1.48
Average CBO
6
Max CBO

Most Dependent Classes

Class File CBO Risk Level Dependent Classes
ParseResult mcp_common/parsing/tree_sitter/models.py 6 medium BaseModel, SupportedLanguage, SymbolInfo, SymbolRelationship, ImportInfo, ComplexityMetrics
CodeGraphAnalyzer mcp_common/code_graph/analyzer.py 6 medium CodeNode, FileNode, Any, ImportNode, ClassNode, FunctionNode
PythonHandler mcp_common/parsing/tree_sitter/handlers/python.py 4 low SymbolInfo, SymbolRelationship, ImportInfo, ComplexityMetrics
LLMSettings mcp_common/llm/config.py 3 low ProviderConfig, BaseModel, Any
ContentHashLRUCache mcp_common/parsing/tree_sitter/cache.py 3 low T, CacheStats, CacheEntry
WebSocketMessage mcp_common/websocket/protocol.py 3 low BaseModel, MessageType, Any
TokenPayload mcp_common/auth/core.py 3 low Permission, datetime, Any
RuntimeComponents mcp_common/server/runtime.py 3 low RuntimeSnapshotManager, RuntimeCacheManager, HealthMonitor
DependencyWaiter mcp_common/health.py 3 low HealthCheckResult, HealthChecker, WaitResult
SymbolInfo mcp_common/parsing/tree_sitter/models.py 3 low BaseModel, SymbolKind, SupportedLanguage

Showing top 10 of 100 classes

Module Dependencies

85/100

Project-wide module dependency graph metrics

81
Total Modules
68
Total Dependencies
4
Max Depth
❌ 1
Circular Dependencies

Circular Dependencies

Severity Size Dependency Paths
LOW 2 mcp_common.parsing.tree_sitter.core → mcp_common.parsing.tree_sitter.grammars
mcp_common.parsing.tree_sitter.grammars → mcp_common.parsing.tree_sitter.core
💡 Suggestions for Breaking Cycles:
  • Consider introducing interfaces or abstract base classes to invert dependencies
  • Break cycle between mcp_common.parsing.tree_sitter.core and mcp_common.parsing.tree_sitter.grammars by introducing a third module or using dependency injection
  • Review your architecture to ensure proper layer separation (e.g., presentation → application → domain → infrastructure)
  • Consider using event-driven patterns to decouple tightly coupled modules

Longest Dependency Chains

# Depth Path
1 5 mcp_common.prompting.adapter → mcp_common.prompting.factory → mcp_common.backends.pyobjc → mcp_common.prompting.base → mcp_common.prompting.models
2 4 mcp_common.auth.decorator → mcp_common.auth.core → mcp_common.auth.identity → mcp_common.auth.exceptions
3 4 mcp_common.contracts → mcp_common.auth.core → mcp_common.auth.identity → mcp_common.auth.exceptions
4 4 mcp_common.parsing.tree_sitter.core → mcp_common.parsing.tree_sitter.grammars → mcp_common.parsing.tree_sitter.handlers.python → mcp_common.parsing.tree_sitter.models
5 4 mcp_common.parsing.tree_sitter.grammars → mcp_common.parsing.tree_sitter.core → mcp_common.parsing.tree_sitter.cache → mcp_common.parsing.tree_sitter.models
6 4 mcp_common.prompting.adapter → mcp_common.prompting.factory → mcp_common.prompting.base → mcp_common.prompting.models
7 4 mcp_common.prompting.adapter → mcp_common.prompting.factory → mcp_common.prompting.exceptions → mcp_common.prompting.models
8 4 mcp_common.prompting.adapter → mcp_common.prompting.factory → mcp_common.backends.pyobjc → mcp_common.prompting.base
9 4 mcp_common.prompting.adapter → mcp_common.prompting.factory → mcp_common.backends.pyobjc → mcp_common.prompting.exceptions
10 4 mcp_common.prompting.factory → mcp_common.backends.pyobjc → mcp_common.prompting.exceptions → mcp_common.prompting.models

Architecture Validation

100/100
2
Layers Analyzed
68
Total Rules
0
Violations
100.0%
Compliance

✓ No architecture violations