SonarQube custom rules does not show in SonarLint rures

Hello

I am using
SonarQube 7.9.3
SonarLint 4.8.0.18115
IntelliJ 2020.1.2

I have done followings:

  1. Created a custom rule in SonarQube.
    XML definition is this:
<!--  Generated by Sonar  -->
<module name="Checker">
<module name="SuppressWarningsFilter"/>
<module name="RegexpSingleline">
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java"/>
<property name="format" value="^takahashi123$"/>
<property name="message" value="Violate ^takahashi123$ format."/>
</module>
<module name="TreeWalker">
<module name="SuppressWarningsHolder"/>
<module name="SuppressionCommentFilter"/>
</module>
</module>
  1. Duplicated quality profile sonar way(java) and added this custom rule to it. And assigned this profile to my project.

  2. Installed SonarLint to IntelliJ and connected the SonarQube Server and my project. and clicked “Update binding” button. I could not find any error in SonarLint log with verbose option.

However, I could not find my custom rule in Rules tab in Intellij settings: Settings - Tools - SonarLint.
My custom rule works only in SonarQube server (scanner).

I also greped the word “takahashi” in the folder “[user folder of windows]\AppData\Roaming\JetBrains\IntelliJIdea2020.1\sonarlint”, and find the word in “global\rules.pg”, “active_rules(hex number)pb]” files, so the custom rule looks to be downloaded to SonarLint.

Does anyone have advice on this case?

Thanks in advance.

Hi @takahashi ,

It seems to me you are trying to make SonarLint to execute Checkstyle rules. This is not supported. See the FAQ for details.

Hi Julien,

Thanks!
I thought I was using template of SonarAnalyzer (Java) but that was of checkstyle.
I will try using SonarAnalyzer template.

UPDATE:

I tried but still the added rule does not show in SonarLint.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.