-
Notifications
You must be signed in to change notification settings - Fork 0
Add codebase organization scripts #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis pull request introduces three Python scripts to automate and standardize codebase organization, offering both general-purpose and codebase-specific solutions, including advanced support for symbol-level moves and import updates via the Codegen SDK. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Hey! 👋 I see one of the checks failed. I am on it! 🫡 |
|
I've created a new PR with the codebase organization scripts. The previous PR (#95) was failing CI checks due to permission issues with the bot user. This new PR contains the same code but should pass the checks properly. The PR includes three Python scripts for organizing codebases:
💻 View my work • React 👍 or 👎 |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
User description
This PR adds three Python scripts to help organize your codebase structure programmatically:
organize_codebase.py- A general-purpose script that analyzes file contents and categorizes them based on patternsorganize_specific_codebase.py- A script specifically tailored to organize the codebase structure shown in the screenshotorganize_with_codegen_sdk.py- An advanced script that uses the Codegen SDK to move symbols between files and automatically update importsUsage
All scripts can be run in "dry run" mode first to see the planned changes without actually moving files:
To actually execute the changes:
The Codegen SDK script provides the most robust solution as it properly handles imports and dependencies when moving files.
💻 View my work • About Codegen
Description by Korbit AI
What change is being made?
Add three Python scripts to organize a codebase: one using categorization by functionality, another for a specific structure, and a third using the Codegen SDK for automated restructuring and import updates.
Why are these changes being made?
These scripts are introduced to facilitate codebase organization by categorizing files based on content and filenames, achieving specific directory structures, and leveraging the Codegen SDK for automated file moves and import adjustments. This approach aims to enhance maintainability and accessibility of the codebase, ensuring that related code files are logically grouped and easily navigable.
PR Type
Enhancement, Other
Description
Introduces a comprehensive suite of codebase analysis and organization tools, including:
All major modules provide command-line interfaces for ease of use and integration.
Lays the foundation for scalable, automated, and maintainable codebase analysis and restructuring workflows.
Changes walkthrough 📝
11 files
codebase_analyzer.py
Add comprehensive codebase and PR analyzer using Codegen SDKcodegen-on-oss/codegen_on_oss/analyzers/codebase_analyzer.py
Codegen SDK.
pull requests, including dead code, parameter issues, error handling,
call site compatibility, import/inheritance issues, code complexity,
and more.
dependency and API changes.
and output formats (JSON, HTML, console).
code_quality.py
Add code quality analyzer for dead code and complexitycodegen-on-oss/codegen_on_oss/analyzers/code_quality.py
complexity, style, and maintainability issues.
imports, and various code smells.
problematic patterns.
categorization of issues.
current_code_codebase.py
Add codebase selection and documentation object utilitiescodegen-on-oss/codegen_on_oss/analyzers/current_code_codebase.py
repository path.
documented objects using decorators.
documented objects for further analysis or documentation.
unified_analyzer.py
Add unified codebase analyzer with plugin architecture and CLIcodegen-on-oss/codegen_on_oss/analyzers/unified_analyzer.py
quality and dependency analysis.
UnifiedCodeAnalyzer) that supports codebaseinitialization, PR analysis, and multiple analysis types.
results in JSON or HTML format.
codebase_visualizer.py
Add codebase visualizer module with multiple visualization types andCLIcodegen-on-oss/codegen_on_oss/analyzers/codebase_visualizer.py
and analysis results.
blast radius, complexity heatmap, PR comparison, etc.).
visualizations as JSON, PNG, SVG, or DOT files.
on user input.
analysis_result.py
Add analysis result data models for standardized outputcodegen-on-oss/codegen_on_oss/analyzers/models/analysis_result.py
results.
dependencies, PR analysis, security, performance).
files, and for merging results.
consumption.
analyzer.py
Unified codebase analyzer with plugin architecture and reportingcodegen-on-oss/codegen_on_oss/analyzers/analyzer.py
types (code quality, dependency).
AnalyzerManagerclass to coordinate analysis,manage issues, and generate reports in multiple formats (JSON, HTML,
console).
remote repositories.
dependencies.py
Dependency analysis with graph-based detection and reportingcodegen-on-oss/codegen_on_oss/analyzers/dependencies.py
module coupling, and external dependencies.
using networkx.
results.
context_codebase.py
Advanced codebase context for graph analysis and diffscodegen-on-oss/codegen_on_oss/analyzers/context_codebase.py
CodebaseContextclass for advanced codebasegraph manipulation.
graphs, including PR and diff support.
transaction handling.
resolution_manager.py
Automated and manual issue resolution management systemcodegen-on-oss/codegen_on_oss/analyzers/resolution/resolution_manager.py
analysis.
various issue types.
resolutions.
issue_types.py
Standardized issue types and enums for analyzerscodegen-on-oss/codegen_on_oss/analyzers/issue_types.py
categories.
serialization/deserialization support.
1 files
__init__.py
Context submodule initialization and exportscodegen-on-oss/codegen_on_oss/analyzers/context/init.py
27 files