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
import should work with rule templates #2
Comments
the same as #34 |
from http://stackoverflow.com/a/26977345/1015848
|
import functionality is hosted in plugin - https://github.com/checkstyle/sonar-checkstyle/blob/master/checkstyle-sonar-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporter.java |
+1 |
3 similar comments
+1 |
+1 |
+1 |
If smb have time to fix please be welcome with PR. |
It seems not to be possible to create a new rule from a template by the CheckstyleProfileImporter. Please give me a hint how to achieve this. |
@proferit , I do not know exactly how to make it. But there are two types of Rules already in plugin:
without properties - https://github.com/checkstyle/sonar-checkstyle/blob/master/checkstyle-sonar-plugin/src/main/resources/org/sonar/plugins/checkstyle/rules.xml#L97 |
+1 |
Hello, are there any workaround? |
workaround:
|
+1 |
1 similar comment
+1 |
if smb have a time, please send PR. |
I placed 15$ bounty on this issue (from general donations budget), does any body wants to contribute and have a beer after this :) ? |
I believe i created a working google checkstyle xml file google checkstyle for sonar.zip Note: 12 rules that caused errors were removed and have to be added manually as templates. Also this fix is only for a specific release and won't have changes for future releases. |
@roeeduv , can you explain how you overcome problem of several instances of the same Check in original config ? |
I didn't use Checkstyle rules. |
@roeeduv I added your comment to the zip link. This means it isn't a complete workaround by itself, and is also disconnected from the updated configuration checkstyle provides every release for Google. It is a temporary fix until the real problem is solved. |
I am getting the following error when I load your checkstyle in sonar:
|
try removing "EmptyLineSeparatorCheck" rule from the xml file and add it manually from the templates |
Hi, I spent few days to investigate this issue and I figured out that both sonarqube code and sonar-checkstyle code has to be modified in order to resolve this issue. I managed to make As for now, I created a script which works around this issue via Sonarqube Web API. If anybody wants to save themselves from manual creation/activation of checkstyle rules, please check my workaround script written in Python. Problems (why importProfile does not work)
WorkaroundYou can try my workaround script written in Python which use web API to import profile. I have tested on my computer and it worked properly. I appreciate everyone for maintaining this useful and awesome plugin. :) Please feel free to correct me if I misunderstood something or made a mistake. |
Hi there, it's already end of 2021 and it seems that the problem still haven't beed solved. |
@SPICYJO @drriguz unfortunately, no. as @SPICYJO figured out SQ does only allow activation of rules and not creating custom instances. hence, we need to wait for an upstream fix (if it happens) unless one has a better idea. currently, there's also not enough bandwidth from my side to investigate if there's a different workaround that might work. |
Here is a link for the thread. https://community.sonarsource.com/t/is-there-any-way-to-define-a-new-custom-rule-from-template-rule-while-importing-profile/43655 But there is no updates yet. |
With SonarQube 4.5.1 and Checkstyle plugin 2.2, importing the following file triggers an error: "Rule template can't be activated on a Quality profile: checkstyle:com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck"
The text was updated successfully, but these errors were encountered: