Skip to main content

Multi-language TODO comment extractor written in Rust.

Project description

Rusty TODO MD — A Pre-Commit Hook for Managing TODOs

Rusty TODO MD is a pre-commit hook designed to help you manage and centralize all your code's TODO comments by automatically extracting them and synchronizing them into a single TODO.md file. With support for multiple languages—currently Python, Rust, JavaScript, and Go—Rusty TODO MD now organizes TODOs using a new sectioned format for enhanced readability and easier maintenance.


✨ Key Features

  1. Automatic TODO Collection
    By default, Rusty TODO MD scans your staged files (or all tracked files using the --all-files flag) for markers like TODO and FIXME, and updates your TODO.md with any new entries.

  2. Sectioned TODO.md Format
    The TODO.md file is now organized into sections, grouped first by marker (e.g., # TODO, # FIXME), then by file. Each marker section begins with a header (# <MARKER>), each file with a sub-header (## <file-path>), followed by a list of extracted TODO items.

  3. Multi-line TODO Support
    Handles multi-line and indented TODO comments, merging them into a single entry.

  4. Sync Mechanism

    • Automatically merges new TODO entries with existing ones, using an internal representation.
    • Removes entries when their corresponding TODOs are no longer present in the source code.
  5. Language-Aware Parsing
    Supports precise parsing for Python, Rust, JavaScript, and Go out-of-the-box, with plans for additional languages such as TypeScript, PHP, and Java.

  6. Seamless Pre-Commit Integration
    Easily integrate Rusty TODO MD into your workflow by adding it to your .pre-commit-config.yaml.


🚀 Objective

Scattered TODO comments can be hard to track and maintain. Rusty TODO MD centralizes these comments in a structured, sectioned TODO.md file—making it simpler to review outstanding tasks and keep your documentation in sync with your codebase.


⚙️ Installation & Setup

Option 1: PyPI Installation (Recommended)

Install directly from PyPI using pip:

pip install rusty_todo_md

Then you can use it directly:

rusty-todo-md --help

Option 2: Pre-Commit Hook Integration

With PyPI (Recommended - No Rust toolchain required)

Add the following to your .pre-commit-config.yaml:

repos:
  - repo: https://github.com/simone-viozzi/rusty-todo-md
    rev: v1.1.0  # Use the latest version
    hooks:
      - id: rusty-todo-md
        language: python
        additional_dependencies: ["rusty_todo_md==1.1.0"]

With Git Repository

Add the following snippet to your .pre-commit-config.yaml file at the root of your repository:

repos:
  - repo: https://github.com/simone-viozzi/rusty-todo-md
    rev: v1.1.0  # Use the latest version
    hooks:
      - id: rusty-todo-md

1. Install Pre-Commit

If you haven't already installed pre-commit:

pip install pre-commit

(Alternatively, use your preferred package manager.)

2. Configure Pre-Commit

Add the following snippet to your .pre-commit-config.yaml file at the root of your repository:

repos:
  - repo: https://github.com/simone-viozzi/rusty-todo-md
    rev: v0.1.8-alpha.11
    hooks:
      - id: rusty-todo-md

Replace rev with the desired tag or commit hash.

3. Install the Pre-Commit Hook

Run the following command from your repository root:

pre-commit install

Rusty TODO MD will now run on your staged files each time you commit.


🧩 CLI Usage (Optional)

You can also run Rusty TODO MD manually:

rusty-todo-md --all-files
  • --all-files: Scans all tracked files instead of just the staged ones.
  • --marker/-m: Specify one or more keywords to search for (e.g., TODO, FIXME, HACK). Can be used multiple times.

Example:

rusty-todo-md --markers TODO FIXME HACK

Or specify a custom location for your TODO file:

rusty-todo-md --todo-path docs/TODOS.md

📝 How It Works

  1. File Discovery

    • By default, scans the staged files in your Git index.
    • With the --all-files flag, scans all tracked files in the repository.
  2. Comment Extraction

    • Parses file comments (ignoring code or string literals) to extract markers like TODO and FIXME.
    • Supports multi-line and indented comment structures.
  3. Sectioned TODO.md Format

    • Organizes extracted TODOs into sections grouped by marker and file.
    • Each marker section starts with a header (# <MARKER>), each file with a sub-header (## <file-path>), followed by formatted entries:
      * [<file-path>:<line_number>](<file-path>#L<line_number>): TODO message
      
  4. Sync Mechanism

    • Reads the existing TODO.md using the new parser.
    • Merges new TODO entries with the existing ones using an internal representation.
    • Writes the updated, sectioned list back to TODO.md.

🔧 Configuration

  • Markers: The tool searches for TODO by default. You can customize markers (e.g., FIXME, HACK) using the --marker/-m CLI argument. Multiple markers are supported and can be specified multiple times.
  • Language Support: Rusty TODO MD provides built-in parsing for Python (.py), Rust (.rs), JavaScript (.js, .jsx), and Go (.go), with planned support for additional languages.

📊 Test Coverage

Rusty TODO MD maintains comprehensive test coverage to ensure reliability and code quality.

CI/CD Coverage

  • Automated Coverage: Every pull request automatically generates coverage reports
  • Coverage Reports: Available as downloadable artifacts from GitHub Actions
  • Format: Reports are generated in LCOV format for broad tool compatibility

VS Code Integration

For the best local development experience:

  1. Install the Coverage Gutters extension
  2. Run cargo tarpaulin --out Lcov --output-dir ./coverage
  3. Open your project in VS Code to see coverage highlights directly in your source files

📚 Example

Python Example

# TODO: Implement data validation
def process_data(data):
    """
    FIXME: Optimize this logic
        Possibly reduce nested loops
    """
    pass

This produces a section in TODO.md like:

# TODO
## path/to/your_file.py
* [path/to/your_file.py:2](path/to/your_file.py#L2): Implement data validation

# FIXME
## path/to/your_file.py
* [path/to/your_file.py:4](path/to/your_file.py#L4): Optimize this logic Possibly reduce nested loops

Rust Example

// TODO: Refactor main function
fn main() {
    /*
       FIXME: Add error handling
           Possibly a custom result type
    */
}

This produces a section in TODO.md like:

# TODO
## src/main.rs
* [src/main.rs:2](src/main.rs#L2): Refactor main function

# FIXME
## src/main.rs
* [src/main.rs:5](src/main.rs#L5): Add error handling Possibly a custom result type

JavaScript Example

// TODO: Refactor this into separate modules
function init() {
  /* FIXME: Handle edge cases 
     such as null responses */
  fetchData();
}

This produces a section in TODO.md like:

# TODO
## src/app.js
* [src/app.js:1](src/app.js#L1): Refactor this into separate modules

# FIXME
## src/app.js
* [src/app.js:4](src/app.js#L4): Handle edge cases such as null responses

Go Example

// TODO: Add proper logging
func main() {
    /* FIXME: Implement proper error handling
       across the entire application */
    fmt.Println("Hello, World!")
}

This produces a section in TODO.md like:

# TODO
## main.go
* [main.go:1](main.go#L1): Add proper logging

# FIXME
## main.go
* [main.go:3](main.go#L3): Implement proper error handling across the entire application

🤝 Contributing

Contributions are welcome!

  • Open an Issue for bug reports or feature requests.
  • Submit a Pull Request with enhancements, additional language support, or configuration options.

⚖️ License

This project is licensed under the MIT License. You are free to use, modify, and distribute the software as long as the original license is included.


❤️ Support

If you find Rusty TODO MD helpful, please consider giving it a ⭐ on GitHub to help others discover the project.


Happy coding, and let Rusty TODO MD handle your TODOs so you can focus on building amazing features!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rusty_todo_md-1.7.1.tar.gz (60.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rusty_todo_md-1.7.1-py3-none-win_amd64.whl (1.6 MB view details)

Uploaded Python 3Windows x86-64

rusty_todo_md-1.7.1-py3-none-win32.whl (1.4 MB view details)

Uploaded Python 3Windows x86

rusty_todo_md-1.7.1-py3-none-musllinux_1_2_x86_64.whl (1.8 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

rusty_todo_md-1.7.1-py3-none-musllinux_1_2_i686.whl (1.7 MB view details)

Uploaded Python 3musllinux: musl 1.2+ i686

rusty_todo_md-1.7.1-py3-none-musllinux_1_2_armv7l.whl (1.6 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

rusty_todo_md-1.7.1-py3-none-musllinux_1_2_aarch64.whl (1.7 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

rusty_todo_md-1.7.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

rusty_todo_md-1.7.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64le

rusty_todo_md-1.7.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (1.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ i686

rusty_todo_md-1.7.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARMv7l

rusty_todo_md-1.7.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

rusty_todo_md-1.7.1-py3-none-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

rusty_todo_md-1.7.1-py3-none-macosx_10_12_x86_64.whl (1.5 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file rusty_todo_md-1.7.1.tar.gz.

File metadata

  • Download URL: rusty_todo_md-1.7.1.tar.gz
  • Upload date:
  • Size: 60.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.3

File hashes

Hashes for rusty_todo_md-1.7.1.tar.gz
Algorithm Hash digest
SHA256 0db51c58013d86dcf3220cec594b60d6ff5dd34bcdc7e9750d5cfe4fce5fff52
MD5 3ed1b647c88cce0d1ae523ee4b907ed0
BLAKE2b-256 f47e5377f02fc9b755da2477ec6e6578ea6e4f675e9018454aca9448d416fd87

See more details on using hashes here.

File details

Details for the file rusty_todo_md-1.7.1-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for rusty_todo_md-1.7.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 35fbd1d57e1641ee57d4349ba6ffd450ab4562628743d62cb89334b8a7f27b93
MD5 e41ab706388865c3a5fb75133ee21136
BLAKE2b-256 3a99ce18f234139408642d05edbde88e8202ba9ce83397f09ed7c627c09b6280

See more details on using hashes here.

File details

Details for the file rusty_todo_md-1.7.1-py3-none-win32.whl.

File metadata

File hashes

Hashes for rusty_todo_md-1.7.1-py3-none-win32.whl
Algorithm Hash digest
SHA256 bfe30e4f966a74f9b5bff25813ce46201ad4ab774edfef9c88addc44b9c87b29
MD5 7d56417dd52c0ca33e648d6c26e1153f
BLAKE2b-256 1f916bfd5b1996b0a1ca1dfa4b79e38ca5a61e8de6de567b54441045a2d604a0

See more details on using hashes here.

File details

Details for the file rusty_todo_md-1.7.1-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rusty_todo_md-1.7.1-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7f152b1de42a159ef7abb68b8a36b307096d05a755125a69a370dae5fdfb2b45
MD5 deabab1d180d8f86ddd2e55eda11a05e
BLAKE2b-256 e55ad6cb71c71c9b0b3f96f38cbafcf3cdb19b63a0ab21c951d8ad93b925b252

See more details on using hashes here.

File details

Details for the file rusty_todo_md-1.7.1-py3-none-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for rusty_todo_md-1.7.1-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 7d0f8a89077566e5aa798526c3d249dcf7c21c51c1068db4619fe854eaaa4d2c
MD5 ebf85664cc42a7dabdecba953ba5481f
BLAKE2b-256 208577a276def50895b071a7acd02e3191860fe6b670e6f2ff228ad21ae71fdf

See more details on using hashes here.

File details

Details for the file rusty_todo_md-1.7.1-py3-none-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for rusty_todo_md-1.7.1-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 e774ab209b131ff920fd4ddbf75ff5210c0b69603f17c78ead06b09bed33cb3e
MD5 c16d1ad204b2e4fef4bcaae5291bf61c
BLAKE2b-256 936027f2ce3e8d38aeaab6153780331c3a1162ce79bafd4768715da992e3dc8d

See more details on using hashes here.

File details

Details for the file rusty_todo_md-1.7.1-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for rusty_todo_md-1.7.1-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 d38452f2f1e76e3e266c5c6d840e77c4c7553b1c1db52ee1c04cfa68eb71792d
MD5 7187019731bae40e5f690f85724fb9d4
BLAKE2b-256 b93e3351e57c43d1d7c7973e1fc9915465140dcab667c0a47e31be1ac1e1a1cb

See more details on using hashes here.

File details

Details for the file rusty_todo_md-1.7.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rusty_todo_md-1.7.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dd98e789840c8bc7488a883ee37eef36f4876f98f0d5cba3695d932c6f9f9731
MD5 4f54e7aec23c48453dc3e2305e211738
BLAKE2b-256 5fa6b310f72cda4d01db150e37a893548b960af7bc1275cf88faf9ab9824fd0c

See more details on using hashes here.

File details

Details for the file rusty_todo_md-1.7.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for rusty_todo_md-1.7.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 00744597230ae8382e63dd08c56d7101a69caf6830fe295a43c0d29195099da4
MD5 73a340541a8bbb0e7e286b89555d07fe
BLAKE2b-256 78b75d86160500210d2cd6affa30c5b97ad4b44efef44ab05df4b4d9c6653527

See more details on using hashes here.

File details

Details for the file rusty_todo_md-1.7.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for rusty_todo_md-1.7.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 ecbae28ef202b7c464441526a13310f2ad0ca9c92b209938e55bb230d3c1d5ae
MD5 38edac8238a9e51ac0637cda62b17e7e
BLAKE2b-256 091935733c0807c31af9e04e1daf393b8276373108c8b1270cac4c7ff07fc469

See more details on using hashes here.

File details

Details for the file rusty_todo_md-1.7.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for rusty_todo_md-1.7.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 b9810c05c843e7f53a7240e3df840a8a01cff827abefeea244d7a1754c083e9e
MD5 a209715a99fe0ef656e9e3b619922c4c
BLAKE2b-256 2909d818473006db7732cd9771ac1738e2efdd217c1e0196dcb39868cdc317f8

See more details on using hashes here.

File details

Details for the file rusty_todo_md-1.7.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rusty_todo_md-1.7.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5b736978e4055fd6435e6cc8556e723ab260125fdb28faa51557013c3f31a1c5
MD5 e75930436b3dd2f55f80dd5d5b5d8998
BLAKE2b-256 3454ff41673a4203d2d2c53e3f4362bddb75951582d90f98cabb129c25985f46

See more details on using hashes here.

File details

Details for the file rusty_todo_md-1.7.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rusty_todo_md-1.7.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8c8590b72b692ffce2e1c4987eb0151cec8fa7e7fa3334c0b319d6db25afc945
MD5 7113c3c5ecc2f7d20c0b26d1aded7ba4
BLAKE2b-256 51e6316c03f73946a469f824a549e91408f7f8993fc33bc8dc881a09bbcfe4d0

See more details on using hashes here.

File details

Details for the file rusty_todo_md-1.7.1-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rusty_todo_md-1.7.1-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9ca9e257f6bbd198895d6346a0d402e61c04b5c22f570b5e909ee5e80be48d26
MD5 e6fdadd81a91d76a12ac340b7e466336
BLAKE2b-256 cff008003d889b14c4537b33ccb7dcd6a5decdd491522f1c7d9df779231b717d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page