Interface ActiveRules


  • @Immutable
    @ScannerSide
    public interface ActiveRules
    The rules that are activated on the current project. Quality profiles are merged, so rules can relate to different repositories and languages.
    Use org.sonar.api.batch.rule.internal.ActiveRulesBuilder available in sonar-plugin-api-impl to instantiate this component in unit tests.
    Since:
    4.2
    • Method Detail

      • find

        @CheckForNull
        ActiveRule find​(RuleKey ruleKey)
        Find a ActiveRule by the associated rule key. null is returned if the rule does not exist or if the rule is not activated on any Quality profile associated with the project.
      • findAll

        java.util.Collection<ActiveRule> findAll()
        All the active rules, whatever their repository and related language.
      • findByRepository

        java.util.Collection<ActiveRule> findByRepository​(java.lang.String repository)
        The active rules for a given repository, like findbugs
      • findByLanguage

        java.util.Collection<ActiveRule> findByLanguage​(java.lang.String language)
        The active rules for a given language, like java
      • findByInternalKey

        @CheckForNull
        ActiveRule findByInternalKey​(java.lang.String repository,
                                     java.lang.String internalKey)
        Find a ActiveRule by the associated internal key. null is returned if the rule does not exist or if the rule is not activated on any Quality profile associated with the project.