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

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

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

origin: SonarSource/sonarqube

public Rule setUniqueKey(String repositoryKey, String key) {
 return setRepositoryKey(repositoryKey).setKey(key).setConfigKey(key);
}
origin: SonarSource/sonarqube

rule.setConfigKey(StringUtils.trim(cursor.collectDescendantText(false)));
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 List<Rule> createRules() {
  Rule rule = Rule.create("checkstyle", "ConstantName", "Constant Name");
  rule.setDescription("Checks that constant names conform to the specified format");
  rule.setConfigKey("Checker/TreeWalker/ConstantName");
  rule.setSeverity(RulePriority.BLOCKER);
  rule.setStatus(Rule.STATUS_BETA);
  rule.setTags(new String[] {"style", "clumsy"});
  rule.createParameter("format").setDescription("Regular expression").setDefaultValue("A-Z").setType("REGULAR_EXPRESSION");
  return Arrays.asList(rule);
 }
}
origin: SonarSource/sonarqube

.setLanguage(rule.getLanguage())
.setKey(rule.getRuleKey())
.setConfigKey(rule.getConfigKey())
.setIsTemplate(rule.isTemplate())
.setCreatedAt(new Date(rule.getCreatedAt()))
origin: SonarSource/sonarqube

.setLanguage(ruleDefinition.getLanguage())
.setKey(ruleDefinition.getRuleKey())
.setConfigKey(ruleDefinition.getConfigKey())
.setIsTemplate(ruleDefinition.isTemplate())
.setCreatedAt(new Date(ruleDefinition.getCreatedAt()))
origin: org.sonarsource.sonarqube/sonar-plugin-api

public Rule setUniqueKey(String repositoryKey, String key) {
 return setRepositoryKey(repositoryKey).setKey(key).setConfigKey(key);
}
origin: org.codehaus.sonar/sonar-plugin-api

public Rule setUniqueKey(String repositoryKey, String key) {
 return setRepositoryKey(repositoryKey).setKey(key).setConfigKey(key);
}
origin: org.sonarsource.sonarqube/sonar-batch

@CheckForNull
private static Rule toRule(@Nullable org.sonar.api.batch.rule.Rule ar) {
 return ar == null ? null : Rule.create(ar.key().repository(), ar.key().rule()).setName(ar.name()).setConfigKey(ar.internalKey());
}
origin: org.codehaus.sonar/sonar-deprecated

rule.setConfigKey(StringUtils.trim(cursor.collectDescendantText(false)));
origin: org.codehaus.sonar/sonar-batch

private RulesProfile select(QProfile qProfile, ActiveRules activeRules) {
 RulesProfile deprecatedProfile = new RulesProfile();
 // TODO deprecatedProfile.setVersion(qProfile.version());
 deprecatedProfile.setName(qProfile.getName());
 deprecatedProfile.setLanguage(qProfile.getLanguage());
 for (org.sonar.api.batch.rule.ActiveRule activeRule : ((DefaultActiveRules) activeRules).findByLanguage(qProfile.getLanguage())) {
  Rule rule = Rule.create(activeRule.ruleKey().repository(), activeRule.ruleKey().rule());
  rule.setConfigKey(activeRule.internalKey());
  ActiveRule deprecatedActiveRule = deprecatedProfile.activateRule(rule,
   RulePriority.valueOf(activeRule.severity()));
  for (Map.Entry<String, String> param : activeRule.params().entrySet()) {
   rule.createParameter(param.getKey());
   deprecatedActiveRule.setParameter(param.getKey(), param.getValue());
  }
 }
 return deprecatedProfile;
}
origin: org.sonarsource.sonarqube/sonar-batch

private static RulesProfile select(QProfile qProfile, ActiveRules activeRules) {
 RulesProfile deprecatedProfile = new RulesProfile();
 // TODO deprecatedProfile.setVersion(qProfile.version());
 deprecatedProfile.setName(qProfile.getName());
 deprecatedProfile.setLanguage(qProfile.getLanguage());
 for (org.sonar.api.batch.rule.ActiveRule activeRule : activeRules.findByLanguage(qProfile.getLanguage())) {
  Rule rule = Rule.create(activeRule.ruleKey().repository(), activeRule.ruleKey().rule());
  rule.setConfigKey(activeRule.internalKey());
  // SONAR-6706
  if (activeRule.templateRuleKey() != null) {
   rule.setTemplate(Rule.create(activeRule.ruleKey().repository(), activeRule.templateRuleKey()));
  }
  ActiveRule deprecatedActiveRule = deprecatedProfile.activateRule(rule,
   RulePriority.valueOf(activeRule.severity()));
  for (Map.Entry<String, String> param : activeRule.params().entrySet()) {
   rule.createParameter(param.getKey());
   deprecatedActiveRule.setParameter(param.getKey(), param.getValue());
  }
 }
 return deprecatedProfile;
}
origin: org.sonarsource.sonarqube/sonar-server

.setLanguage(rule.getLanguage())
.setKey(rule.getRuleKey())
.setConfigKey(rule.getConfigKey())
.setIsTemplate(rule.isTemplate())
.setCreatedAt(new Date(rule.getCreatedAt()))
origin: org.sonarsource.sonarqube/sonar-server

.setLanguage(ruleDefinition.getLanguage())
.setKey(ruleDefinition.getRuleKey())
.setConfigKey(ruleDefinition.getConfigKey())
.setIsTemplate(ruleDefinition.isTemplate())
.setCreatedAt(new Date(ruleDefinition.getCreatedAt()))
origin: fabriciocolombo/sonar-delphi

private static Rule createRepositoryRule(DelphiRule fRule) {
 RulePriority priority = severityFromLevel(fRule.getPriority());
 Rule rule = Rule.create(DelphiPmdConstants.REPOSITORY_KEY, fRule.getName(), fRule.getMessage()).setSeverity(
  priority);
 rule.setDescription(fRule.getDescription());
 rule.setTags(fRule.getTags());
 rule.setConfigKey(fRule.getClazz());
 List<RuleParam> ruleParams = new ArrayList<RuleParam>();
 if (fRule.getProperties() != null) {
  for (Property property : fRule.getProperties()) {
   RuleParam param = rule.createParameter()
    .setKey(property.getName())
    .setDescription(property.getName())
    .setType("s");
   if (NumberUtils.isNumber(property.getValue())) {
    param.setType("i");
   }
   param.setDefaultValue(property.getValue());
   ruleParams.add(param);
  }
 }
 rule.setParams(ruleParams);
 return rule;
}
origin: SonarSource/sonarlint-core

private static Rule toRuleNotNull(RulesDefinition.Rule ruleDef) {
 Rule rule = Rule.create(ruleDef.repository().key(), ruleDef.key())
  .setName(ruleDef.name())
  .setSeverity(RulePriority.valueOf(ruleDef.severity()))
  .setLanguage(ruleDef.repository().language())
  .setIsTemplate(ruleDef.template())
  .setConfigKey(ruleDef.internalKey());
 for (Param param : ruleDef.params()) {
  rule.createParameter(param.key()).setDefaultValue(param.defaultValue()).setDescription(param.description());
 }
 return rule;
}
origin: org.sonarsource.sonarqube/sonar-plugin-api

rule.setConfigKey(StringUtils.trim(cursor.collectDescendantText(false)));
org.sonar.api.rulesRulesetConfigKey

Javadoc

Sets the configuration key

Popular methods of Rule

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

Popular in Java

  • Updating database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • addToBackStack (FragmentTransaction)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Top Vim 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