Expand description
A quick and dirty command-line tool to enforce certain properties about Arti’s Cargo.toml files.
Definitions.
- An experimental feature is one for which we do not provide semver guarantees.
- A non-additive feature is one whose behavior does something other than add functionality to its crate. (For example, building statically or switching out a default is non-additive.)
- The meta features are
default
,full
,experimental
,__is_nonadditive
, and__is_experimental
. - The toplevel features are
default
,full
, andexperimental
. - A feature A “is reachable from” some feature B if there is a nonempty path from A to B in the feature graph.
- A feature A “directly depends on” some feature B if there is an edge from A to B in the feature graph. We also say that feature B “is listed in” feature A.
The properties that we want to enforce are:
- Every crate has a “full” feature.
- For every crate within Arti, if we depend on that crate, our “full” includes that crate’s “full”.
- Every feature listed in
experimental
depends on__is_experimental
. Every feature that depends on__is_experimental
is reachable fromexperimental
. Call such features “experimental” features. - Call a feature “non-additive” if and only if it depends directly on
__is_nonadditive
. Every non-meta feature we declare is reachable from “full” or “experimental”, or it is non-additive. - Every feature reachable from
default
is reachable fromfull
. - No non-additive feature is reachable from
full
orexperimental
. - No experimental is reachable from
full
. - No in-workspace dependency uses the
*
wildcard version. - Only unpublished crates may depend on unpublished crates.
This tool can edit Cargo.toml files to enforce the rules 1-3 automatically. For rules 4-7, it can annotate any offending features with comments complaining about how they need to be fixed. For rules 8 and 9, it generates warnings.
§To use:
Run this tool with the top-level Cargo.toml as an argument.
Run with --no-annotate
if you don’t want any comments added.
§Limitations
This is not very efficient, and is not trying to be.
Modules§
Structs§
- Crate 🔒
- Stored information about a crate.
- Crate
Info 🔒 - Information about a crate that we use in other crates.
- Dependency 🔒
- A dependency from a crate.
- Warning 🔒
- A warning we return from our linter.
Functions§
- arti_
dependencies 🔒 - Given a
[dependencies]
table from a Cargo.toml, find all of the dependencies that are also part of arti. - list_
crate_ 🔒paths - Look at a toplevel Cargo.toml and find all of the paths in workplace.members
- main 🔒