Java Code Examples for org.sonar.api.profiles.RulesProfile#getActiveRuleByConfigKey()
The following examples show how to use
org.sonar.api.profiles.RulesProfile#getActiveRuleByConfigKey() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PmdProfileImporterTest.java From sonar-p3c-pmd with MIT License | 5 votes |
@Test public void should_import_parameter() { Reader reader = read("/org/sonar/plugins/pmd/simple.xml"); RulesProfile profile = importer.importProfile(reader, messages); ActiveRule activeRule = profile.getActiveRuleByConfigKey("pmd", "rulesets/java/coupling.xml/ExcessiveImports"); assertThat(activeRule.getParameter("minimum")).isEqualTo("30"); }
Example 2
Source File: PmdProfileImporterTest.java From sonar-p3c-pmd with MIT License | 5 votes |
@Test public void should_import_default_priority() { Reader reader = read("/org/sonar/plugins/pmd/simple.xml"); RulesProfile profile = importer.importProfile(reader, messages); ActiveRule activeRule = profile.getActiveRuleByConfigKey("pmd", "rulesets/java/coupling.xml/ExcessiveImports"); assertThat(activeRule.getSeverity()).isSameAs(RulePriority.BLOCKER); }
Example 3
Source File: PmdProfileImporterTest.java From sonar-p3c-pmd with MIT License | 5 votes |
@Test public void should_import_priority() { Reader reader = read("/org/sonar/plugins/pmd/simple.xml"); RulesProfile profile = importer.importProfile(reader, messages); ActiveRule activeRule = profile.getActiveRuleByConfigKey("pmd", "rulesets/java/design.xml/UseNotifyAllInsteadOfNotify"); assertThat(activeRule.getSeverity()).isSameAs(RulePriority.MINOR); activeRule = profile.getActiveRuleByConfigKey("pmd", "rulesets/java/coupling.xml/CouplingBetweenObjects"); assertThat(activeRule.getSeverity()).isSameAs(RulePriority.CRITICAL); }
Example 4
Source File: PmdProfileImporterTest.java From sonar-p3c-pmd with MIT License | 5 votes |
@Test public void should_deal_with_unsupported_property() { Reader reader = read("/org/sonar/plugins/pmd/simple.xml"); RulesProfile profile = importer.importProfile(reader, messages); ActiveRule check = profile.getActiveRuleByConfigKey("pmd", "rulesets/java/coupling.xml/CouplingBetweenObjects"); assertThat(check.getParameter("threshold")).isNull(); assertThat(messages.getWarnings()).hasSize(2); }
Example 5
Source File: CheckstyleProfileImporterTest.java From sonar-checkstyle with GNU Lesser General Public License v3.0 | 5 votes |
@Test public void importParameters() { final Reader reader = new StringReader(CheckstyleTestUtils.getResourceContent( "/org/sonar/plugins/checkstyle/CheckstyleProfileImporterTest/simple.xml")); final RulesProfile profile = importer.importProfile(reader, messages); final ActiveRule javadocCheck = profile.getActiveRuleByConfigKey("checkstyle", "Checker/JavadocPackage"); assertThat(javadocCheck.getActiveRuleParams()).hasSize(2); assertThat(javadocCheck.getParameter("format")).isEqualTo("abcde"); assertThat(javadocCheck.getParameter("ignore")).isEqualTo("true"); // checkstyle internal parameter assertThat(javadocCheck.getParameter("severity")).isNull(); }
Example 6
Source File: CheckstyleProfileImporterTest.java From sonar-checkstyle with GNU Lesser General Public License v3.0 | 5 votes |
@Test public void propertiesShouldBeInherited() { final Reader reader = new StringReader(CheckstyleTestUtils.getResourceContent( "/org/sonar/plugins/checkstyle/CheckstyleProfileImporterTest/" + "inheritance_of_properties.xml")); final RulesProfile profile = importer.importProfile(reader, messages); final ActiveRule activeRule = profile.getActiveRuleByConfigKey("checkstyle", "Checker/TreeWalker/MissingOverride"); assertThat(activeRule.getSeverity()).isEqualTo(RulePriority.BLOCKER); assertThat(activeRule.getParameter("javaFiveCompatibility")).isEqualTo("true"); }
Example 7
Source File: CheckstyleProfileImporterTest.java From sonar-checkstyle with GNU Lesser General Public License v3.0 | 5 votes |
@Test public void importPriorities() { final Reader reader = new StringReader(CheckstyleTestUtils.getResourceContent( "/org/sonar/plugins/checkstyle/CheckstyleProfileImporterTest/simple.xml")); final RulesProfile profile = importer.importProfile(reader, messages); final ActiveRule javadocCheck = profile.getActiveRuleByConfigKey("checkstyle", "Checker/JavadocPackage"); assertThat(javadocCheck.getSeverity()).isEqualTo(RulePriority.BLOCKER); }
Example 8
Source File: CheckstyleProfileImporterTest.java From sonar-checkstyle with GNU Lesser General Public License v3.0 | 5 votes |
@Test public void priorityIsOptional() { final Reader reader = new StringReader(CheckstyleTestUtils.getResourceContent( "/org/sonar/plugins/checkstyle/" + "CheckstyleProfileImporterTest/simple.xml")); final RulesProfile profile = importer.importProfile(reader, messages); final ActiveRule activeRule = profile.getActiveRuleByConfigKey("checkstyle", "Checker/TreeWalker/EqualsHashCode"); // reuse the rule default priority assertThat(activeRule.getSeverity()).isEqualTo(RulePriority.BLOCKER); }