@Immutable
public static class RulesDefinition.Rule
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
boolean |
activatedByDefault()
Should this rule be enabled by default.
|
DebtRemediationFunction |
debtRemediationFunction() |
java.lang.String |
debtSubCharacteristic()
Deprecated.
in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model.
null is
always returned. See https://jira.sonarsource.com/browse/MMF-184 |
java.util.Set<RuleKey> |
deprecatedRuleKeys()
Deprecated rules keys for this rule.
|
java.lang.String |
effortToFixDescription()
Deprecated.
since 5.5, replaced by
gapDescription() |
boolean |
equals(java.lang.Object o) |
java.lang.String |
gapDescription() |
int |
hashCode() |
java.lang.String |
htmlDescription() |
java.lang.String |
internalKey() |
java.lang.String |
key() |
java.lang.String |
markdownDescription() |
java.lang.String |
name() |
RulesDefinition.Param |
param(java.lang.String key) |
java.util.List<RulesDefinition.Param> |
params() |
java.lang.String |
pluginKey() |
RulesDefinition.Repository |
repository() |
RuleScope |
scope() |
java.util.Set<java.lang.String> |
securityStandards() |
java.lang.String |
severity() |
RuleStatus |
status() |
java.util.Set<java.lang.String> |
tags() |
boolean |
template() |
java.lang.String |
toString() |
RuleType |
type() |
public RulesDefinition.Repository repository()
@CheckForNull public java.lang.String pluginKey()
public java.lang.String key()
public java.lang.String name()
public RuleScope scope()
public RuleType type()
RulesDefinition.NewRule.setType(RuleType)
public java.lang.String severity()
@CheckForNull public java.lang.String htmlDescription()
@CheckForNull public java.lang.String markdownDescription()
public boolean template()
public boolean activatedByDefault()
public RuleStatus status()
@CheckForNull @Deprecated public java.lang.String debtSubCharacteristic()
null
is
always returned. See https://jira.sonarsource.com/browse/MMF-184type()
@CheckForNull public DebtRemediationFunction debtRemediationFunction()
@Deprecated @CheckForNull public java.lang.String effortToFixDescription()
gapDescription()
@CheckForNull public java.lang.String gapDescription()
@CheckForNull public RulesDefinition.Param param(java.lang.String key)
public java.util.List<RulesDefinition.Param> params()
public java.util.Set<java.lang.String> tags()
public java.util.Set<java.lang.String> securityStandards()
public java.util.Set<RuleKey> deprecatedRuleKeys()
If you want to rename the key of a rule or change its repository or both, register the rule's previous repository
and key (see addDeprecatedRuleKey
). This will allow
SonarQube to support "issue re-keying" for this rule.
If the repository and/or key of an existing rule is changed without declaring deprecated keys, existing issues for this rule, created under the rule's previous repository and/or key, will be closed and new ones will be created under the issue's new repository and/or key.
Several deprecated keys can be provided to allow SonarQube to support several key (and/or repository) changes
across multiple versions of a plugin.
Consider the following use case scenario:
Foo:A
is defined in version 1 of the plugin
NewRepository newRepository = context.createRepository("Foo", "my_language"); NewRule r = newRepository.createRule("A");
NewRepository newRepository = context.createRepository("Foo", "my_language"); NewRule r = newRepository.createRule("B") .addDeprecatedRuleKey("Foo", "A");
Foo:B
, are moved to a new repository Bar in version 3 of the plugin
NewRepository newRepository = context.createRepository("Bar", "my_language"); NewRule r = newRepository.createRule("B") .addDeprecatedRuleKey("Foo", "A") .addDeprecatedRuleKey("Bar", "B");
Finally, repository/key pairs must be unique across all rules and their deprecated keys.
This implies that no rule can use the same repository and key as the deprecated key of another rule. This
uniqueness applies across plugins.
Note that, even though this method returns a Set
, its elements are ordered according to calls to
addDeprecatedRuleKey
. This allows to describe the history
of a rule's repositories and keys over time. Oldest repository and key must be specified first.
RulesDefinition.NewRule.addDeprecatedRuleKey(String, String)
@CheckForNull public java.lang.String internalKey()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object