/rust-ontologist

Visualizing Rust codebases in a few seconds

Primary LanguageRustMIT LicenseMIT

rust-ontologist

Navigating through a big codebase is hard, especially when you are just learning it. IDEs make it simpler, but they do not show the "real" project structure, with all inter-module dependencies and such. rust-ontologist comes to the rescue: it generates a structure, or ontology, of any Rust project, and visualizes it in an interactive browser window.

rust-ontologist is fast enough to handle a project of any scale, including the Rust compiler itself, which we demonstrate below.

Usage

Clone the repository:

$ git clone https://github.com/lava-xyz/rust-ontologist.git
$ cd rust-ontologist

Run the following command to generate a project structure dump in JSON:

$ cargo run -- -p <your-cargo-project>

Run a static server on port 8000:

$ python -m http.server 8000

Finally, open http://localhost:8000/index.html and see the result!

Gallery

To enable coloured edges, provide the flag --enable-edges. Note that not all module dependencies are shown at the moment.

rust-bitcoin/bitcoin (edges enabled)

rust-bitcoin/bitcoin

actix-web/actix-web (edges enabled)

actix-web/actix-web

tokio (edges disabled)

tokio

rust (edges enabled)

rust

Contributing

Just fork the repository, work in your own branch, and open a pull request on master. When submitting changes, please prefer rebasing the branch to keep the commit history as clean as possible.

Release procedure

  1. Update the version field in Cargo.toml.
  2. Update CHANGELOG.md.
  3. Release the project in GitHub Releases.

TODOs

  • Think about packaging rust-ontologist on crates.io. We have this index.html file, what to do with it?
  • Show more information in the graph: comments, types, etc. We need hide/unhide functionality for this.
  • Implement various code quality metrics based on graph manipulation.
  • Automatically suggest changes that are likely to improve a project's architecture.
  • Integrate with Git and GitHub: add a UI for commits, issues, PRs, show exact code locations of items, etc.
  • Experiment with nicer-looking but fast UI.