Publish detailed scan results to slack

Hi.

We would like to publish scan results to our slack channel and are successfully doing so using the PostProjectAnalysisTask. However, the ProjectAnalysis object does not contain data about how
many new issues there are of a certain severity. Other plugins like quboo-sonarqube-plugin
have solved it by calling the SonarQube REST api from within the PostProjectAnalysisTask to get hold of extra data about the scan. Is this the preferred way to solve it or does Sonarqube’s plugin SDK provide a better way to get details about the scan?

The downside for calling the REST api is that you need to create an accesstoken for sonarqube that you provide to the plugin and it feels a little bit like an inception.

You can probably use https://github.com/SonarSource/sonarqube/blob/master/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/LocalConnector.java

Hi @Julien_HENRY , How can I get local connector in this context?

public class TestTask implements PostProjectAnalysisTask {
    @Override
    public void finished(Context context) {
        ProjectAnalysis projectAnalysis = context.getProjectAnalysis();
        String projectKey = projectAnalysis.getProject().getKey();
        CeTask ceTask =  projectAnalysis.getCeTask();
        // How can I get local connector in this context?
        WsClient wsClient = WsClientFactories.getLocal().newClient(LocalConnector);
    }
}