org.sonar.api.server.rule
Class RulesDefinition.NewRule

java.lang.Object
  extended by org.sonar.api.server.rule.RulesDefinition.NewRule
Enclosing interface:
RulesDefinition

public static class RulesDefinition.NewRule
extends Object


Method Summary
 RulesDefinition.NewRule addTags(String... list)
           
 RulesDefinition.NewParam createParam(String paramKey)
           
 RulesDefinition.DebtRemediationFunctions debtRemediationFunctions()
          Factory of DebtRemediationFunction
 String key()
           
 RulesDefinition.NewParam param(String paramKey)
           
 Collection<RulesDefinition.NewParam> params()
           
 RulesDefinition.NewRule setDebtRemediationFunction(DebtRemediationFunction fn)
           
 RulesDefinition.NewRule setDebtSubCharacteristic(String s)
          SQALE sub-characteristic.
 RulesDefinition.NewRule setEffortToFixDescription(String s)
          For rules that use "Linear"/"Linear with offset" remediation functions, the meaning of the function parameter (= "effort to fix") must be set.
 RulesDefinition.NewRule setHtmlDescription(String s)
           
 RulesDefinition.NewRule setHtmlDescription(URL classpathUrl)
          Load description from a file available in classpath.
 RulesDefinition.NewRule setInternalKey(String s)
          Optional key that can be used by the rule engine.
 RulesDefinition.NewRule setName(String s)
          Required rule name
 RulesDefinition.NewRule setSeverity(String s)
           
 RulesDefinition.NewRule setStatus(RuleStatus status)
          Default value is RuleStatus.READY.
 RulesDefinition.NewRule setTags(String... list)
           
 RulesDefinition.NewRule setTemplate(boolean template)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

key

public String key()

setName

public RulesDefinition.NewRule setName(@Nullable
                                       String s)
Required rule name


setTemplate

public RulesDefinition.NewRule setTemplate(boolean template)

setSeverity

public RulesDefinition.NewRule setSeverity(String s)

setHtmlDescription

public RulesDefinition.NewRule setHtmlDescription(@Nullable
                                                  String s)

setHtmlDescription

public RulesDefinition.NewRule setHtmlDescription(@Nullable
                                                  URL classpathUrl)
Load description from a file available in classpath. Example : setHtmlDescription(getClass().getResource("/myrepo/Rule1234.html")


setStatus

public RulesDefinition.NewRule setStatus(RuleStatus status)
Default value is RuleStatus.READY. The value RuleStatus.REMOVED is not accepted and raises an IllegalArgumentException.


setDebtSubCharacteristic

public RulesDefinition.NewRule setDebtSubCharacteristic(@Nullable
                                                        String s)
SQALE sub-characteristic. See http://www.sqale.org

See Also:
for constant values

debtRemediationFunctions

public RulesDefinition.DebtRemediationFunctions debtRemediationFunctions()
Factory of DebtRemediationFunction


setDebtRemediationFunction

public RulesDefinition.NewRule setDebtRemediationFunction(@Nullable
                                                          DebtRemediationFunction fn)
See Also:
debtRemediationFunctions()

setEffortToFixDescription

public RulesDefinition.NewRule setEffortToFixDescription(@Nullable
                                                         String s)
For rules that use "Linear"/"Linear with offset" remediation functions, the meaning of the function parameter (= "effort to fix") must be set. This description explains what 1 point of "effort to fix" represents for the rule.

Example : : for the "Insufficient branch coverage", this description for the remediation function coefficient/offset would be something like "Effort to test one uncovered branch".


createParam

public RulesDefinition.NewParam createParam(String paramKey)

param

@CheckForNull
public RulesDefinition.NewParam param(String paramKey)

params

public Collection<RulesDefinition.NewParam> params()

addTags

public RulesDefinition.NewRule addTags(String... list)
See Also:
RuleTagFormat

setTags

public RulesDefinition.NewRule setTags(String... list)
See Also:
RuleTagFormat

setInternalKey

public RulesDefinition.NewRule setInternalKey(@Nullable
                                              String s)
Optional key that can be used by the rule engine. Not displayed in webapp. For example the Java Checkstyle plugin feeds this field with the internal path ("Checker/TreeWalker/AnnotationUseStyle").


toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009-2014 SonarSource. All Rights Reserved.