Tabnine Logo
Rule.getDescription
Code IndexAdd Tabnine to your IDE (free)

How to use
getDescription
method
in
org.sonar.api.rules.Rule

Best Java code snippets using org.sonar.api.rules.Rule.getDescription (Showing top 11 results out of 315)

origin: SonarSource/sonarqube

@CheckForNull
private String ruleDescription(String repositoryKey, org.sonar.api.rules.Rule rule) {
 String description = i18n.getDescription(repositoryKey, rule.getKey());
 if (StringUtils.isNotBlank(description)) {
  return description;
 }
 return StringUtils.defaultIfBlank(rule.getDescription(), null);
}
origin: SonarSource/sonarqube

@Test
public void rule_without_key() {
 List<Rule> rules = parseAnnotatedClass(RuleWithoutKey.class);
 assertThat(rules).hasSize(1);
 Rule rule = rules.get(0);
 assertThat(rule.getKey()).isEqualTo(RuleWithoutKey.class.getCanonicalName());
 assertThat(rule.getName()).isEqualTo("foo");
 assertThat(rule.getDescription()).isNull();
 assertThat(rule.getSeverity()).isEqualTo(RulePriority.MAJOR);
}
origin: SonarSource/sonarqube

@Test
public void overridden_rule() {
 List<Rule> rules = parseAnnotatedClass(OverridingRule.class);
 assertThat(rules).hasSize(1);
 Rule rule = rules.get(0);
 assertThat(rule.getKey()).isEqualTo("overriding_foo");
 assertThat(rule.getName()).isEqualTo("Overriding Foo");
 assertThat(rule.getDescription()).isNull();
 assertThat(rule.getSeverity()).isEqualTo(RulePriority.MAJOR);
 assertThat(rule.getParams()).hasSize(2);
}
origin: SonarSource/sonarqube

@Test
public void rule_without_name_nor_description() {
 List<Rule> rules = parseAnnotatedClass(RuleWithoutNameNorDescription.class);
 assertThat(rules).hasSize(1);
 Rule rule = rules.get(0);
 assertThat(rule.getKey()).isEqualTo("foo");
 assertThat(rule.getSeverity()).isEqualTo(RulePriority.MAJOR);
 assertThat(rule.getName()).isNull();
 assertThat(rule.getDescription()).isNull();
}
origin: SonarSource/sonarqube

@Test
public void rule_with_property() {
 List<Rule> rules = parseAnnotatedClass(RuleWithProperty.class);
 assertThat(rules).hasSize(1);
 Rule rule = rules.get(0);
 assertThat(rule.getKey()).isEqualTo("foo");
 assertThat(rule.getName()).isEqualTo("bar");
 assertThat(rule.getDescription()).isEqualTo("Foo Bar");
 assertThat(rule.getSeverity()).isEqualTo(RulePriority.BLOCKER);
 assertThat(rule.getStatus()).isEqualTo(Rule.STATUS_READY);
 assertThat(rule.getParams()).hasSize(1);
 RuleParam prop = rule.getParam("property");
 assertThat(prop.getKey()).isEqualTo("property");
 assertThat(prop.getDescription()).isEqualTo("Ignore ?");
 assertThat(prop.getDefaultValue()).isEqualTo("false");
 assertThat(prop.getType()).isEqualTo(PropertyType.STRING.name());
}
origin: SonarSource/sonarqube

@Test
public void description_should_be_cleaned() {
 Rule rule = Rule.create().setDescription("    my description         ");
 Assert.assertEquals("my description", rule.getDescription());
 rule.setDescription(null);
 assertThat(rule.getDescription()).isNull();
}
origin: SonarSource/sonarqube

 private void verifyRule(Rule rule, RuleDefinitionDto ruleDefinition, RuleParamDto ruleParam) {
  assertThat(rule).isNotNull();

  assertThat(rule.getName()).isEqualTo(ruleDefinition.getName());
  assertThat(rule.getLanguage()).isEqualTo(ruleDefinition.getLanguage());
  assertThat(rule.getKey()).isEqualTo(ruleDefinition.getRuleKey());
  assertThat(rule.getConfigKey()).isEqualTo(ruleDefinition.getConfigKey());
  assertThat(rule.isTemplate()).isEqualTo(ruleDefinition.isTemplate());
  assertThat(rule.getCreatedAt().getTime()).isEqualTo(ruleDefinition.getCreatedAt());
  assertThat(rule.getUpdatedAt().getTime()).isEqualTo(ruleDefinition.getUpdatedAt());
  assertThat(rule.getRepositoryKey()).isEqualTo(ruleDefinition.getRepositoryKey());
  assertThat(rule.getSeverity().name()).isEqualTo(ruleDefinition.getSeverityString());
  assertThat(rule.getSystemTags()).isEqualTo(ruleDefinition.getSystemTags().stream().toArray(String[]::new));
  assertThat(rule.getTags()).isEmpty();
  assertThat(rule.getId()).isEqualTo(ruleDefinition.getId());
  assertThat(rule.getDescription()).isEqualTo(ruleDefinition.getDescription());

  assertThat(rule.getParams()).hasSize(1);
  org.sonar.api.rules.RuleParam param = rule.getParams().iterator().next();
  assertThat(param.getRule()).isSameAs(rule);
  assertThat(param.getKey()).isEqualTo(ruleParam.getName());
  assertThat(param.getDescription()).isEqualTo(ruleParam.getDescription());
  assertThat(param.getType()).isEqualTo(ruleParam.getType());
  assertThat(param.getDefaultValue()).isEqualTo(ruleParam.getDefaultValue());
 }
}
origin: org.codehaus.sonar-plugins.xml/sonar-xml-plugin

protected final void createViolation(Integer linePosition) {
 createViolation(linePosition, rule.getDescription());
}
origin: org.sonarsource.sonarqube/sonar-server

@CheckForNull
private String ruleDescription(String repositoryKey, org.sonar.api.rules.Rule rule) {
 String description = i18n.getDescription(repositoryKey, rule.getKey());
 if (StringUtils.isNotBlank(description)) {
  return description;
 }
 return StringUtils.defaultIfBlank(rule.getDescription(), null);
}
origin: octo-technology/sonar-objective-c

  final int index = rule.getDescription().lastIndexOf(
      previousLine);
  if (index > 0) {
    rule.setDescription(rule.getDescription().substring(0,
        index));
if (inDescription) {
  line = ruleDescriptionLink(line);
  rule.setDescription(rule.getDescription() + "<br>" + line);
origin: fabriciocolombo/sonar-delphi

@Override
public void define(Context context) {
 NewRepository repository = context
  .createRepository(DelphiPmdConstants.REPOSITORY_KEY, DelphiLanguage.KEY)
  .setName(DelphiPmdConstants.REPOSITORY_NAME);
 List<org.sonar.api.rules.Rule> rules = DelphiRulesUtils.getInitialReferential();
 // TODO Review
 // https://github.com/SonarCommunity/sonar-pmd/blob/master/src/main/java/org/sonar/plugins/pmd/PmdRulesDefinition.java
 for (org.sonar.api.rules.Rule rule : rules) {
  NewRule newRule = repository.createRule(rule.getKey())
   .setName(rule.getName())
   .setHtmlDescription(rule.getDescription())
   .setInternalKey(rule.getConfigKey())
   .setSeverity(rule.getSeverity().name());
  for (RuleParam param : rule.getParams()) {
   newRule.createParam(param.getKey())
    .setDefaultValue(param.getDefaultValue())
    .setType(RuleParamType.parse(param.getType()))
    .setDescription(param.getDescription());
  }
 }
 SqaleXmlLoader.load(repository, "/org/sonar/plugins/delphi/sqale/delphi-model.xml");
 repository.done();
}
org.sonar.api.rulesRulegetDescription

Popular methods of Rule

  • create
    Create with all required fields
  • getKey
  • getConfigKey
  • setConfigKey
    Sets the configuration key
  • setName
    Sets the rule name
  • setSeverity
  • getName
  • getRepositoryKey
  • ruleKey
  • setDescription
    Sets the rule description
  • createParameter
  • getSeverity
  • createParameter,
  • getSeverity,
  • setTags,
  • <init>,
  • getParam,
  • getParams,
  • setKey,
  • setStatus,
  • setRepositoryKey

Popular in Java

  • Reading from database using SQL prepared statement
  • getExternalFilesDir (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • addToBackStack (FragmentTransaction)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Kernel (java.awt.image)
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now