dlang-community / D-Scanner

Swiss-army knife for D source code
Boost Software License 1.0
240 stars 80 forks source link

Skip lint on given line / function / class .. #935

Open ricardaxel opened 12 months ago

ricardaxel commented 12 months ago

Would you be open to add some mechanism to skip linting a given line / function / ... ?

For example through UDAs, following code wouldn't raise any warning.

@("NOLINT(useless_initializer)")
bool b = false;

I can work on a POC if you're ok with the concept

WebFreak001 commented 11 months ago

awesome! Yes this would be very much appreciated. Also it would be great if this worked both with @("nolint(...)") as well as @nolint("...") (for future compatibility or big projects that declare this)

We had the idea before that dub packages could provide files that are always implicitly imported by the compiler, such as object is already, which could provide exactly UDA definitions like this and help the compiler statically check for wrongly used attributes. However these UDA files will still need compiler flag support, which wasn't merged yet / didn't have a compelling use-case yet.