Related Code Files:
code-intelligence-toolkit/dependency_analyzer.py- Comprehensive Java dependency analysis toolcode-intelligence-toolkit/find_text_v5.py- Integration for pattern searchingcode-intelligence-toolkit/cross_file_analysis_ast.py- AST-based dependency analysis
The dependency_analyzer.py is a comprehensive "tool to rule them all" for analyzing Java class dependencies, line counts, and complexity. It provides automated dependency extraction, visualization, and detailed reporting capabilities.
- Dependency Extraction: Automatically finds and analyzes all dependencies
- Line Count Analysis: Counts lines of code for all classes and dependencies
- Complexity Scoring: Calculates complexity based on size, dependencies, and category
- Category Classification: Automatically categorizes classes (UI, Trading, Analysis, etc.)
- Dependency Graphs: Interactive network graphs showing relationships
- Category Breakdowns: Visual analysis by functional category
- HTML Reports: Comprehensive interactive reports
- Export Formats: JSON, CSV, Markdown, and HTML exports
Classes are automatically categorized using pattern matching:
- UI: GUI components, frames, dialogs, monitors
- Trading: Order management, positions, portfolio logic
- Analysis: Analyzers, calculators, detectors, trackers
- Indicator: VWAP, moving averages, technical indicators
- Data: Data structures, caches, buffers, stores
- Utility: Helpers, managers, services, utilities
- Test: Test classes and test utilities
# Analyze NubiaV7_1_5 with default settings
./run_any_python_tool.sh dependency_analyzer.py ComplexAnalyzerV7_1_5
# Quick summary only
./run_any_python_tool.sh dependency_analyzer.py ComplexAnalyzerV7_1_5 --summary-only
# Show category breakdown
./run_any_python_tool.sh dependency_analyzer.py ComplexAnalyzerV7_1_5 --categories --complexity# Generate all outputs (graphs, reports, exports)
./run_any_python_tool.sh dependency_analyzer.py ComplexAnalyzerV7_1_5 --export-all
# Custom depth and specific outputs
./run_any_python_tool.sh dependency_analyzer.py DataProcessorControllerV2 \
--depth 3 --html-report --graph --json --csv# Generate matplotlib graph only
./run_any_python_tool.sh dependency_analyzer.py MyClass \
--matplotlib-graph dependency_graph.png
# Generate interactive Plotly graph
./run_any_python_tool.sh dependency_analyzer.py MyClass \
--plotly-graph interactive_analysis.html
# Both graphs plus HTML report
./run_any_python_tool.sh dependency_analyzer.py MyClass --graph --html-reportReal-time analysis results with:
- Total classes and line counts
- Category breakdowns
- Top complexity classes
- Largest classes by lines
Interactive web reports featuring:
- Summary statistics dashboard
- Category-based class listings
- Detailed class information table
- Complexity scoring and color coding
Visual network representations showing:
- Node size = Lines of code
- Node color = Category type
- Edges = Dependencies between classes
- Interactive features (with Plotly)
- JSON: Complete analysis data for programmatic use
- CSV: Tabular class information for spreadsheet analysis
- Markdown: Documentation-friendly reports
For ComplexAnalyzerV7_1_5, the tool provides:
Total Classes: 45+ analyzed dependencies
Total Lines: ~55,000+ lines of code
Average Lines per Class: ~1,200 lines
Categories: 8 different functional areas
- Trading Systems: DataProcessorControllerV2, StateManagerControllerV3
- Market Analysis: DataProfileAnalyzerV4, ClusterAnalyzerV1_7
- UI Components: Multiple monitoring and debug interfaces
- Indicators: VWAP calculations, proximity tracking
- Data Management: Health tracking, sweep detection
- Identifies most complex classes requiring maintenance attention
- Highlights classes with high dependency counts
- Shows architectural bottlenecks and coupling issues
# Custom search paths
--project-root /path/to/project
# Analysis depth control
--depth 4 # Analyze up to 4 levels deep
# Category filtering
--list-categories # Show available categories
# Output customization
--prefix MyAnalysis # Custom file prefixes
--output-dir custom_output/ # Custom output directoryThe dependency analyzer integrates with existing toolkit tools:
- Uses
find_text_v5.pyfor pattern searching - Leverages
cross_file_analysis_ast.pyfor AST analysis - Compatible with
wc -lfor line counting validation
- Depth Control: Use
--depth 2-3for large codebases - Pattern Filtering: Tool filters out standard Java classes automatically
- Caching: Results are cached to improve subsequent analysis speed
# Core functionality (always available)
python3 # Built into tool
# Optional visualization (recommended)
pip install matplotlib networkx # For static graphs
pip install plotly # For interactive graphs- Without matplotlib: Text-based analysis only
- Without plotly: Static graphs only
- Without visualization libs: Full analysis with data exports
- Understand dependency relationships
- Identify architectural bottlenecks
- Assess code coupling and cohesion
- Find largest/most complex classes needing attention
- Identify heavily coupled components
- Plan refactoring priorities
- Automatically generate dependency documentation
- Create visual architecture diagrams
- Export data for external analysis tools
- Complexity scoring for quality metrics
- Category distribution analysis
- Dependency depth analysis
# Begin with summary to understand scope
dependency_analyzer.py MyClass --summary-only
# Then expand to full analysis
dependency_analyzer.py MyClass --export-all- Depth 1-2: Quick analysis, immediate dependencies
- Depth 3-4: Comprehensive analysis, full picture
- Depth 5+: Very detailed (may include framework classes)
# Find specific patterns first
./run_any_python_tool.sh find_text_v5.py "OrderSender" --auto-find
# Then analyze the found class
dependency_analyzer.py DataProcessorControllerV2 --html-report- Run analysis after major changes
- Track complexity trends over time
- Use for architecture reviews
- Classes not found: Ensure correct project root with
--project-root - Too many warnings: Redirect stderr with
2>/dev/null - Large output: Use
--summary-onlyfor quick checks - Missing visualizations: Install optional dependencies
- Use
--depth 2for large enterprise codebases - Filter by specific categories if focusing on particular areas
- Use
--summary-onlyfor quick health checks
The dependency_analyzer.py tool provides comprehensive automated analysis of Java class dependencies with:
✅ Automated dependency discovery and analysis
✅ Visual dependency graphs and reports
✅ Multiple export formats for different needs
✅ Smart classification and complexity scoring
✅ Integration with existing toolkit tools
This makes it the definitive "tool to rule them all" for understanding code architecture, planning maintenance, and generating dependency documentation.