How can I create custom rules for Apex in Sonarqube

Is it possible to create custom rules for Apex in SonarQube? If so, please link any documentation which can be used for the same.

Hi,

Welcome to the community!

Per the docs, there’s no native functionality to add Apex rules. What you’ll need to do is run your rules outside analysis, generate a Generic Issue report and feed that into analysis.

 
HTH,
Ann

Hi Ann,

Can the existing grammar from the default sonar Apex plugin be reused in the developed custom plugin by using existing APIs or we need to write the entire grammar again for the custom plugin? I am developing this plugin in Java, let me know if both the Apex plugins will be able to work together?

Hi,

Sorry, but what you’re asking about is exactly (part of) the support that doesn’t exist. Unfortunately, you’ll need to start from scratch.

 
:frowning:
Ann