|
| 1 | +# TODO Creeper |
| 2 | + |
| 3 | +A GitHub Action that helps you identify and track TODO comments as they creep into your codebase. This action scans your repository for TODO, FIXME, and HACK comments and can fail your workflow if the count exceeds a specified threshold. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- 🔍 **Comprehensive Scanning**: Detects TODO, FIXME, and HACK comments across multiple programming languages |
| 8 | +- 📊 **Detailed Reporting**: Provides count, file distribution, and detailed location information |
| 9 | +- ⚙️ **Configurable Thresholds**: Set maximum allowed TODO count before action fails |
| 10 | +- 🚫 **Exclusion Patterns**: Skip specific directories and files (e.g., node_modules, build artifacts) |
| 11 | +- 📈 **Action Outputs**: Expose TODO statistics for use in other workflow steps |
| 12 | + |
| 13 | +## Supported Comment Patterns |
| 14 | + |
| 15 | +The action detects the following comment patterns: |
| 16 | + |
| 17 | +- `// TODO` - JavaScript, TypeScript, Java, C#, etc. |
| 18 | +- `/* TODO */` - Multi-line comments |
| 19 | +- `# TODO` - Python, Shell scripts, YAML, etc. |
| 20 | +- `<!-- TODO -->` - HTML, XML, Markdown |
| 21 | +- `// FIXME` - Similar patterns for FIXME comments |
| 22 | +- `// HACK` - Similar patterns for HACK comments |
| 23 | + |
| 24 | +## Usage |
| 25 | + |
| 26 | +### Basic Usage |
| 27 | + |
| 28 | +```yaml |
| 29 | +name: Check TODOs |
| 30 | +on: [push, pull_request] |
| 31 | + |
| 32 | +jobs: |
| 33 | + todo-check: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + |
| 38 | + - name: Scan for TODOs |
| 39 | + uses: Gustrb/todo-creeper@v1 |
| 40 | + with: |
| 41 | + threshold: 10 |
| 42 | +``` |
| 43 | +
|
| 44 | +### Advanced Usage |
| 45 | +
|
| 46 | +```yaml |
| 47 | +name: Comprehensive TODO Check |
| 48 | +on: [push, pull_request] |
| 49 | + |
| 50 | +jobs: |
| 51 | + todo-analysis: |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v4 |
| 55 | + |
| 56 | + - name: Scan for TODOs |
| 57 | + id: todo-scan |
| 58 | + uses: Gustrb/todo-creeper@v1 |
| 59 | + with: |
| 60 | + threshold: 5 |
| 61 | + exclude-patterns: 'node_modules,dist,build,.git,tests/mocks' |
| 62 | + |
| 63 | + - name: Report TODO Count |
| 64 | + run: | |
| 65 | + echo "Found ${{ steps.todo-scan.outputs.todo-count }} TODOs" |
| 66 | + echo "Across ${{ steps.todo-scan.outputs.todo-files }} files" |
| 67 | + |
| 68 | + - name: Create TODO Report |
| 69 | + if: steps.todo-scan.outputs.todo-count != '0' |
| 70 | + run: | |
| 71 | + echo "## TODO Report" >> $GITHUB_STEP_SUMMARY |
| 72 | + echo "Found ${{ steps.todo-scan.outputs.todo-count }} TODOs" >> $GITHUB_STEP_SUMMARY |
| 73 | + echo "Files affected: ${{ steps.todo-scan.outputs.todo-files }}" >> $GITHUB_STEP_SUMMARY |
| 74 | +``` |
| 75 | +
|
| 76 | +## Inputs |
| 77 | +
|
| 78 | +| Input | Description | Required | Default | |
| 79 | +|-------|-------------|----------|---------| |
| 80 | +| `token` | GitHub token for API access | Yes | `${{ github.token }}` | |
| 81 | +| `threshold` | Maximum number of TODOs allowed before action fails | No | `10` | |
| 82 | +| `exclude-patterns` | Comma-separated patterns to exclude from TODO search | No | `node_modules,dist,build,.git` | |
| 83 | + |
| 84 | +## Outputs |
| 85 | + |
| 86 | +| Output | Description | |
| 87 | +|--------|-------------| |
| 88 | +| `todo-count` | Total number of TODOs found | |
| 89 | +| `todo-files` | Number of files containing TODOs | |
| 90 | +| `todo-details` | JSON string with detailed TODO information | |
| 91 | + |
| 92 | +## Example Output |
| 93 | + |
| 94 | +``` |
| 95 | +🔍 Starting TODO scan... |
| 96 | +📊 Found 3 TODOs across 2 files |
| 97 | + |
| 98 | +📝 TODO Details: |
| 99 | +1. src/utils.js:15 - // TODO: Implement error handling |
| 100 | +2. src/components/Button.jsx:42 - // TODO: Add loading state |
| 101 | +3. docs/README.md:8 - <!-- TODO: Add API documentation --> |
| 102 | + |
| 103 | +✅ TODO count (3) is within threshold (10) |
| 104 | +``` |
| 105 | +
|
| 106 | +## Supported File Types |
| 107 | +
|
| 108 | +The action scans files with the following extensions: |
| 109 | +- JavaScript/TypeScript: `.js`, `.jsx`, `.ts`, `.tsx` |
| 110 | +- Python: `.py` |
| 111 | +- Java: `.java` |
| 112 | +- C/C++: `.cpp`, `.c` |
| 113 | +- C#: `.cs` |
| 114 | +- PHP: `.php` |
| 115 | +- Ruby: `.rb` |
| 116 | +- Go: `.go` |
| 117 | +- Rust: `.rs` |
| 118 | +- Swift: `.swift` |
| 119 | +- Kotlin: `.kt` |
| 120 | +- Scala: `.scala` |
| 121 | +- Clojure: `.clj` |
| 122 | +- Haskell: `.hs` |
| 123 | +- OCaml: `.ml` |
| 124 | +- F#: `.fs` |
| 125 | +- Visual Basic: `.vb` |
| 126 | +- SQL: `.sql` |
| 127 | +- Shell scripts: `.sh`, `.bash`, `.zsh`, `.fish` |
| 128 | +- PowerShell: `.ps1` |
| 129 | +- Batch files: `.bat`, `.cmd` |
| 130 | +- Configuration: `.yml`, `.yaml`, `.json`, `.xml` |
| 131 | +- Web: `.html`, `.css`, `.scss`, `.sass`, `.less` |
| 132 | +- Frameworks: `.vue`, `.svelte` |
| 133 | +- Documentation: `.md`, `.txt` |
| 134 | +
|
| 135 | +## Contributing |
| 136 | +
|
| 137 | +Contributions are welcome! Please feel free to submit a Pull Request. |
| 138 | +
|
| 139 | +## License |
| 140 | +
|
| 141 | +This project is licensed under the ISC License. |
0 commit comments