Disabling checks locally via comments
figsoda opened this issue · 2 comments
for example:
{
# statix-ignore
overlays.default = final: prev: import ./overlay.nix final prev;
}
{
# statix-ignore: eta_reduction bool_simplification
overlays.default = final: prev: import ./overlay.nix final prev;
}
sounds super useful!
I've just run into an example where "fixing" a bool_comparison
lint error would end up breaking a module where the option value could be either boolean or string [context]. Since usually I would like to keep the linter rule enabled, suppressing the rule with a comment would be ideal for this exception.
I have zero experience writing Rust, however being eager to learn the language (and potentially see this feature implemented), I went looking for some prior art in other Rust-based linters that I'm aware of. I found this example, which may be of use to whoever ends up working on the feature:
https://github.com/rome/tools/blob/main/crates/rome_js_syntax/src/suppression.rs
Suppression comments have the following format:
// rome-ignore lint: <explanation> // rome-ignore lint/suspicious/noDebugger: <explanation>
Where
rome-ignore
is the start of a suppression comment;lint
suppresses the linter;/suspicious/noDebugger
: optional, group and name of the rule you want to suppress;<explanation>
explanation why the rule is disabledHere’s an example:
// rome-ignore lint: reason debugger; // rome-ignore lint/suspicious/noDebugger: reason debugger;