Does anyone know if there’s something similar to ESLint’s no-console for Rust that can warn about or prevent the use of ic_cdk::print
, unless it’s explicitly marked as expected?
Use forbid
Here:
Thanks but, you cannot forbid ic_cdk::print
or can you?
I did not give it a try yet but, after a quick research, I landed in a Reddit post that mentioned dylint (developed by Trail of bits). It seems to be a Rust linting tool, similar to Clippy, that runs lint rules specified by users. Maybe something interesting…
Ohh, I meant this needs to be added upstream in the ic_cdk
. My bad, I misunderstood
You can use clippy::disallowed_methods to block the usage of a particular method (if clippy is part of your workflow). The caller would need to then annotate it with #[allow(clippy::disallowed_methods)]
if you still want to use it.
Amazing! This is what I was looking for, thanks!
In case it’s useful for anyone interested in the topic, here’s the related PR in Juno.