Class RulesDefinition.NewRule

  • Enclosing interface:

    public abstract static class RulesDefinition.NewRule
    extends java.lang.Object
    • Constructor Detail

      • NewRule

        public NewRule()
    • Method Detail

      • key

        public abstract java.lang.String key()
      • scope

        public abstract RuleScope scope()
      • setActivatedByDefault

        public abstract RulesDefinition.NewRule setActivatedByDefault​(boolean activatedByDefault)
        Should this rule be enabled by default. For example in SonarLint standalone.
      • setType

        public abstract RulesDefinition.NewRule setType​(RuleType t)
        The type as defined by the SonarQube Quality Model.
        When a plugin does not define rule type, then it is deduced from tags: Finally the "bug" and "security" tags are considered as reserved. They are silently removed from the final state of definition.
      • setHtmlDescription

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

        public abstract RulesDefinition.NewRule setMarkdownDescription​(@Nullable
                                                                       java.lang.String s)
        The optional description, in a restricted Markdown format, has no max length. It's exclusive with HTML description (see setHtmlDescription(String))
      • setMarkdownDescription

        public abstract RulesDefinition.NewRule setMarkdownDescription​(@Nullable
        Load description from a file available in classpath. Example : setMarkdownDescription(getClass().getResource("/myrepo/")
      • setDebtSubCharacteristic

        public abstract RulesDefinition.NewRule setDebtSubCharacteristic​(@Nullable
                                                                         java.lang.String s)
        in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model. This method does nothing. See
        SQALE sub-characteristic. See
        See Also:
        for constant values, setType(RuleType)
      • setGapDescription

        public abstract RulesDefinition.NewRule setGapDescription​(@Nullable
                                                                  java.lang.String s)
        For rules that use LINEAR or LINEAR_OFFSET remediation functions, the meaning of the function parameter (= "gap") must be set. This description explains what 1 point of "gap" represents for the rule.
        Example: for the "Insufficient condition coverage", this description for the remediation function gap multiplier/base effort would be something like "Effort to test one uncovered condition".
      • createParam

        public abstract RulesDefinition.NewParam createParam​(java.lang.String paramKey)
        Create a parameter with given unique key. Max length of key is 128 characters.
      • setInternalKey

        public abstract RulesDefinition.NewRule setInternalKey​(@Nullable
                                                               java.lang.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").