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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3Windows x86

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

Uploaded Python 3musllinux: musl 1.2+ i686

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

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

rusty_todo_md-1.3.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.3.0.tar.gz.

File metadata

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

File hashes

Hashes for rusty_todo_md-1.3.0.tar.gz
Algorithm Hash digest
SHA256 8490de98686256e448ad616d1229025cbb2f4492ff9bda75ec1b3bdf179c500a
MD5 9fc3e234d558293bfee584850ca123c7
BLAKE2b-256 25bb18e147cb85a2efe5a5748b4613b598878b9bad5e733dfdf59621234593af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.3.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 8f09044549c0ea8fa3d4d907d7fb63b73b8b81dd283907eec7ac61c956fd3a36
MD5 fd455dfaa79c7ac559b46756d97625f8
BLAKE2b-256 2833548780085266996e32b1ebd68255c0008fed278d8d3de77224217d6ba387

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.3.0-py3-none-win32.whl
Algorithm Hash digest
SHA256 811537aaf37a9ff0ee55ae46c1e34c08a0b14a8fd85515bc8de46de7e05e89e4
MD5 058c77c6375a8c64bc7cc30f5b21d58e
BLAKE2b-256 4bff2e0c817553cab2328c92ef36fa822e6fd4015735eb0a8933c6f005e5a918

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.3.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b6c3f7ad63997dad760352822606cb6e4ccb864e35c3b6aa44b702b1072992b3
MD5 e42d569393cdcc76cb9c6456b55ece46
BLAKE2b-256 0351be5bda91b6a579a35299b4bad6d3e5026af0748f3b3c9baaf734e15ff92b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.3.0-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 0ea3e60cf8ab3e295dbe62427ec5f6a27d9dafc4def20e8a6ff5e9706380b506
MD5 0cab35b2b9687a5e93ee213d59de5e2a
BLAKE2b-256 e9a13a9e1ec2ca1051c720dd20bfb988dc12cdb25474107ac0afa70ede5c20bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.3.0-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 ee66d3c13e2c5efaea2caac530a201c0bbe1655bda5323d92b259d86e31cef2f
MD5 014083387a49475b0b866df2406d1ccd
BLAKE2b-256 99b52efb062203d6e2570b26792b17dbfaeef5362f3866a14889ef66dafd9069

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.3.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 bb1d043f8a72e880e59e458d8b0ce26bc38acaed5d83b22e6a9fa0675674f60f
MD5 56cb397f9cc9865e411704bd37c4e70a
BLAKE2b-256 d9b25357f1493920040a5404af9d37e19f0643a77a9cd46dbad2eaa29100329d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f53b59555f8ac83379a4c73985c18ca93c815e92645c15ae02e4e80f001e2966
MD5 26581cca8230b58e998c2d13e3dec492
BLAKE2b-256 1dd0bae205f8ca9a46d159b50c208493ee082b3ed65fca3d9e0948b50c802f48

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.3.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 2d4a6d14313214eaeb78dd7e42ceda1aa72bda1a714ca71beca4579365ee0142
MD5 7b9b5fcb575ffdf9030ed423f03d399a
BLAKE2b-256 eb33b4e80d4e6988437edc02978cd56dc1d121530f8a8e154ba5cacef3a988f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 d7361bc419b1d2713434066c7de780e3da7e7d8b6ea9429f6d5a1c07e0666bd3
MD5 27bebd7c81c7b09338b0988bb5145549
BLAKE2b-256 7e132a9f51f01b97cfa9acedc01657a2a866b3a9e6fb7739a3128e057bdf92b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 2a4c11e9af535bafbafd50024c8cb669925ba4460c6960e46aff4ff7e9592d92
MD5 40923949f1bf3ffd98e10f28f5b31234
BLAKE2b-256 2938339416a738f187cbf3116b58432c955a2a8b53de6bf9492685dd6f0e6c22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6473c2d9714bd5a26fb3d982fa0a77fe2c554a312c905afec15c3b09f2394664
MD5 2c8f09bc72be33b74e86c475a8467b26
BLAKE2b-256 28a059a2f768c2b2633c9b33cbb50851160a87079955d0d1f2c1d0d4189e559c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.3.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 566b2daefc4d4dff90765089e93483957234bbf11a349101067999c5da5075f7
MD5 4f5a176edea0b5c91ea63db4514d19a4
BLAKE2b-256 ad0e51842e19e3ffd5c40cf97b4641886fe01bf3c158046ed8487dd4a0413476

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rusty_todo_md-1.3.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0fffa3387ec1f3032b8ae8191cff6d6a995a49593304e83de0e8cb8131228b92
MD5 dbab2c31967d95eb1066af7ab5fac94c
BLAKE2b-256 b5633db76f80e3ffdb6721e74e1faf953be36a820843f44652f953c5b7d99e2c

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