import org.sonar.api.server.ServerSide;
/**
+ * Export quality profile rules to a file
+ *
* @since 2.3
*/
@ScannerSide
this.name = name;
}
+ /**
+ * Export activated rule from a quality profile to a writer
+ *
+ * Note that the quality profile can contain some rules from other plugins. It should not fail in this case.
+ */
public abstract void exportProfile(RulesProfile profile, Writer writer);
public String getKey() {
return this;
}
+ /**
+ * Set the list of languages supported
+ * An empty value means that it will be available for every languages.
+ */
protected final ProfileExporter setSupportedLanguages(String... languages) {
supportedLanguages = (languages != null) ? languages : new String[0];
return this;
return mimeType;
}
+ /**
+ * Set the mime type of the exported file
+ */
public final ProfileExporter setMimeType(String s) {
if (StringUtils.isNotBlank(s)) {
this.mimeType = s;
import org.sonar.api.utils.ValidationMessages;
/**
+ * Create a quality profile from an external rules file.
+ *
* @since 2.3
*/
@ServerSide
this.importerName = name;
}
+ /**
+ * Import the profile from a reader.
+ *
+ * {@link ValidationMessages#warnings} can be used to return some warnings to the user, for instance when some rules doesn't exist.
+ * {@link ValidationMessages#errors} can be used when an unrecoverable error is generating during import. No quality profile will be created.
+ */
public abstract RulesProfile importProfile(Reader reader, ValidationMessages messages);
public String getKey() {
return this;
}
+ /**
+ * Set the list of languages supported
+ * An empty value means that it will be available for every languages.
+ */
protected final ProfileImporter setSupportedLanguages(String... languages) {
supportedLanguages = (languages != null) ? languages : new String[0];
return this;