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.3.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.3-py3-none-win_amd64.whl (1.6 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3Windows x86

rusty_todo_md-1.7.3-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.3-py3-none-musllinux_1_2_i686.whl (1.7 MB view details)

Uploaded Python 3musllinux: musl 1.2+ i686

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

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

rusty_todo_md-1.7.3-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.3-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.3-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.3-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.3-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.3-py3-none-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

rusty_todo_md-1.7.3-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.3.tar.gz.

File metadata

  • Download URL: rusty_todo_md-1.7.3.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.3.tar.gz
Algorithm Hash digest
SHA256 c385972b376bf3c432104a32bb9c44a7fc0c4305f3d58ae200008f8ce57bd096
MD5 eedcd76a1d9b862f0e0afb1e31c5f3d4
BLAKE2b-256 21e8481aa899a8892045ee108a064ad0340093a110beb6f1545756687013877e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.7.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 192b3d57b0d79f51800e4d3fe8e633d37e8b5c6e3de35ba95925e531bf56694d
MD5 88d6c9a4f1c888f2b0d72af87486451e
BLAKE2b-256 93b81d9744ac1373f0d1a8ba36fd1c798d55e30f18c17d5ef181dc930eb6e97b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.7.3-py3-none-win32.whl
Algorithm Hash digest
SHA256 c7d18862c2a8e43204f7b3b0ba8c7938e5b43e7b77a8240713a8288cd549a858
MD5 bfab11eb1e4f2792083b3f7a0a899b6c
BLAKE2b-256 897b1ce8e9e418e60912465e1013b65d8a67a7f7ca44e46ceb207dd749ee2200

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.7.3-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ceda0ec605297da35344f54401e235ca1bcb62d8fd3be90d58ab4e1011ce055f
MD5 16df3d5e7e3b1f863b1218d10e034fd3
BLAKE2b-256 9be1da16bbdf898f7eec7d9253678699611f0e56222dfe19d7fdf683ed0da45b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.7.3-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 536a3994f289e13cfb35313fd456af6e000a619a093fa6be4c2e82fd3fb8b28c
MD5 b4511f3d556bdeac28475dcb371cb864
BLAKE2b-256 4bbdaf0cf4327bb70efd8615c627d0b28212fed1bce31a21bafe2a67b2e86f0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.7.3-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 7f1619d7d9646b21d519fb44122042f9f3568e29787186514410eb816dc87371
MD5 4b82cce0d857a8db061a8b4783ad50f7
BLAKE2b-256 a0b0dd28930af88a7d856d67f603367b9b0e5efab446213c6664dd793ce81f70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.7.3-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 ce298ae53a74f9d513ddf4af709932dfafd5cdf87cc9b521510fb3da2a815579
MD5 0e5ef96f0ebb1df39017ffa2ea1e4896
BLAKE2b-256 404bbdeddeb32b9baaad3ed20eb961eedff36696ad57797176cb3439dd29c3d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.7.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a779d067a1b463e2fe2ca054c3ff562dd2b9c2f2d1873aa53683ff7f5653d48c
MD5 00bb2231cb5cdba9fc9d2cbede03f2ce
BLAKE2b-256 3783c4cb4f497d1163914e47a1878ebb7b6cf35c59855507a1b16cf55a09bec0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.7.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 e6a070493c381ba927ec5954b2bfa885e2f12d9ce4eb7056dd9b6acab750b40b
MD5 99cf8b42dfe8035ebed275f00d54d29c
BLAKE2b-256 196502cd8eb0c605ecffb0e6d25eacf630a218ba12a63c587676e4b723925734

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.7.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 e26d2d3a0fd7b04f2555c3282bb63680a0c702fec3b39f68c25a022a4be2c5c3
MD5 450c054f4bcc5bf13a2cefc023b1bf51
BLAKE2b-256 335b4ef8965e2781a9a28bcc3c4303d89bd2a2329a7529592046a4362417a63b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.7.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 9a7c29ef337504271dff172241ca94083988561fcd24063d34e7ebd99dc44ac8
MD5 3128134d78306e33edca2ea6e97122b7
BLAKE2b-256 5da5e4e26eeee66e6d0ab2e5348c3c5817dc9bb5b5a0302611e451ff37210743

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.7.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8a452252e1f654d262140ffa7133f4c61a31ab9d03137d03a4dd3aee0b8f2d52
MD5 1f9176a1f5f37ff82bf22075efcac2ae
BLAKE2b-256 6e3e105a8651ca86e9161797feb603597860b083e863d3f9ab2176e80db6c7c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.7.3-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 220e19e9647ce7828ab063e38d69d4b591c6e6c93014a53074880945d3b0db1b
MD5 68371afea386c60784ad3eb3c8917c4e
BLAKE2b-256 7c556bb8d36f95695e4c7151efa3b62929e936fc7f6dbac7f3eed6598566a584

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.7.3-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 cd5ed071057fc86e1a239009682ac95030f4a1f8abb32830348d614e9edebd7f
MD5 449604472b5daedfaa670475e6ca3036
BLAKE2b-256 bccf901de2ab2317c5bdfb0d14bc8fe2681e741c95fa020afdd8958df20c845d

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