--- description: Calculate documentation coverage percentage for functions and classes --- # Documentation Coverage Analyze codebase to calculate documentation coverage metrics. ## Visual Output When executing this command, display the plugin header: ``` ┌──────────────────────────────────────────────────────────────────┐ │ 📝 DOC-GUARDIAN · Documentation Coverage │ └──────────────────────────────────────────────────────────────────┘ ``` Then proceed with the analysis. ## Process 1. **Scan Source Files** Identify all documentable items: **Python:** - Functions (def) - Classes - Methods - Module-level docstrings **JavaScript/TypeScript:** - Functions (function, arrow functions) - Classes - Methods - JSDoc comments **Other Languages:** - Adapt patterns for Go, Rust, etc. 2. **Determine Documentation Status** For each item, check: - Has docstring/JSDoc comment - Docstring is non-empty and meaningful (not just `pass` or `TODO`) - Parameters are documented (for detailed mode) - Return type is documented (for detailed mode) 3. **Calculate Metrics** ``` Coverage = (Documented Items / Total Items) * 100 ``` **Levels:** - Basic: Item has any docstring - Standard: Docstring describes purpose - Complete: All parameters and return documented 4. **Output Format** ``` ## Documentation Coverage Report ### Summary - Total documentable items: 156 - Documented: 142 - Coverage: 91.0% ### By Type | Type | Total | Documented | Coverage | |------|-------|------------|----------| | Functions | 89 | 85 | 95.5% | | Classes | 23 | 21 | 91.3% | | Methods | 44 | 36 | 81.8% | ### By Directory | Path | Total | Documented | Coverage | |------|-------|------------|----------| | src/api/ | 34 | 32 | 94.1% | | src/utils/ | 28 | 28 | 100.0% | | src/models/ | 45 | 38 | 84.4% | | tests/ | 49 | 44 | 89.8% | ### Undocumented Items - [ ] src/api/handlers.py:45 `create_order()` - [ ] src/api/handlers.py:78 `update_order()` - [ ] src/models/user.py:23 `UserModel.validate()` ``` ## Options | Flag | Description | Default | |------|-------------|---------| | `--path