Crate bevy_lint

Source
Expand description

bevy_lint is a custom linter for the Bevy game engine, similar to Clippy.

This is the primary documentation for its lints and lint groups. bevy_lint is not intended to be consumed as a library. You can find the documentation for individual lints and their groups in the lints module.

§bevy_lint

bevy_lint is a custom linter for the Bevy game engine, similar to Clippy.

Warning

This is an unofficial community project, hacked upon by the Bevy CLI working group until it is eventually upstreamed into the main Bevy Engine organization. Pardon our rough edges, and please consider submitting an issue if you run into trouble!

§Installation

bevy_lint depends on a pinned nightly version of Rust with the rustc-dev Rustup component. This is because bevy_lint uses internal rustc crates that can only be imported with the permanently-unstable rustc_private feature. You can refer to the compatibility table to see which version of the linter requires which toolchain.

You can install the toolchain with:

rustup toolchain install $TOOLCHAIN_VERSION \
    --component rustc-dev \
    --component llvm-tools-preview

For example, you would replace $TOOLCHAIN_VERSION with nightly-2024-11-14 if you were installing bevy_lint v0.1.0, based on the compatibility table. Please be aware that you must keep this toolchain installed for bevy_lint to function1.

Once you have the toolchain installed, you can compile and install bevy_lint through cargo:

rustup run $TOOLCHAIN_VERSION cargo install \
    --git https://github.com/TheBevyFlock/bevy_cli.git \
    --tag $TAG \
    --locked \
    bevy_lint

Make sure to replace $TOOLCHAIN_VERSION and $TAG in the above command. The tag for a specific release can be found in the releases tab. For example, the tag for v0.1.0 is lint-v0.1.0.

§Getting Started

bevy_lint has the same API as the cargo check command:

bevy_lint --help

If you have the prototype Bevy CLI installed, the linter is also available through the lint subcommand:

bevy lint --help

For more information on how to use the website, please see the full documentation.

§License

The Bevy Linter is licensed under either of

at your option.

§Contributing

Please see CONTRIBUTING.md for the CLI for more information! The linter contributing guide can be found on the website.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


  1. bevy_lint imports internal rustc libraries in order to hook into the compiler process. These crates are stored in a dynamic library that is installed with the rustc-dev component and loaded by bevy_lint at runtime. Uninstalling the nightly toolchain would remove this dynamic library, causing bevy_lint to fail. 

Modules§

lints
All lints offered by bevy_lint, organized by lint group.

Structs§

BevyLintCallback
The rustc Callbacks that register Bevy’s lints.