Exclude class name with wildcard from code inspection
Hi,
Is it possible to exclude specific names from code inspection? I have a C++ class that is a const pointer internally, but code inspection suggest that the local variable should be made const. It would be helpful to keep that suggestion for other local variables except the ones with a specific class name, such as FooConstPointer.
Please sign in to leave a comment.
Hello,
Unfortunately this is not possible right now. Could you please attach a snippet which demonstrates this problem? Does the code break if you make the local variable const, or do you not want to do that just because of stylistic reasons?
Thanks!
Hi,
A simplified version would be:
The main reason we don't want to have the const keyword for this specific class is mostly readability and style, but I was surprised that there is no way to ignore certain rules for variables with a specific name in general.
ReSharper has a lot of different inspections that operate on different code entities, so it's not clear how a general suppression mechanism like you suggest would work. In your case you probably want to ignore variables of a specific type, not with a specific name. We probably could add a custom C++ class attribute to suppress immutability inspections similar to what was done in https://youtrack.jetbrains.com/issue/RSCPP-18764. Note that this custom attribute would be understood only by R++. Would that work for you?
Hi, what you suggested seems like a useful solution for this case. Hopefully it gets added.
Thanks, I've filed a tracking issue https://youtrack.jetbrains.com/issue/RSCPP-32905/Add-a-custom-class-attribute-to-suppress-immutability-inspection.