Making default QualityProfile within Plugin

I am creating a plugin with custom written rules and with QualityProfile implemented

public class QualityProfile implements BuiltInQualityProfilesDefinition {

    public static final String QUALITYPROFILE = "SEC-AI";
    @Override
    public void define(Context context) {

        NewBuiltInQualityProfile profile = context.createBuiltInQualityProfile(QUALITYPROFILE, "java");


        NewBuiltInActiveRule rule1 = profile.activateRule(CogniCryptRulesDefinition.REPOSITORY,"javax.crypto.Cipher" );
        rule1.overrideSeverity("CRITICAL");

        profile.setDefault(true);

        profile.done();

    }
}

Problem here is when i start analysis this custom QualityProfile has to be applied for analysis
But not via defining inside of sonar.property file or cmd arguments

I want to set QualityProfile programatically within Plugin itself but not sure how we can do this.

Is there any documentation that I can follow or some code snippet example ?

Thanks

Hi,

Are you defining a new language? If so, you must provide a default Quality Profile which,… by default becomes The Default. :joy:

 
Ann