clang-tidy configuration file and code cleanup

There is a Resharper option to use a custom clang-tidy configuration file. But it is not taken into account with Code Cleanup, even if I activate the CodeCleanup option "other-fixits".
Is it a bug or am I overlooking something?

6 comments
Comment actions Permalink

Hello,

Why do you think it's not being taken into account? Please describe what you're trying to do. 

Note that the list of enabled checks is currently taken from R# settings and not from the config file - https://youtrack.jetbrains.com/issue/RSCPP-30593/Provide-a-convenient-way-to-use-the-checks-list-from-clang-tidy

Thanks!

0
Comment actions Permalink

I know it's not taken into account, because before using R++, I used https://clangpowertools.com/ and with it, it works.
Therefore I have a reference .clang-tidy file I can trust.
If you say that the list of enabled checks is currently taken from R++ (not R# as you mention) settings and not from the config file, then why does the R++ says it supports .clang-tidy at all?

0
Comment actions Permalink

R# uses the -checks command-line argument to pass the list of enabled/disabled checks to clang-tidy as described on the settings page:

With this setup, the command-line -checks value overrides the list of checks from .clang-tidy. R# does not interact with .clang-tidy per se, but the .clang-tidy file is read by the clang-tidy binary. This allows you to configure the behavior of specific checks through .clang-tidy.

Ideally, there would be close integration between the severities of inspections that you can change via R# and the .clang-tidy file, that's what the issue mentioned above is about. We could also add a quick setting that controls where the -config argument is used at all, but then if you change the severity of an inspection through R# nothing happens and it gets confusing.

0
Comment actions Permalink

It seems you did not get my point. I am reporting that the .clang-tidy file that I specify in the R++ settings, is not taken into account at all by the Code Cleanup feature. To minimize errors, I have created a minimal .clang-tidy file, whose content is only:

Checks: '-*,modernize-use-nullptr'

Then I run Code Cleanup and I see the requested fix is not applied to the code.

Therefore, this is either a R++ bug, either an option in R++ I have overlooked.

To make myself as clear as possible: I am not speaking about explicitly checking 'modernize-use-nullptr' inside the R++ option dialog, I am speaking about using this option inside a .clang-tidy configuration file.

 

 

0
Comment actions Permalink

It seems you did not get my answer. I tried to explain why the "Checks" parameter from a .clang-tidy file is not currently used. Again, in short, it's because R# uses the "-checks" command-line argument to clang-tidy.exe which overrides the value from the config.

0
Comment actions Permalink

Thanks for explaining again, now I understand.

0

Please sign in to leave a comment.