Crates.io | cargo_semver_check |
lib.rs | cargo_semver_check |
version | 0.2.0 |
source | src |
created_at | 2022-07-12 18:13:11.431743 |
updated_at | 2022-07-13 04:11:38.449526 |
description | Scan your Rust crate for semver violations. |
homepage | |
repository | https://github.com/obi1kenobi/cargo-semver-check |
max_upload_size | |
id | 624565 |
size | 79,102 |
Scan your Rust crate for semver violations.
Queries rustdoc
-generated crate documentation using the trustfall
"query everything" engine.
Each query looks for a particular kind of semver violation, such as:
This crate is a work-in-progress. It can catch some semver violations, and will miss many more.
Its queries and adapter implementation have not been optimized for runtime,
and will currently exhibit O(n^2)
runtime growth on large codebases.
See the notes in the section below for details.
cargo-semver-check
to check your crateSteps:
cd
into its source directory
in preparation for some cargo rustdoc
commands.git checkout
of your crate's last published version,
which will represent your semver baseline.rustdoc
documentation in JSON format for the crate's last published version
by running cargo +nightly rustdoc -- -Zunstable-options --output-format json
.doc/<your-crate-name>.json
in your crate's
build target directory. Copy this file somewhere else -- otherwise it will be overwritten
by the next step.git checkout
of the crate source code you'd like to check for semver violations.cargo rustdoc
command above, and note
the newly-generated doc/<your-crate-name>.json
file.cd
back to the cargo-semver-check
directory (temporary, should be removed shortly).cargo-semver-check
directory,
run cargo run diff <path-to-new-rustdoc-json> <path-to-baseline-rustdoc-json>
.
This step will run multiple queries that look for particular kinds of semver violations,
and report violations they find.Notes:
O(n^2)
scaling for n
items in a few places that
I haven't had time to optimize down to O(n)
yet. Apologies! I have temporarily prioritized
features over speed, and the runtime will improve significantly with a small amount of extra work.