use of com.cflint.config.CFLintPluginInfo.PluginInfoRule.PluginParameter in project CFLint by cflint.
the class ConfigUtils method loadPlugin.
public static CFLintScanner loadPlugin(final PluginInfoRule ruleInfo) {
final String shortClassName = ruleInfo.getClassName() != null && ruleInfo.getClassName().trim().length() > 0 ? ruleInfo.getClassName() : ruleInfo.getName();
final String className = PLUGIN_PACKAGE + "." + shortClassName.trim();
try {
final Class<?> pluginClass = Class.forName(className);
final CFLintScanner plugin = (CFLintScanner) pluginClass.newInstance();
for (final PluginParameter param : ruleInfo.getParameters()) {
plugin.setParameter(param.getName(), param.getValue());
}
ruleInfo.setPluginInstance(plugin);
return plugin;
} catch (final Exception e) {
log.error("Could not load plugin " + className, e);
}
return null;
}
Aggregations