congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Rule.getConfigKey
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: SonarSource/sonarqube

/**
 * @return the config key the active rule belongs to
 */
public String getConfigKey() {
 return rule.getConfigKey();
}
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: SonarSource/sonarqube

@Test
public void should_success_finder_wrap() {
 // has Id
 assertThat(underTest.findById(rule1.getId()).getId()).isEqualTo(rule1.getId());
 // should_find_by_id
 assertThat(underTest.findById(rule3.getId()).getConfigKey()).isEqualTo("Checker/Treewalker/AnnotationUseStyleCheck");
 // should_not_find_disabled_rule_by_id
 assertThat(underTest.findById(rule2.getId())).isNull();
 // should_find_by_key
 Rule rule = underTest.findByKey("checkstyle", "com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck");
 assertThat(rule).isNotNull();
 assertThat(rule.getKey()).isEqualTo(("com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck"));
 assertThat(rule.isEnabled()).isTrue();
 // find_should_return_null_if_no_results
 assertThat(underTest.findByKey("checkstyle", "unknown")).isNull();
 assertThat(underTest.find(RuleQuery.create().withRepositoryKey("checkstyle").withConfigKey("unknown"))).isNull();
 // find_repository_rules
 assertThat(underTest.findAll(RuleQuery.create().withRepositoryKey("checkstyle"))).hasSize(2);
 // find_all_enabled
 assertThat(underTest.findAll(RuleQuery.create())).extracting("id").containsOnly(rule1.getId(), rule3.getId(), rule4.getId());
 assertThat(underTest.findAll(RuleQuery.create())).hasSize(3);
 // do_not_find_disabled_rules
 assertThat(underTest.findByKey("checkstyle", "DisabledCheck")).isNull();
 // do_not_find_unknown_rules
 assertThat(underTest.findAll(RuleQuery.create().withRepositoryKey("unknown_repository"))).isEmpty();
}
origin: SonarSource/sonarqube

newRule.setName(ruleName(repository.getKey(), rule));
newRule.setHtmlDescription(ruleDescription(repository.getKey(), rule));
newRule.setInternalKey(rule.getConfigKey());
newRule.setTemplate(rule.isTemplate());
newRule.setSeverity(rule.getSeverity().toString());
origin: org.sonarsource.sonarqube/sonar-plugin-api

/**
 * @return the config key the active rule belongs to
 */
public String getConfigKey() {
 return rule.getConfigKey();
}
origin: org.codehaus.sonar/sonar-plugin-api

/**
 * @return the config key the active rule belongs to
 */
public String getConfigKey() {
 return rule.getConfigKey();
}
origin: org.codehaus.sonar-plugins/sonar-web-plugin

public final String getRuleKey() {
 return rule.getConfigKey();
}
origin: org.codehaus.sonar-plugins.dotnet/sonar-dotnet-fxcop-plugin

private List<FxCopRule> transformIntoFxCopRules(List<ActiveRule> activeRulesByPlugin) {
 List<FxCopRule> result = new ArrayList<FxCopRule>();
 for (ActiveRule activeRule : activeRulesByPlugin) {
  // Extracts the rule's information
  Rule rule = activeRule.getRule();
  String configKey = rule.getConfigKey();
  String fileName = StringUtils.substringAfter(configKey, "@");
  String name = StringUtils.substringBefore(configKey, "@");
  // Creates the FxCop rule
  FxCopRule fxCopRule = new FxCopRule();
  fxCopRule.setEnabled(true);
  fxCopRule.setFileName(fileName);
  fxCopRule.setName(name);
  RulePriority priority = activeRule.getSeverity();
  if (priority != null) {
   fxCopRule.setPriority(priority.name().toLowerCase());
  }
  result.add(fxCopRule);
 }
 return result;
}
origin: org.codehaus.sonar.plugins/sonar-pmd-plugin

private PmdRuleset createPmdRuleset(String repositoryKey, List<ActiveRule> activeRules, String profileName) {
 PmdRuleset ruleset = new PmdRuleset(profileName);
 for (ActiveRule activeRule : activeRules) {
  if (activeRule.getRule().getRepositoryKey().equals(repositoryKey)) {
   String configKey = activeRule.getRule().getConfigKey();
   PmdRule rule = new PmdRule(configKey, PmdLevelUtils.toLevel(activeRule.getSeverity()));
   if ((activeRule.getActiveRuleParams() != null) && !activeRule.getActiveRuleParams().isEmpty()) {
    List<PmdProperty> properties = new ArrayList<PmdProperty>();
    for (ActiveRuleParam activeRuleParam : activeRule.getActiveRuleParams()) {
     properties.add(new PmdProperty(activeRuleParam.getRuleParam().getKey(), activeRuleParam.getValue()));
    }
    rule.setProperties(properties);
   }
   ruleset.addRule(rule);
   processXPathRule(activeRule.getRuleKey(), rule);
  }
 }
 return ruleset;
}
origin: jensgerdes/sonar-pmd

  private PmdRuleSet createPmdRuleset(String repositoryKey, List<ActiveRule> activeRules) {
    PmdRuleSet ruleset = new PmdRuleSet();
    ruleset.setName(repositoryKey);
    ruleset.setDescription(String.format("Sonar Profile: %s", repositoryKey));
    for (ActiveRule activeRule : activeRules) {
      if (activeRule.getRule().getRepositoryKey().equals(repositoryKey)) {
        String configKey = activeRule.getRule().getConfigKey();
        PmdRule rule = new PmdRule(configKey, PmdLevelUtils.toLevel(activeRule.getSeverity()));
        addRuleProperties(activeRule, rule);
        ruleset.addRule(rule);
        processXPathRule(activeRule.getRuleKey(), rule);
      }
    }
    return ruleset;
  }
}
origin: mrprince/sonar-p3c-pmd

private PmdRuleset createPmdRuleset(String repositoryKey, List<ActiveRule> activeRules, String profileName) {
 PmdRuleset ruleset = new PmdRuleset(profileName);
 for (ActiveRule activeRule : activeRules) {
  if (activeRule.getRule().getRepositoryKey().equals(repositoryKey)) {
   String configKey = activeRule.getRule().getConfigKey();
   PmdRule rule = new PmdRule(configKey, PmdLevelUtils.toLevel(activeRule.getSeverity()));
   if ((activeRule.getActiveRuleParams() != null) && !activeRule.getActiveRuleParams().isEmpty()) {
    List<PmdProperty> properties = new ArrayList<>();
    for (ActiveRuleParam activeRuleParam : activeRule.getActiveRuleParams()) {
     properties.add(new PmdProperty(activeRuleParam.getRuleParam().getKey(), activeRuleParam.getValue()));
    }
    rule.setProperties(properties);
   }
   ruleset.addRule(rule);
   processXPathRule(activeRule.getRuleKey(), rule);
  }
 }
 return ruleset;
}
origin: org.codehaus.sonar-plugins/sonar-php-plugin

/**
 * Materialize the current active rule set for the profile
 * 
 * @param activeRules
 * @param profileName
 * @return
 */
protected PmdRuleset createPmdRuleset(List<ActiveRule> activeRules, String profileName) {
 PmdRuleset ruleset = new PmdRuleset(profileName);
 for (ActiveRule activeRule : activeRules) {
  if (activeRule.getRule().getPluginName().equals(PhpmdRuleRepository.PHPMD_REPOSITORY_KEY)) {
   String configKey = activeRule.getRule().getConfigKey();
   PmdRule rule = new PmdRule(configKey, mapper.to(activeRule.getPriority()));
   List<ActiveRuleParam> activeRuleParams = activeRule.getActiveRuleParams();
   if (activeRuleParams != null && !activeRuleParams.isEmpty()) {
    List<PmdProperty> properties = new ArrayList<PmdProperty>();
    for (ActiveRuleParam activeRuleParam : activeRuleParams) {
     properties.add(new PmdProperty(activeRuleParam.getRuleParam().getKey(), activeRuleParam.getValue()));
    }
    rule.setProperties(properties);
   }
   ruleset.addRule(rule);
   processXPathRule(activeRule.getRuleKey(), rule);
  }
 }
 return ruleset;
}
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();
}
origin: org.sonarsource.sonarqube/sonar-server

newRule.setName(ruleName(repository.getKey(), rule));
newRule.setHtmlDescription(ruleDescription(repository.getKey(), rule));
newRule.setInternalKey(rule.getConfigKey());
newRule.setTemplate(rule.isTemplate());
newRule.setSeverity(rule.getSeverity().toString());
org.sonar.api.rulesRulegetConfigKey

Popular methods of Rule

  • create
    Create with all required fields
  • getKey
  • setConfigKey
    Sets the configuration key
  • 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

  • Running tasks concurrently on multiple threads
  • scheduleAtFixedRate (Timer)
  • getContentResolver (Context)
  • setContentView (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • ImageIO (javax.imageio)
  • From CI to AI: The AI layer in your organization
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