Skip to content

jim-works/bevy_lints

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bevy_lints

This project provides my lints for bevy, using Dylint. This is mainly for my other project, Wisphaven. These lints will be specialized for what I care about, so you may find some annoying. You can always pick which lints to use.

Current lints:

  • Require all spawned entities to be state scoped

How to use

You do not need to clone this repository to use it. Dylint provides support for running lints from git repos, though you can also clone and run it from a path on your system if you prefer. See https://github.com/trailofbits/dylint#workspace-metadata for more detailed instructions (including how to use a subset of lints).

  1. Install the necessary dependencies by running

cargo install cargo-dylint dylint-link

  1. Add the following to your project's Cargo.toml file (this pulls in all lints, see the guide above to only use specific lints using pattern)
[workspace.metadata.dylint]
libraries = [
    { git = "https://github.com/jim-works/bevy_lints", branch="master" },
    # or if you have cloned locally
    # { path = "path/to/repo/folder" }
]
  1. Now, you can run cargo dylint --all in your project to get the lints.

Disabling lints

You can use something like #[cfg_attr(dylint_lib = "bevy_lints", allow(state_scoped_entities))] to disable a specific lint. You may get a warning about an unknown library, which can be avoided by updating your Cargo.toml as described here.

If you don't care about receiving warnings about unknown lints, you can also use #[allow(lint_name)] in combination with #[allow(unknown_lints)]. If you go this path, you would probably want to use the global version #![allow(unknown_lints)] in your crate's lib.rs or mod.rs. Another approch is to add this to your Cargo.toml:

[lints.rust] #or [workspace.lints.rust]
unknown_lints = "allow"

VSCode integration

See the Dylint docs.

Related projects

The inspiration for this: https://github.com/MinerSebas/bevy_lint/

About

My lints for Bevy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages