TheBevyFlock / bevy_cli

A Bevy CLI tool and linter.
https://thebevyflock.github.io/bevy_cli/
Apache License 2.0
52 stars 7 forks source link

Lint suggestion: filtering SystemParams allowed in a SystemSet #104

Open Exsolutus opened 2 months ago

Exsolutus commented 2 months ago

I'm looking for a way to filter the SystemParams allowed on systems added to a given SystemSet. @alice-i-cecile suggested I open a lint proposal here to discuss what a lint for this would look like.

Ideally the user would be able to define a SystemParam whitelist/blacklist filter on a SystemSet. The lint would then need to validate systems against this filter and deny the addition of that system to the set. This filtering probably also needs runtime validation, but the lint would be helpful ergonomically.

alice-i-cecile commented 2 months ago

I do think this is quite useful: making sure you don't put gameplay code in the wrong state or so in is important.

We could also consider tying this sort of thing directly to states, or moving it fully to runtime schedule inspection.

Exsolutus commented 2 months ago

How would it work using states?

For runtime schedule inspection, using https://github.com/bevyengine/bevy/pull/11094 is probably a good idea.

alice-i-cecile commented 2 months ago

So, I think the states variant is probably a different lint, but being able to say "you should not be accessing certain data in a certain state" is an interesting customizable correctness check. Probably quite hard to configure though, so maybe not worth it.