-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best way to add/extend Clang Tidy rules defined in this plugin ? #2378
Comments
An additional question on option 2 (which for now I think is the best way to move forward): running the generate_clangtidy_resources script generates two files:
Do you have a documented way of merging these two files into the single clangtidy.xml that is used by the plugin? |
Hello @aallrd,
Yes, this file is embedded into the plugin.
Yes, the script creates the files clangtidy_new.xml and diagnostic_new.xml. Merging it into the final clangtidy.xml is a manual step. 2325 is a n idea for the future to split these files.
First of all I think merging your custom rules into the cxx plugin makes no sense. Means you have to create a fork. The official way is to convert it to the Generic Issue Format and read it with this sensor then: I was also thinking about creating a new sensor supporting the
For 2 and 3 a new sensor is necessary. My idea was to reuse (read) the already existing files from sonar.cxx.other.rules with createExternalRepository. Using the External API the file could be local and extendable. Your proposed option 2 has the disadvantage that you have to build a new plugin every time your rules are changing. You have to deploy it on your server(s) and have to restart the server and have to add it to a profile before they are usable. Regards, |
Hello, After giving it more thought, I think the best way for my use case (custom Clang Tidy rules from our own LLVM/Clang fork) is the option 2 from my initial post:
There are several pros to this solution:
The only cons are:
|
Hi @aallrd, If that works for you, there's nothing wrong with it. Regards, |
Hello,
I am using your plugin to parse and display Clang Tidy / Warnings (diagnostics) reports in SonarQube and it is working great.
As far as I understood, the rules used to match the content from the above reports come from the plugin itself:
From what I gathered, this file is generated using generate_clangtidy_resources.cmd and with every new release of LLVM/Clang this XML rule file is rebuilt and a new release of the plugin is done to update the list/content of Clang Tidy / Warnings (diagnostics) rules.
I have a custom build of LLVM/Clang with my own custom Clang Tidy checks defined besides the standard ones, and I would like to add rules in SonarQube to display these checks along the default ones.
The ideas I had to do that:
Cumbersome and error prone, but seems like the only manual/UI solution available...
Seems ideal because reusing the same automated workflow used by the plugin, however I have no clue what to do next once I have generated my custom clangtidy.xml, do I rebuild the plugin or simply copy/paste this file on the SonarQube server?
Seems a bit too much just to add a few rules.
What would be the best way to proceed in your opinion?
Thank you.
The text was updated successfully, but these errors were encountered: