RulesProfile.create
Code IndexAdd Codota to your IDE (free)

Best code snippets using org.sonar.api.profiles.RulesProfile.create(Showing top 15 results out of 315)

  • Common ways to obtain RulesProfile
private void myMethod () {
RulesProfile r =
  • new RulesProfile()
  • String name;RulesProfile.create(name, language)
  • Smart code suggestions by Codota
}
origin: SonarSource/sonarqube

@Test
public void activateRuleWithDefaultPriority() {
 RulesProfile profile = RulesProfile.create();
 Rule rule = Rule.create("repo", "key1", "name1").setSeverity(RulePriority.CRITICAL);
 profile.activateRule(rule, null);
 assertThat(profile.getActiveRule("repo", "key1").getSeverity()).isEqualTo(RulePriority.CRITICAL);
}
origin: SonarSource/sonarqube

public RulesProfile parse(String repositoryKey, String profileName, String language, Collection<Class> annotatedClasses, ValidationMessages messages) {
 RulesProfile profile = RulesProfile.create(profileName, language);
 for (Class<?> aClass : annotatedClasses) {
  BelongsToProfile belongsToProfile = aClass.getAnnotation(BelongsToProfile.class);
  addRule(aClass, belongsToProfile, profile, repositoryKey, messages);
 }
 return profile;
}
origin: SonarSource/sonarqube

 @Override
 public RulesProfile createProfile(ValidationMessages validation) {
  validation.addErrorText("Foo");
  return RulesProfile.create("Profile with errors", "xoo");
 }
}
origin: SonarSource/sonarqube

@Test
public void searchRulesByConfigKey() {
 RulesProfile profile = RulesProfile.create();
 profile.activateRule(Rule.create("repo", "key1", "name1"), null);
 profile.activateRule(Rule.create("repo", "key2", "name2").setConfigKey("config2"), null);
 assertThat(profile.getActiveRuleByConfigKey("repo", "unknown")).isNull();
 assertThat(profile.getActiveRuleByConfigKey("repo", "config2").getRuleKey()).isEqualTo("key2");
}
origin: SonarSource/sonarqube

 @Override
 public RulesProfile createProfile(ValidationMessages messages) {
  RulesProfile profile = RulesProfile.create("Sonar way", Xoo2.KEY);

  profile.activateRule(Rule.create(XooRulesDefinition.XOO2_REPOSITORY, HasTagSensor.RULE_KEY), RulePriority.MAJOR);
  profile.activateRule(Rule.create(XooRulesDefinition.XOO2_REPOSITORY, OneIssuePerLineSensor.RULE_KEY), RulePriority.MINOR);

  return profile;
 }
}
origin: SonarSource/sonarqube

@Test
public void exportEmptyProfile() throws IOException, SAXException {
 Writer writer = new StringWriter();
 RulesProfile profile = RulesProfile.create("sonar way", "java");
 new XMLProfileSerializer().write(profile, writer);
 assertSimilarXml("exportEmptyProfile.xml", writer.toString());
}
origin: SonarSource/sonarqube

 @Override
 public RulesProfile importProfile(Reader reader, ValidationMessages messages) {
  messages.addWarningText("a warning");
  messages.addInfoText("an info");
  return RulesProfile.create();
 }
}
origin: SonarSource/sonarqube

 @Override
 public RulesProfile importProfile(Reader reader, ValidationMessages messages) {
  RulesProfile rulesProfile = RulesProfile.create();
  rulesProfile.activateRule(Rule.create(rule.getRepositoryKey(), rule.getRuleKey()), RulePriority.CRITICAL);
  return rulesProfile;
 }
}
origin: SonarSource/sonarqube

@Override
public Object clone() {
 RulesProfile clone = RulesProfile.create(getName(), getLanguage());
 clone.setDefaultProfile(getDefaultProfile());
 if (activeRules != null && !activeRules.isEmpty()) {
  clone.setActiveRules(activeRules.stream()
   .map(ar -> (ActiveRule) ar.clone())
   .collect(Collectors.toList()));
 }
 return clone;
}
origin: SonarSource/sonarqube

 @Override
 public RulesProfile createProfile(ValidationMessages validation) {
  RulesProfile profile1 = RulesProfile.create("Profile 1", "xoo");
  profile1.activateRule(Rule.create("repo1", "defaultSeverity"), null);
  profile1.activateRule(Rule.create("repo1", "overrideSeverity"), RulePriority.CRITICAL);
  Rule ruleWithParam = Rule.create("repo1", "overrideParam");
  ruleWithParam.setParams(Arrays.asList(new RuleParam(ruleWithParam, "param", "", "")));
  ActiveRule arWithParam = profile1.activateRule(ruleWithParam, null);
  arWithParam.setParameter("param", "value");
  return profile1;
 }
}
origin: SonarSource/sonarqube

@Test
public void exportProfile() throws IOException, SAXException {
 Writer writer = new StringWriter();
 RulesProfile profile = RulesProfile.create("sonar way", "java");
 profile.activateRule(Rule.create("checkstyle", "IllegalRegexp", "illegal regexp"), RulePriority.BLOCKER);
 new XMLProfileSerializer().write(profile, writer);
 assertSimilarXml("exportProfile.xml", writer.toString());
}
origin: SonarSource/sonarqube

 @Override
 public RulesProfile importProfile(Reader reader, ValidationMessages messages) {
  RulesProfile rulesProfile = RulesProfile.create();
  rulesProfile.activateRule(Rule.create(XooRulesDefinition.XOO_REPOSITORY, "x1"), RulePriority.CRITICAL);
  return rulesProfile;
 }
}
origin: SonarSource/sonarqube

 @Override
 public RulesProfile importProfile(Reader reader, ValidationMessages messages) {
  messages.addErrorText("error!");
  return RulesProfile.create();
 }
}
origin: SonarSource/sonarqube

 @Override
 public RulesProfile createProfile(ValidationMessages validation) {
  final RulesProfile profile = RulesProfile.create("Sonar way", Xoo.KEY);

  profile.activateRule(Rule.create(XooRulesDefinition.XOO_REPOSITORY, HasTagSensor.RULE_KEY), RulePriority.MAJOR);
  profile.activateRule(Rule.create(XooRulesDefinition.XOO_REPOSITORY, OneIssuePerLineSensor.RULE_KEY), RulePriority.INFO);
  profile.activateRule(Rule.create(XooRulesDefinition.XOO_REPOSITORY, OneIssuePerFileSensor.RULE_KEY), RulePriority.CRITICAL);

  return profile;
 }
}
origin: SonarSource/sonarqube

@Test
public void activateRuleWithSpecificPriority() {
 RulesProfile profile = RulesProfile.create();
 Rule rule = Rule.create("repo", "key1", "name1").setSeverity(RulePriority.CRITICAL);
 profile.activateRule(rule, RulePriority.MINOR);
 assertThat(profile.getActiveRule("repo", "key1").getSeverity()).isEqualTo(RulePriority.MINOR);
}
org.sonar.api.profilesRulesProfilecreate

Popular methods of RulesProfile

  • activateRule
  • getActiveRules
  • getName
  • getActiveRule
    Note: disabled rules are excluded.
  • getLanguage
  • setName
    Set the profile name.
  • setLanguage
    Set the profile language
  • setDefaultProfile
    Set whether this is the default profile for the language. The default profile is used when none is e
  • <init>
  • getDefaultProfile
  • getActiveRulesByRepository
    Get the active rules of a specific repository. Only enabled rules are selected. Disabled rules are e
  • getId
  • getActiveRulesByRepository,
  • getId,
  • equals,
  • hashCode,
  • setActiveRules,
  • addActiveRule,
  • getActiveRuleByConfigKey,
  • getParentName,
  • setParentName

Popular classes and methods

  • getSharedPreferences (Context)
  • onCreateOptionsMenu (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • ArrayList (java.util)
    Resizable-array implementation of the List interface.
  • LinkedList (java.util)
    Linked list implementation. [Sun docs] [http://java.sun.com/j2se/1.5.0/docs/api/java/util/LinkedList
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)