-
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
sonar.cxx.other.rules not reloaded on SonarQube restart #2557
Comments
Hi @br-rhrbacek, which versions of the plugin and SonarQube are you using?
Regards, |
Hi @guwirth, We are using SonarQube 9.9.1.69595 and sonar-cxx V2.1.1. The rules are valid, and are visible in the Administration after the restart, but cannot be activated since they are not registered. We checked the LOG files and could not find the Recently, we upgraded from SonarQube 8.9 and as far as I can remember, it worked with this version. Regards, |
Hi @br-rhrbacek, we have it running. The point I don’t understand is:
I understand that you can’t add new rules? Are any other rules visible? Why I’m asking is because I see no difference between doing it the first time or later. The whole mechanism is not very well supported by SonarSource. Means you have to ensure that XML is valid, there are no duplicated keys, … (see https://github.com/SonarOpenCommunity/sonar-cxx/wiki/sonar.cxx.other.rules#troubleshooting). Regards, |
Hi @guwirth, We have been using the plugin with multiple custom rules and want to add some more. The point is that if we add them to sonar.cxx.other.rules, and restart SonarQube, we can't find them in Rules and can't activate them in the profile. I think the root cause is that SonarQube does not trigger the registration of the rules on each restart, but only for the first time when installing the plugin. At least this is how I understand this thread: https://community.sonarsource.com/t/how-to-retrigger-define-functions-of-rulesdefinition-in-new-version-of-sonarqube/90314/3. Regards, |
Hi @br-rhrbacek, How did you add the rules the first time? For my understanding the first time you are starting the server with the plugin the sonar.cxx.other.rules are empty, right? Then you are adding the rules in the UI and restarting the server. What’s different adding later on additional rules?
Regards, |
Hi @guwirth, I tried to remove some rules, restart the server, and there was no change as well. I'm unsure if I can remove all the rules since the profile would probably be affected, right? So I removed only the rules that are not used now, but after the restart, they were still available. Regards, |
Hi @br-rhrbacek, tried it with a fresh installation and you are right. There seems to be a cache mechanism reloading the rules only if plugin changes are detected. Question is how they detect a "change"? First start with a plugin:
All following starts without plugin change:
Regards, |
Hi @br-rhrbacek, in a first step they are verifying if there is a new plugin with a new pluginKey, For existing plugins they verify if the file hash value has changed. Metadata description: Currently no idea how to work around this? Regards, |
Hi @guwirth, the only solution I have is to modify the hash value in DB ( Regards, |
Hi @guwirth, I managed to register the new rules by modifying the file hash in DB ( Since we do not update the rules often, it is an acceptable solution for us. Regards, |
Hello @br-rhrbacek, thanks for your feedback. Not sure if there is an API to do that from the plugin? Yesterday I tried renaming the .JAR, touching the .JAR (update date) without success.
But all ugly :-( Regards, |
Documentation of changed behaviour in https://github.com/SonarOpenCommunity/sonar-cxx/wiki/sonar.cxx.other.rules |
According to this wiki page, the sonar.cxx.other.rules should be reloaded after SonarQube is restarted, but they are not.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
New rules should be visible in Rules tab in SonarQube.
Additional context
It seems that the rules are only registered during plugin installation, see this ticket: https://community.sonarsource.com/t/how-to-retrigger-define-functions-of-rulesdefinition-in-new-version-of-sonarqube/90314.
The text was updated successfully, but these errors were encountered: