console icon indicating copy to clipboard operation
console copied to clipboard

warnings: toggleable warnings

Open hawkw opened this issue 4 years ago • 0 comments

Users should be able to turn individual warnings on and off, using the command line and/or possibly an eventual config file. I discussed this briefly in https://github.com/tokio-rs/console/issues/56#issuecomment-916256883.

Here's a rough summary of how I imagine this would work:

  • [ ] Add a (reasonably) short, CLI-friendly name to lints.
    • This would probably be a short string name without spaces, something like self_wake_percent for the self-wake percentage lint.
    • We may also want to add numeric identifiers for lints.
    • This could be done by adding a function to the warnings::Warn trait returning an &'static str? It would unfortunately have to be a function rather than an associated const, since the Warn trait has to be object-safe.
  • [ ] Store warnings in some kind of map from short names -> warnings.
    • One potential way to do this is using a compile-time hashmap like the phf crate.
  • [ ] Add a CLI flag taking a list of lints to disable.
    • We may also want to add one that takes a list of lints to enable, in case we add lints that are not enabled by default
    • This would also be useful coupled with a --no-default-lints or similar.
  • [ ] When the console starts, we would construct the list of lints based on the CLI arguments if they are provided.

hawkw avatar Sep 16 '21 17:09 hawkw