Files
skill-seekers-reference/tests
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
..