# cargo-manifest-check > Check the formatting of your manifest files cargo-manifest-check checks that various items from your [manifest files](https://doc.rust-lang.org/cargo/reference/manifest.html) are formatted as expected. It is currently mostly concerned with checking the order of items, and does not currently allow to automatically sort them. It *may* gain that ability in the future. It is primarily intended for use in CI, and is relatively opinionated; it does not currently offer any kind of configuration. ## Installation and Usage cargo-manifest-check can be installed from source through [crates.io](https://crates.io/crates/cargo-manifest-check/): ```sh cargo install --locked cargo-manifest-check ``` It can then be used as a Cargo subcommand to check all manifest files recursively discovered in the current directory: ```sh cargo manifest-check ``` ## What is Checked The following items are checked: - Lexicographic ordering - Dependency sections - [`[workspace.dependencies]`](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-dependencies-table) - [`[dependencies]`](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html) - [`[dev-dependencies]`](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#development-dependencies) - [`[build-dependencies]`](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#build-dependencies) - [`[target.*.dependencies]`](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies) - The [`workspace.members` array](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-members-and-exclude-fields) - [`[patch.*]`](https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section) sections - [`features` arrays in dependencies](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#choosing-features) - Feature arrays in [`[features]` sections](https://doc.rust-lang.org/cargo/reference/features.html), keeping `dep:` features grouped first - Specific ordering - [Manifest keys and sections](https://doc.rust-lang.org/cargo/reference/manifest.html) - [`[package]` keys](https://doc.rust-lang.org/cargo/reference/manifest.html#the-package-section) - [`[workspace.package]` keys](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-package-table) - Workspace inheritance syntax - Dependency inheritance must use an explicit inline table (i.e., `= { workspace = true }`) instead of a dotted key (i.e., `.workspace = true`) Dependencies can be grouped (by surrounding them with blank lines), in which case ordering is checked within each group individually. See the [`tests/fixtures`](./tests/fixtures) directory for examples of manifests that would be accepted/rejected. ## What is not Checked The following is not currently checked: - Lexicographic ordering - Dotted dependency tables (e.g., `[dependencies.foo]`) - Specific ordering - [`[profile.*]`](https://doc.rust-lang.org/cargo/reference/profiles.html) keys - [target tables](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#configuring-a-target) keys - Workspace inheritance syntax - Package key inheritance must use a dotted key (i.e., `.workspace = true`) instead of an explicit inline table (i.e., `= { workspace = true }`) Support for these *may* be added later. **Additionally, cargo-manifest-check does not check that the manifest files are valid manifests (e.g., that keys exist and are valid); it only checks their formatting.** ## Compatibility - If new checks are introduced which would reject manifests previously accepted, the SemVer version will be updated to reflect that. - The current console output is however not intended for machine consumption and no compatibility guarantees are provided. Another output format meant for parsing *may* be introduced in the future, so it can be used with tools like [efm-langserver](https://github.com/mattn/efm-langserver). ## Contributing This linter is opinionated on purpose and it is planned to limit configuration as much as possible. However if you have found some bugs regarding formatting checking or you think some other checks could be added (where *one obvious* order exists), please do open an issue. ## License Copyright 2024 AudaciousAxiom This project is licensed under MPL-2.0.