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
..
2025-10-29 23:19:32 +03:00
2025-12-28 22:29:44 +03:00
2025-10-19 02:08:58 +03:00
2025-11-29 22:13:13 +03:00
2025-10-19 17:01:37 +03:00
2026-01-01 23:00:36 +03:00
2025-11-07 01:21:29 +03:00
2025-12-30 23:27:18 +03:00
2026-01-01 23:02:34 +03:00
2025-11-20 13:55:46 -08:00
2025-11-29 22:13:13 +03:00
2025-11-10 21:35:44 +03:00
2025-11-30 00:13:49 +03:00
2025-12-21 19:28:22 +03:00
2025-12-21 19:45:06 +03:00
2026-01-01 20:57:03 +03:00
2026-01-01 21:15:09 +03:00
2025-12-28 21:35:21 +03:00
2025-12-26 00:45:48 +03:00
2025-12-26 00:45:48 +03:00
2025-11-07 01:14:24 +03:00
2026-01-01 21:18:24 +03:00
2025-12-21 22:53:05 +03:00
2025-11-29 22:13:13 +03:00
2025-11-07 01:14:24 +03:00
2025-11-07 01:14:24 +03:00
2025-12-26 00:45:48 +03:00
2025-12-21 19:45:06 +03:00
2025-12-26 00:45:48 +03:00
2025-11-29 21:34:51 +03:00
2026-01-01 18:57:21 +03:00
2025-11-07 01:21:29 +03:00
2025-10-23 21:43:05 +03:00
2025-12-21 22:53:05 +03:00
2025-11-29 21:55:46 +03:00
2025-10-26 13:05:39 +03:00
2026-01-01 19:54:48 +03:00
2025-11-07 01:14:24 +03:00
2025-12-26 00:45:48 +03:00
2025-12-26 00:45:48 +03:00
2025-11-29 22:56:37 +03:00
2025-12-28 18:06:50 +03:00
2025-12-21 19:28:22 +03:00
2026-01-01 19:25:53 +03:00
2025-11-29 21:34:51 +03:00
2025-11-11 22:26:52 +03:00
2025-11-07 01:21:29 +03:00
2025-11-10 21:35:44 +03:00
2025-12-21 22:57:27 +03:00