SonarQube in IntelliJ Does Not Recognize Custom Rules from Plugin

Hello SonarQube Community,

I have developed a custom SonarQube plugin with custom rules for Java, and I am facing an issue where SonarQube plugin in IntelliJ does not recognize these custom rules. Here’s the situation:

Environment Details:

• SonarQube Server Version: Community Edition v25.1.0.102122 (running in a Docker container)

Custom SonarQube Plugin Project:
•. SonarQube Plugin API: org.sonarsource.api.plugin:sonar-plugin-api:11.1.0.2693
• Gradle Project with Quarkus and Java 17
Plugin metadata:

manifest {
        attributes(
            'Plugin-Name': 'Custom SonarQube Plugin',
            'Plugin-Key': 'plugin-key',
            'Plugin-Version': version,
            'Plugin-Class': 'de.example.sonarqube.CustomSonarPlugin',
            'JRE-Min-Version': '17',
            'Plugin-RequiredForLanguages': 'java',
            'Bundle-Name': 'Custom SonarQube Plugin',
            'Bundle-SymbolicName': 'de.example.sonarqube',
            'Bundle-Version': version,
            'Bundle-ManifestVersion': '2',
            'SonarLint-Supported': 'true',
            'SonarLint-Rules-Definition': 'de.example.sonarqube.CustomRulesDefinition',
            'SonarLint-Repository-Key': 'my-repo-key',
            'SonarLint-Languages': 'java',
            'SonarLint-Required-Languages': 'java'
        )
    }

Analysed Project:
• SonarQube Gradle Plugin: org.sonarqube 6.0.1.5171
• SonarQube for IDE Plugin 10.17.0.80539 (IntelliJ Ultimate) in Connected Mode
• Gradle Project with Quarkus and Java 21

The Issue:
• Running ./gradlew sonar --info correctly detects custom rule violations and reports them on the SonarQube web interface (http://localhost:9000).
• However, running the analysis from IntelliJ using the SonarQube for IDE plugin does not highlight custom issues neither in the IDE nor in the SonarQube UI.
• Standard SonarQube rules work fine — only the custom rules are missing from IDE plugin’s results.

Troubleshooting Done:

  1. Verified that the custom rules are properly registered:
    • The rules appear in Rules in the SonarQube UI and are active.
    • Running curl -X GET “http://localhost:9000/api/rules/search?repositories=my-repo-key” returns my custom rules.
  2. Ensured the correct SonarQube configuration in the analyzed project (build.gradle):
    sonarqube {
          properties {
            property "sonar.projectKey", "my_project"
            property "sonar.host.url", "http://localhost:9000"
            property "sonar.token", "my_sonar_token"
            property "sonar.sourceEncoding", "UTF-8"
            property "sonar.show.rule.warnings", "true"
            property "sonar.show.issues.on.editor", "true"
            property "sonar.sonarlint.projectServerSideAnalysis", "true"
            property "sonar.plugins.dir", "/opt/sonarqube/extensions/plugins"
        }
    }
    

Question: Do I need any additional properties to make SonarLint recognize custom rules?

  1. Checked SonarLint Cache & Rebind in IntelliJ:
    • Cleared ~/.sonarlint and ~/Library/Caches/JetBrains/IntelliJIdea2024.1/sonarlint.
    • Re-added the SonarQube Server Binding in IntelliJ.
    • Still, custom issues do not appear.
  2. Checked SonarQube Logs for Errors:
    • No errors related to rule loading.
    • The plugin is correctly loaded at startup.

The Question:

Do I need special configuration or properties in:

  1. The custom SonarQube plugin project (where I create the custom rules)?
  2. The analyzed project (where I run SonarQube analysis)?

If Gradle-based analysis (./gradlew sonar --info) detects custom issues but SonarQube for IDE does not, what could be missing?

Any guidance would be greatly appreciated!
Thanks in advance.
Marc

Hi Marc,

In fact, SonarLint isn’t supposed to run 3rd party plugins (including your private ones). Why? Because we want to limit our performance impact on the IDE and we can’t guarantee that for plugins we didn’t write.

Now there was a loophole previously that ran 3rd-party plugins if they declared SonarLint-Supported=true but we closed that after other plugin developers asked about their performance in the IDE.

As a side note, I’m not sure where you got these properties, but we don’t recognize or honor them:

 
HTH,
Ann

1 Like

Hi Ann,

Apologies for the late reply, and thanks for the clarification. That makes sense regarding the performance considerations for SonarLint. I appreciate the insight into the previous loophole and its closure.

Regarding the properties I mentioned, I must have come across them in older discussions or unofficial sources—thanks for confirming they are not recognized by SonarLint.

Thanks again for the details!

Best,

Marc