Consolidate 6 analysis files into 3 focused adapters#408
Draft
codegen-sh[bot] wants to merge 2 commits intodevelopfrom
Draft
Consolidate 6 analysis files into 3 focused adapters#408codegen-sh[bot] wants to merge 2 commits intodevelopfrom
codegen-sh[bot] wants to merge 2 commits intodevelopfrom
Conversation
- Created libs_analysis.py: External tools integration (Ruff, MyPy, Pylint) - Created main_analysis.py: CLI orchestrator for comprehensive analysis - Combines: Graph-sitter + LSP + AutoGenLib + External libs - Clean separation of concerns with CLI entry point - Usage: python main_analysis.py --repo /path/to/codebase Co-authored-by: Zeeeepa <zeeeepa@gmail.com>
✅ Restructured codebase from 6 files (~12K lines) into 3 focused adapters: **1. graph_sitter_adapter.py** (1,660 lines, 75KB) - Pure Graph-sitter operations - GraphSitterAnalyzer class with 84 methods - No external tool dependencies **2. libs_adapter.py** (745 lines, 26KB) - External tool integrations - RuffIntegration, LSPDiagnosticsCollector, ErrorDatabase, AutoGenLibFixer - Re-exports from lsp_diagnostics and autogenlib_adapter **3. main_analysis.py** (5,928 lines, 241KB) - Orchestration, visualization, transformation - ComprehensiveAnalyzer (46 methods), AnalysisEngine (41 methods) - EnhancedVisualizationEngine, TransformationEngine, InteractiveAnalyzer, ReportGenerator - FastAPI endpoints and CLI **Deduplication:** - Chose best versions when duplicates existed - ComprehensiveAnalyzer: 46 methods (analysisbig.py) vs 22 (analysis.py) - RuffIntegration: 7 methods (analysisbig.py) vs 4 (analysis.py) **Deleted (consolidated):** - src/analysis.py - src/graph_sitter_analysis.py - src/graph_sitter_backend.py - src/analysisbig.py **Kept (still used):** - src/lsp_diagnostics.py - src/autogenlib_adapter.py Added MIGRATION.md with complete migration guide. Co-authored-by: Zeeeepa <zeeeepa@gmail.com>
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Overview
Restructured the codebase from 6 fragmented analysis files (~12K lines with duplication) into 3 focused, well-organized adapters with clear separation of concerns.
✅ What Changed
New Structure (3 files):
1. graph_sitter_adapter.py (1,660 lines, 75KB)
Purpose: Pure Graph-sitter operations
GraphSitterAnalyzerclass with 84 methods2. libs_adapter.py (745 lines, 26KB)
Purpose: External tool integrations
RuffIntegration(7 methods) - Ruff linting/formattingLSPDiagnosticsCollector(3 methods) - LSP diagnosticsErrorDatabase(6 methods) - SQLite error trackingAutoGenLibFixer(3 methods) - AI-powered fixeslsp_diagnosticsandautogenlib_adapter3. main_analysis.py (5,928 lines, 241KB)
Purpose: Orchestration, visualization, transformation, API, CLI
ComprehensiveAnalyzer(46 methods) - Primary orchestratorAnalysisEngine(41 methods) - Backend analysis engineEnhancedVisualizationEngine(18 methods) - Graphs and visualizationsTransformationEngine(9 methods) - Code transformationsInteractiveAnalyzer(8 methods) - Interactive CLIReportGenerator(12 methods) - Report generationmain()functionFiles Deleted (consolidated):
src/analysis.pysrc/graph_sitter_analysis.pysrc/graph_sitter_backend.pysrc/analysisbig.pyFiles Kept (still used):
src/lsp_diagnostics.py- Imported by libs_adaptersrc/autogenlib_adapter.py- Imported by libs_adapter🔍 Deduplication Strategy
When duplicate classes existed, we chose the most comprehensive versions:
ComprehensiveAnalyzerRuffIntegrationReportGeneratorGraphSitterAnalyzer📋 Migration Guide
Complete migration guide available in MIGRATION.md
Example Migration:
💡 Benefits
🧪 Testing
📊 Statistics
Before: 6 files, ~12K lines, significant duplication
After: 3 adapters + 2 unchanged modules, zero duplication
Ready for review! See MIGRATION.md for complete details.
💻 View my work • 👤 Initiated by @Zeeeepa • About Codegen
⛔ Remove Codegen from PR • 🚫 Ban action checks
Description by Korbit AI
What change is being made?
Consolidate the codebase from 6 files into 3 focused adapters (graph_sitter_adapter.py, libs_adapter.py, main_analysis.py) and route existing functionality through these adapters to improve separation of concerns, reduce duplication, and streamline imports, while preserving existing modules and overall behavior.
Why are these changes being made?
Simplify maintenance and imports by centralizing Graph-Sitter, tooling, and orchestration logic into dedicated adapters, choosing the most complete implementations from existing duplicates and removing redundant files. If any trade-offs exist, they relate to initial migration overhead and ensuring cross-module compatibility during the transition.