Search in sources :

Example 1 with DiagnosticParameter

use of com.github._1c_syntax.bsl.languageserver.diagnostics.metadata.DiagnosticParameter in project sonar-bsl-plugin-community by 1c-syntax.

the class BSLLanguageServerRuleDefinition method setUpRuleParams.

private void setUpRuleParams(NewRule newRule) {
    diagnosticInfo.getParameters().forEach((DiagnosticParameterInfo diagnosticParameter) -> {
        RuleParamType ruleParamType = getRuleParamType(diagnosticParameter.getType());
        if (ruleParamType == null) {
            LOGGER.error(String.format("Can't cast rule param type %s for rule %s", diagnosticParameter.getType(), newRule.key()));
            return;
        }
        NewParam newParam = newRule.createParam(diagnosticParameter.getName());
        newParam.setType(ruleParamType);
        newParam.setDescription(diagnosticParameter.getDescription());
        newParam.setDefaultValue(diagnosticParameter.getDefaultValue().toString());
    });
}
Also used : DiagnosticParameterInfo(com.github._1c_syntax.bsl.languageserver.diagnostics.metadata.DiagnosticParameterInfo) RuleParamType(org.sonar.api.server.rule.RuleParamType)

Aggregations

DiagnosticParameterInfo (com.github._1c_syntax.bsl.languageserver.diagnostics.metadata.DiagnosticParameterInfo)1 RuleParamType (org.sonar.api.server.rule.RuleParamType)1