Package org.sonar.api.profiles
Class RulesProfile
- java.lang.Object
-
- org.sonar.api.profiles.RulesProfile
-
- All Implemented Interfaces:
java.lang.Cloneable
public class RulesProfile extends java.lang.Object implements java.lang.Cloneable
This class is badly named. It should be "QualityProfile". Indeed it does not relate only to rules but to metric thresholds too.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SONAR_WAY_FINDBUGS_NAME
Deprecated.in 4.2.static java.lang.String
SONAR_WAY_NAME
Deprecated.in 4.2.static java.lang.String
SUN_CONVENTIONS_NAME
Deprecated.in 4.2.
-
Constructor Summary
Constructors Constructor Description RulesProfile()
Deprecated.use the factory method create()RulesProfile(java.lang.String name, java.lang.String language)
Deprecated.since 2.3.RulesProfile(java.lang.String name, java.lang.String language, boolean defaultProfile, boolean provided)
Deprecated.since 2.3.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ActiveRule
activateRule(Rule rule, RulePriority optionalSeverity)
RulesProfile
addActiveRule(ActiveRule activeRule)
java.lang.Object
clone()
static RulesProfile
create()
static RulesProfile
create(java.lang.String name, java.lang.String language)
boolean
equals(java.lang.Object obj)
ActiveRule
getActiveRule(java.lang.String repositoryKey, java.lang.String ruleKey)
Note: disabled rules are excluded.ActiveRule
getActiveRule(Rule rule)
Note: disabled rules are excluded.ActiveRule
getActiveRuleByConfigKey(java.lang.String repositoryKey, java.lang.String configKey)
Note: disabled rules are excluded.java.util.List<ActiveRule>
getActiveRules()
java.util.List<ActiveRule>
getActiveRules(boolean acceptDisabledRules)
java.util.List<ActiveRule>
getActiveRules(RulePriority severity)
Note: disabled rules are excluded.java.util.List<ActiveRule>
getActiveRulesByRepository(java.lang.String repositoryKey)
Get the active rules of a specific repository.java.lang.Boolean
getDefaultProfile()
java.lang.Integer
getId()
java.lang.String
getLanguage()
java.lang.String
getName()
java.lang.String
getParentName()
Deprecated.in 6.5java.lang.Boolean
getUsed()
Deprecated.profile versioning is dropped in 4.4.int
getVersion()
Deprecated.profile versioning is dropped in 4.4.int
hashCode()
RulesProfile
removeActiveRule(ActiveRule activeRule)
void
setActiveRules(java.util.List<ActiveRule> activeRules)
Set the list of active rulesvoid
setDefaultProfile(java.lang.Boolean b)
Set whether this is the default profile for the language.RulesProfile
setLanguage(java.lang.String s)
Set the profile languageRulesProfile
setName(java.lang.String s)
Set the profile name.void
setParentName(java.lang.String parentName)
Deprecated.in 6.5RulesProfile
setUsed(java.lang.Boolean used)
Deprecated.profile versioning is dropped in 4.4.RulesProfile
setVersion(int version)
Deprecated.profile versioning is dropped in 4.4.java.lang.String
toString()
-
-
-
Field Detail
-
SONAR_WAY_NAME
@Deprecated public static final java.lang.String SONAR_WAY_NAME
Deprecated.in 4.2. Use your own constant.Name of the default profile "Sonar Way"- See Also:
- Constant Field Values
-
SONAR_WAY_FINDBUGS_NAME
@Deprecated public static final java.lang.String SONAR_WAY_FINDBUGS_NAME
Deprecated.in 4.2. Use your own constant.Name of the default java profile "Sonar way with Findbugs"- See Also:
- Constant Field Values
-
SUN_CONVENTIONS_NAME
@Deprecated public static final java.lang.String SUN_CONVENTIONS_NAME
Deprecated.in 4.2. Use your own constant.Name of the default java profile "Sun checks"- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RulesProfile
@Deprecated public RulesProfile()
Deprecated.use the factory method create()
-
RulesProfile
@Deprecated public RulesProfile(java.lang.String name, java.lang.String language)
Deprecated.since 2.3. Use the factory method create()
-
RulesProfile
@Deprecated public RulesProfile(java.lang.String name, java.lang.String language, boolean defaultProfile, boolean provided)
Deprecated.since 2.3. Use the factory method create()
-
-
Method Detail
-
getId
public java.lang.Integer getId()
-
getName
public java.lang.String getName()
- Returns:
- the profile name, unique by language.
-
setName
public RulesProfile setName(java.lang.String s)
Set the profile name.
-
getVersion
@Deprecated public int getVersion()
Deprecated.profile versioning is dropped in 4.4. Always returns -1.
-
setVersion
@Deprecated public RulesProfile setVersion(int version)
Deprecated.profile versioning is dropped in 4.4. Always returns -1.
-
getUsed
@CheckForNull @Deprecated public java.lang.Boolean getUsed()
Deprecated.profile versioning is dropped in 4.4. Always returns null.
-
setUsed
@Deprecated public RulesProfile setUsed(java.lang.Boolean used)
Deprecated.profile versioning is dropped in 4.4. Always returns -1.
-
getActiveRules
public java.util.List<ActiveRule> getActiveRules()
- Returns:
- the list of active rules
-
getActiveRules
public java.util.List<ActiveRule> getActiveRules(boolean acceptDisabledRules)
- Returns:
- the list of active rules
-
removeActiveRule
public RulesProfile removeActiveRule(ActiveRule activeRule)
-
addActiveRule
public RulesProfile addActiveRule(ActiveRule activeRule)
-
setActiveRules
public void setActiveRules(java.util.List<ActiveRule> activeRules)
Set the list of active rules
-
getDefaultProfile
public java.lang.Boolean getDefaultProfile()
- Returns:
- whether this is the default profile for the language
-
setDefaultProfile
public void setDefaultProfile(java.lang.Boolean b)
Set whether this is the default profile for the language. The default profile is used when none is explicitly defined when auditing a project.
-
getLanguage
public java.lang.String getLanguage()
- Returns:
- the profile language
-
setLanguage
public RulesProfile setLanguage(java.lang.String s)
Set the profile language
-
getParentName
@Deprecated @CheckForNull public java.lang.String getParentName()
Deprecated.in 6.5Does nothing.- Returns:
null
-
setParentName
@Deprecated public void setParentName(java.lang.String parentName)
Deprecated.in 6.5Does nothing.
-
getActiveRules
public java.util.List<ActiveRule> getActiveRules(RulePriority severity)
Note: disabled rules are excluded.- Returns:
- the list of active rules for a given severity
-
getActiveRulesByRepository
public java.util.List<ActiveRule> getActiveRulesByRepository(java.lang.String repositoryKey)
Get the active rules of a specific repository. Only enabled rules are selected. Disabled rules are excluded.
-
getActiveRule
@CheckForNull public ActiveRule getActiveRule(java.lang.String repositoryKey, java.lang.String ruleKey)
Note: disabled rules are excluded.- Returns:
- an active rule from a plugin key and a rule key if the rule is activated, null otherwise
-
getActiveRuleByConfigKey
@CheckForNull public ActiveRule getActiveRuleByConfigKey(java.lang.String repositoryKey, java.lang.String configKey)
Note: disabled rules are excluded.
-
getActiveRule
@CheckForNull public ActiveRule getActiveRule(Rule rule)
Note: disabled rules are excluded.
-
activateRule
public ActiveRule activateRule(Rule rule, @Nullable RulePriority optionalSeverity)
- Parameters:
optionalSeverity
- if null, then the default rule severity is used
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
create
public static RulesProfile create(java.lang.String name, java.lang.String language)
-
create
public static RulesProfile create()
-
-