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.6.0.tar.gz (60.7 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.6.0-py3-none-win_amd64.whl (1.6 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3Windows x86

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

Uploaded Python 3musllinux: musl 1.2+ i686

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

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

rusty_todo_md-1.6.0-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.6.0.tar.gz.

File metadata

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

File hashes

Hashes for rusty_todo_md-1.6.0.tar.gz
Algorithm Hash digest
SHA256 e4061041ea50ad694b40a2fec089586afa276b74437b22352655c238f5b1143b
MD5 f130155926e594642a1ebf0cd59c5ee7
BLAKE2b-256 f6522c4379ea6273beeaa37d3c656d790de2f8438f5e0ec8a8fdd483fbb8c84b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.6.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 aace0b0b7269a61928bcfb82eeb8c33442740c304b1dbab11b13a1b1c112c6cc
MD5 fd084b3668e2f21fc55424527dcc8c2c
BLAKE2b-256 135d52fe85a95637e0a1c57d237f5c9e6ae366cab8381e24e9525a82d05bfd2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.6.0-py3-none-win32.whl
Algorithm Hash digest
SHA256 51eea875bed99b0e6c9998fd424126fa36748c68c54dec263cb99ad4d6dc0773
MD5 ce48cd9092b061d6b3858a4c1e4c427d
BLAKE2b-256 b295de9a39bec366ee954437998d9eaef731b190f7595d61adae74ab9c884497

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.6.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 afab3277ab41284e3bba0f37ffd65947fa23513d9878a3d5e8bae862cdd1451e
MD5 9f296fb515ebb26d150b46c887d68dc8
BLAKE2b-256 3d0f95045914977f3782c138069178512b8967b5731a670d3f4d51256b9c96d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.6.0-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 e6df2b4138367766c31301fbbe902ef71ca65646722d9eb10b5d043f2a339b1d
MD5 3ed443cb191444c3652955bc0d561d26
BLAKE2b-256 ee027ba721476b820377b6f72d45e94254ed0968feca432b274545aeb8e10a3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.6.0-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 2477483fa8527dc9f4df025c5d571c1551b6d5976cac9f9e0076070e45033f01
MD5 d74d0fa68c11e4b4aadfbdd221474d0b
BLAKE2b-256 f0823e9ca095e6bc3138fa3658bb60fc816653919aca5a5c7f6279083e2df055

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.6.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 9b5a35288111ea0da45963ab738064e3a35a4c5acf606f6bcc0f3433a897d303
MD5 f131c7ee1f3806812d780e59a4b2008c
BLAKE2b-256 7092694ff90fe29c7e5fee415d36aa652e5c32ae693a6d1a042587b84ad2e3f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.6.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0c974291f037980f786405ec7787d6f7c08017b244296a85bef04dfb967d8941
MD5 087c925cbe0cabe77f62f550ca52115e
BLAKE2b-256 c23d07384ea345ed9979138c00fad97c5606d647fbb218af32365d52b4857693

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.6.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 690dfd666d47a57c2c1afeb381051c80a245c91b15b3c11c5e3289cee1a7ec25
MD5 b65e384b86c7be7999eafbdfde925b03
BLAKE2b-256 839f95517574b04ec95b6d309b29f96b898ccf9a97242a6d99fd63b7f78a5f6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.6.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 5aad3a3551df5a55dee3b1890ff1020c432f49cdb0ab695058ff531176647f3e
MD5 efb7defc53d7b716af6fd65e55cb1484
BLAKE2b-256 fdf7bfacb54b139f6eefef6486fd70530178d885c89b0c9b50c39491248a5609

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.6.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 4e47319a7f6a271a4cdf95cad02188ea0495a00d1d6ad34f9d43dc18a205e978
MD5 1b37af1bb954dd71080dd39254df3197
BLAKE2b-256 b221523481b1ff5554b12860010bfc26ab6d053593044fb8694340bf18c647ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.6.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3c0751865d326167a89e227ab7bb647aa45c260611cc0edf3e667466959c0f83
MD5 a353ef0acf8a4d3fcbd5f83d0440a865
BLAKE2b-256 4962e0eea7a65eacbde1216bd2ebfe92ab2f8bf52644e66348182c87614a7c7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.6.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 698a79fd6aaa3aec7e574ec87f01db19590cd4c463f88a8fa5193a56dc9a66b9
MD5 35b80b4a84eb74a927e80f46aab1217d
BLAKE2b-256 edfabca23227a5b5d42e0ee63429f14f0807245cfa587fb9e74af741bc6c6305

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.6.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 230c3af791cf12c7104b2e493a27992948a9557abf062c939beb0dc9c60d1cfa
MD5 5fd2312a2bd1532a369895adad1bd82b
BLAKE2b-256 fa70a5dfc1c4fdf9b00b2f30abf28e81a1376b7b640ebfe454f866048dfb657b

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