Installation
CLI
The CLI supports automatically installing the latest released version of the linter if you do not have it installed already. Make sure you have the CLI first, then simply run the lint
subcommand:
bevy lint
The CLI will prompt you if you wish to install the linter. Type y
and press enter to accept:
warning: failed to run bevy_lint, trying to find automatic fix...
`bevy_lint` is missing, should I install it for you? [y/n]
If you want to auto-confirm the prompt, you may pass --yes
to the command. Note that if you are installing the linter in CI, you may wish to use the dedicated Github Action instead:
bevy lint --yes
Manual
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
.
Uninstall
If you wish to uninstall the linter at any time, you may use Cargo and Rustup to do so:
cargo uninstall bevy_lint
rustup toolchain uninstall $TOOLCHAIN_VERSION
Upgrade
To upgrade to a newer version of the linter, first uninstall it then follow the CLI or manual installation instructions.
-
bevy_lint
imports internalrustc
libraries in order to hook into the compiler process. These crates are stored in a dynamic library that is installed with therustc-dev
component and loaded bybevy_lint
at runtime. Uninstalling the nightly toolchain would remove this dynamic library, causingbevy_lint
to fail. ↩