yusyus
|
3408315f40
|
feat: Add 6 new languages to codebase analysis system (C#, Go, Rust, Java, Ruby, PHP)
Expands language support from 3 to 9 languages across entire codebase scraping system.
**New Languages Added:**
- C# (Unity/.NET support) - classes, methods, properties, async/await, XML docs
- Go - structs, functions, methods with receivers, multiple return values
- Rust - structs, functions, async functions, impl blocks
- Java - classes, methods, inheritance, interfaces, generics
- Ruby - classes, methods, inheritance, predicate methods
- PHP - classes, methods, namespaces, inheritance
**Code Analysis (code_analyzer.py):**
- Added 6 new language analyzers (~1000 lines)
- Regex-based parsers inspired by official language specs
- Extract classes, functions, signatures, async detection
- Comprehensive comment extraction for all languages
**Dependency Analysis (dependency_analyzer.py):**
- Added 6 new import extractors (~300 lines)
- C#: using statements, static using, aliases
- Go: import blocks, aliases
- Rust: use statements, curly braces, crate/super
- Java: import statements, static imports, wildcards
- Ruby: require, require_relative, load
- PHP: require/include, namespace use
**File Extensions (codebase_scraper.py):**
- Added mappings: .cs, .go, .rs, .java, .rb, .php
**Test Coverage:**
- Added 24 new tests for 6 languages (4 tests each)
- Added 19 dependency analyzer tests
- Added 6 language detection tests
- Total: 118 tests, 100% passing ✅
**Credits:**
- Regex patterns based on official language specifications:
- Microsoft C# Language Specification
- Go Language Specification
- Rust Language Reference
- Oracle Java Language Specification
- Ruby Documentation
- PHP Language Reference
- NetworkX for graph algorithms
**Issues Resolved:**
- Closes #166 (C# support request)
- Closes #140 (E1.7 MCP tool scrape_codebase)
**Test Results:**
- test_code_analyzer.py: 54 tests passing
- test_dependency_analyzer.py: 43 tests passing
- test_codebase_scraper.py: 21 tests passing
- Total execution: ~0.41s
🚀 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-01-02 21:28:21 +03:00 |
|
yusyus
|
33d8500c44
|
feat(C2.5): Add inline comment extraction for Python/JS/C++
- Added comment extraction methods to code_analyzer.py
- Supports Python (# style), JavaScript (// and /* */), C++ (// and /* */)
- Extracts comment text, line numbers, and type (inline vs block)
- Skips Python shebang and encoding declarations
- Preserves TODO/FIXME/NOTE markers for developer notes
Implementation:
- _extract_python_comments(): Extract # comments with line tracking
- _extract_js_comments(): Extract // and /* */ comments
- _extract_cpp_comments(): Reuses JS logic (same syntax)
- Integrated into _analyze_python(), _analyze_javascript(), _analyze_cpp()
Output Format:
{
'classes': [...],
'functions': [...],
'comments': [
{'line': 5, 'text': 'TODO: Optimize', 'type': 'inline'},
{'line': 12, 'text': 'Block comment\nwith lines', 'type': 'block'}
]
}
Tests:
- Added 8 comprehensive tests to test_code_analyzer.py
- Total: 30 tests passing ✅
- Python: Comment extraction, line numbers, shebang skip
- JavaScript: Inline comments, block comments, mixed
- C++: Comment extraction (uses JS logic)
- TODO/FIXME detection test
Related Issues:
- Closes #67 (C2.5 Extract inline comments as notes)
- Part of C2 Local Codebase Scraping roadmap (TIER 3)
Files Modified:
- src/skill_seekers/cli/code_analyzer.py (+67 lines)
- tests/test_code_analyzer.py (+194 lines)
|
2026-01-01 23:02:34 +03:00 |
|
yusyus
|
f162727792
|
test: Add comprehensive tests for code_analyzer.py (22 tests, 90% coverage)
- Created tests/test_code_analyzer.py with 22 comprehensive tests
- Python parsing: 8 tests (signatures, type hints, defaults, async, classes, docstrings, decorators, error handling)
- JavaScript/TypeScript: 5 tests (functions, arrow functions, classes, type annotations, async)
- C++ parsing: 4 tests (function signatures, classes, pointers, defaults)
- Depth levels: 3 tests (surface, deep, unknown language)
- Integration: 2 tests (public interface, multiple items)
Test Coverage:
- All 22 tests passing ✅
- 90% code coverage (exceeds 80% target)
- Validates Python AST parsing (production-ready)
- Documents regex parser limitations for JS/C++ (return types not extracted)
Related Issues:
- Addresses testing requirements for #64 (C2.2 Docstring extraction)
- Addresses testing requirements for #65 (C2.3 Function signatures)
Part of TIER 2 implementation plan for C2 Local Codebase Scraping tasks.
|
2026-01-01 22:58:08 +03:00 |
|