Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,47 @@ A powerful static code analysis system that provides extensive information about
This analyzer provides comprehensive analysis of your codebase, including:

### 1. Codebase Structure Analysis

- File Statistics (count, language, size)
- Symbol Tree Analysis
- Import/Export Analysis
- Module Organization

### 2. Symbol-Level Analysis

- Function Analysis (parameters, return types, complexity)
- Class Analysis (methods, attributes, inheritance)
- Variable Analysis
- Type Analysis

### 3. Dependency and Flow Analysis

- Call Graph Generation
- Data Flow Analysis
- Control Flow Analysis
- Symbol Usage Analysis

### 4. Code Quality Analysis

- Unused Code Detection
- Code Duplication Analysis
- Complexity Metrics
- Style and Convention Analysis

### 5. Visualization Capabilities

- Dependency Graphs
- Call Graphs
- Symbol Trees
- Heat Maps

### 6. Language-Specific Analysis

- Python-Specific Analysis
- TypeScript-Specific Analysis

### 7. Code Metrics

- Monthly Commits
- Cyclomatic Complexity
- Halstead Volume
Expand All @@ -49,12 +56,14 @@ This analyzer provides comprehensive analysis of your codebase, including:
## Installation

1. Clone the repository:

```bash
git clone https://github.com/yourusername/codebase-analyzer.git
cd codebase-analyzer
```

2. Install dependencies:

```bash
pip install -r requirements.txt
```
Expand Down Expand Up @@ -111,4 +120,3 @@ python codebase_analyzer.py --repo-url https://github.com/username/repo --output
## License

MIT

11 changes: 5 additions & 6 deletions codegen-examples/examples/snapshot_event_handler/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Event Handler with codebase snapshotting

This project is designed to using Modal snapshotting to provide parsed codebase instances with minimal latency, make it more manageable to write event based handlers.
This project is designed to using Modal snapshotting to provide parsed codebase instances with minimal latency, make it more manageable to write event based handlers.

Follow the instructions below to set up and deploy the application.

Expand All @@ -9,7 +9,7 @@ Follow the instructions below to set up and deploy the application.
Before you begin, ensure you have the following installed and configured:

1. **uv**: A tool for managing virtual environments and syncing dependencies.
2. **Modal**: Ensure you have Modal configured on your system.
1. **Modal**: Ensure you have Modal configured on your system.

## Setup Instructions

Expand All @@ -23,15 +23,15 @@ Before you begin, ensure you have the following installed and configured:
source ./venv/bin/activate
```

2. **Sync Dependencies**
1. **Sync Dependencies**

Sync the project dependencies using `uv`:

```bash
uv sync
```

3. **Deploy to Modal**
1. **Deploy to Modal**

Deploy the application to Modal by running:

Expand All @@ -48,7 +48,6 @@ Before you begin, ensure you have the following installed and configured:
- `.env.template` and `.env`: Environment variable templates and configurations.
- `pyproject.toml`: Project configuration and dependencies.


## Integration

Once deployed, you can use the deployed web_url as the webhook endpoint for your slack, linear, or github webhooks.
Once deployed, you can use the deployed web_url as the webhook endpoint for your slack, linear, or github webhooks.
16 changes: 14 additions & 2 deletions codegen-examples/examples/swebench_agent_run/local_run.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@
"metadata": {},
"outputs": [],
"source": [
"await run_eval(use_existing_preds=None, dataset=\"lite\", length=5, repo=\"django/django\", num_workers=10, model=\"claude-3-7-sonnet-latest\")"
"await run_eval(\n",
" use_existing_preds=None,\n",
" dataset=\"lite\",\n",
" length=5,\n",
" repo=\"django/django\",\n",
" num_workers=10,\n",
" model=\"claude-3-7-sonnet-latest\",\n",
")"
]
},
{
Expand Down Expand Up @@ -76,7 +83,12 @@
"source": [
"from codegen.agents.code_agent import CodeAgent\n",
"\n",
"agent = CodeAgent(codebase=codebase, tags=[\"local_test\"], model_name=\"claude-3-5-sonnet-latest\", model_provider=\"anthropic\")"
"agent = CodeAgent(\n",
" codebase=codebase,\n",
" tags=[\"local_test\"],\n",
" model_name=\"claude-3-5-sonnet-latest\",\n",
" model_provider=\"anthropic\",\n",
")"
]
},
{
Expand Down
43 changes: 17 additions & 26 deletions codegen-on-oss/codegen_on_oss/analyzers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ analyzers/
### 1. API Interface (`api.py`)

The main entry point for frontend applications. Provides REST-like endpoints for:

- Codebase analysis
- PR analysis
- Dependency visualization
Expand All @@ -34,6 +35,7 @@ The main entry point for frontend applications. Provides REST-like endpoints for
### 2. Analyzer System (`analyzer.py`)

Plugin-based system that coordinates different types of analysis:

- Code quality analysis (complexity, maintainability)
- Dependency analysis (imports, cycles, coupling)
- PR impact analysis
Expand All @@ -42,6 +44,7 @@ Plugin-based system that coordinates different types of analysis:
### 3. Issue Tracking (`issues.py`)

Comprehensive issue model with:

- Severity levels (critical, error, warning, info)
- Categories (dead code, complexity, dependency, etc.)
- Location information and suggestions
Expand All @@ -50,6 +53,7 @@ Comprehensive issue model with:
### 4. Dependency Analysis (`dependencies.py`)

Analysis of codebase dependencies:

- Import dependencies between modules
- Circular dependency detection
- Module coupling analysis
Expand All @@ -59,6 +63,7 @@ Analysis of codebase dependencies:
### 5. Code Quality Analysis (`code_quality.py`)

Analysis of code quality aspects:

- Dead code detection (unused functions, variables)
- Complexity metrics (cyclomatic, cognitive)
- Parameter checking (types, usage)
Expand Down Expand Up @@ -121,11 +126,7 @@ dependency_issues = api.get_issues(category="dependency_cycle")
module_deps = api.get_module_dependencies(format="json")

# Get function call graph
call_graph = api.get_function_call_graph(
function_name="main",
depth=3,
format="json"
)
call_graph = api.get_function_call_graph(function_name="main", depth=3, format="json")

# Export visualization to file
api.export_visualization(call_graph, format="html", filename="call_graph.html")
Expand Down Expand Up @@ -197,52 +198,42 @@ For a web application exposing these endpoints with Flask:

```python
from flask import Flask, request, jsonify
from codegen_on_oss.analyzers.api import (
api_analyze_codebase,
api_analyze_pr,
api_get_visualization,
api_get_static_errors
)
from codegen_on_oss.analyzers.api import api_analyze_codebase, api_analyze_pr, api_get_visualization, api_get_static_errors

app = Flask(__name__)


@app.route("/api/analyze/codebase", methods=["POST"])
def analyze_codebase():
data = request.json
result = api_analyze_codebase(
repo_path=data.get("repo_path"),
analysis_types=data.get("analysis_types")
)
result = api_analyze_codebase(repo_path=data.get("repo_path"), analysis_types=data.get("analysis_types"))
return jsonify(result)


@app.route("/api/analyze/pr", methods=["POST"])
def analyze_pr():
data = request.json
result = api_analyze_pr(
repo_path=data.get("repo_path"),
pr_number=data.get("pr_number")
)
result = api_analyze_pr(repo_path=data.get("repo_path"), pr_number=data.get("pr_number"))
return jsonify(result)


@app.route("/api/visualize", methods=["POST"])
def visualize():
data = request.json
result = api_get_visualization(
repo_path=data.get("repo_path"),
viz_type=data.get("viz_type"),
params=data.get("params", {})
)
result = api_get_visualization(repo_path=data.get("repo_path"), viz_type=data.get("viz_type"), params=data.get("params", {}))
return jsonify(result)


@app.route("/api/issues", methods=["GET"])
def get_issues():
repo_path = request.args.get("repo_path")
severity = request.args.get("severity")
category = request.args.get("category")

api = create_api(repo_path=repo_path)
return jsonify(api.get_issues(severity=severity, category=category))


if __name__ == "__main__":
app.run(debug=True)
```
```
Loading
Loading