2.4 KiB
2.4 KiB
PR: Major improvements to WTIsMyCode
Summary
Comprehensive refactoring and feature additions to WTIsMyCode — the Python architecture documentation generator. This PR improves code quality, adds new features, and significantly enhances the development experience.
Stats: 24 files changed, ~3900 insertions, ~1400 deletions, 50 tests
Changes
🏗️ Architecture
- Decomposed monolithic
main.rsintocommands/module structure (generate, init, check, stats) - Added workspace
Cargo.tomlfor unified builds across both crates - New
cycle_detectormodule with DFS-based dependency cycle detection
🐍 Python Analyzer
- Full AST traversal — properly walks all statement types (if/for/while/try/with/match)
- Function signatures — extracts parameter names, types, defaults, return types
- Method detection — distinguishes methods from standalone functions via
self/clsparameter - Docstring extraction — parses first line of docstrings for symbol documentation
- Module path computation — correctly computes module IDs from
src_rootsconfig
✨ New Features
statscommand — project statistics with colored output and progress bar- Config validation — validates project root, language, scan paths, cache age, file size formats
- Cycle detection — finds circular dependencies in module graph, shown in critical points section
--dry-runflag — preview what would be generated without writing files- Dynamic project data — uses config project name and current date instead of hardcoded values
- Real usage examples — generates Python import/call examples from analyzed symbols
- Skip-unchanged optimization — writer skips files that haven't changed
🧹 Code Quality
- Zero
unwrap()calls in non-test code — proper error handling throughout - Zero clippy warnings — all lints resolved
- 50 tests — unit tests for config validation, cycle detection, caching, integration detection, error handling, and full pipeline integration tests
📚 Documentation
- README.md — badges, full command reference, configuration table, architecture overview
- CHANGELOG.md — complete changelog for this branch
Testing
cargo test # 50 tests, all passing
cargo clippy # 0 warnings
cargo build # clean build
Breaking Changes
None. All existing functionality preserved.