diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-03-02 11:25:19 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-03-02 11:27:51 +0100 |
commit | a721d8ad86f6235f7f997e01665d897f6a9dbd12 (patch) | |
tree | b695bb45ba2c3e992adb6138a6d5c82e5c9d68bd /server | |
parent | 13ea3c2d0b37a90f78d4a1639611ff9186bd9613 (diff) | |
download | sonarqube-a721d8ad86f6235f7f997e01665d897f6a9dbd12.tar.gz sonarqube-a721d8ad86f6235f7f997e01665d897f6a9dbd12.zip |
SONAR-7347 Change the default quality gates to use new_vulnerabilities and new_bugs
Diffstat (limited to 'server')
2 files changed, 10 insertions, 10 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/RegisterQualityGates.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/RegisterQualityGates.java index 12f9a1a2f35..999c1461284 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/RegisterQualityGates.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/RegisterQualityGates.java @@ -24,10 +24,10 @@ import org.sonar.db.loadedtemplate.LoadedTemplateDao; import org.sonar.db.loadedtemplate.LoadedTemplateDto; import org.sonar.db.qualitygate.QualityGateDto; -import static org.sonar.api.measures.CoreMetrics.NEW_BLOCKER_VIOLATIONS_KEY; +import static org.sonar.api.measures.CoreMetrics.NEW_BUGS_KEY; import static org.sonar.api.measures.CoreMetrics.NEW_COVERAGE_KEY; -import static org.sonar.api.measures.CoreMetrics.NEW_CRITICAL_VIOLATIONS_KEY; import static org.sonar.api.measures.CoreMetrics.NEW_SQALE_DEBT_RATIO_KEY; +import static org.sonar.api.measures.CoreMetrics.NEW_VULNERABILITIES_KEY; import static org.sonar.db.qualitygate.QualityGateConditionDto.OPERATOR_GREATER_THAN; import static org.sonar.db.qualitygate.QualityGateConditionDto.OPERATOR_LESS_THAN; @@ -35,8 +35,8 @@ public class RegisterQualityGates implements Startable { private static final String BUILTIN_QUALITY_GATE = "SonarQube way"; private static final int LEAK_PERIOD = 1; - private static final String NEW_BLOCKER_ISSUE_ERROR_THRESHOLD = "0"; - private static final String NEW_CRITICAL_ISSUE_ERROR_THRESHOLD = "0"; + private static final String NEW_VULNERABILITIES_ERROR_THRESHOLD = "0"; + private static final String NEW_BUGS_ERROR_THRESHOLD = "0"; private static final String DEBT_ON_NEW_CODE_ERROR_THRESHOLD = "5"; private static final String NEW_COVERAGE_ERROR_THRESHOLD = "80"; @@ -67,8 +67,8 @@ public class RegisterQualityGates implements Startable { private void createBuiltinQualityGate() { QualityGateDto builtin = qualityGates.create(BUILTIN_QUALITY_GATE); - qualityGates.createCondition(builtin.getId(), NEW_BLOCKER_VIOLATIONS_KEY, OPERATOR_GREATER_THAN, null, NEW_BLOCKER_ISSUE_ERROR_THRESHOLD, LEAK_PERIOD); - qualityGates.createCondition(builtin.getId(), NEW_CRITICAL_VIOLATIONS_KEY, OPERATOR_GREATER_THAN, null, NEW_CRITICAL_ISSUE_ERROR_THRESHOLD, LEAK_PERIOD); + qualityGates.createCondition(builtin.getId(), NEW_VULNERABILITIES_KEY, OPERATOR_GREATER_THAN, null, NEW_VULNERABILITIES_ERROR_THRESHOLD, LEAK_PERIOD); + qualityGates.createCondition(builtin.getId(), NEW_BUGS_KEY, OPERATOR_GREATER_THAN, null, NEW_BUGS_ERROR_THRESHOLD, LEAK_PERIOD); qualityGates.createCondition(builtin.getId(), NEW_SQALE_DEBT_RATIO_KEY, OPERATOR_GREATER_THAN, null, DEBT_ON_NEW_CODE_ERROR_THRESHOLD, LEAK_PERIOD); qualityGates.createCondition(builtin.getId(), NEW_COVERAGE_KEY, OPERATOR_LESS_THAN, null, NEW_COVERAGE_ERROR_THRESHOLD, LEAK_PERIOD); qualityGates.setDefault(builtin.getId()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/RegisterQualityGatesTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/RegisterQualityGatesTest.java index 17c8a79fa18..05a4ac88467 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/RegisterQualityGatesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/RegisterQualityGatesTest.java @@ -32,10 +32,10 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; -import static org.sonar.api.measures.CoreMetrics.NEW_BLOCKER_VIOLATIONS_KEY; +import static org.sonar.api.measures.CoreMetrics.NEW_BUGS_KEY; import static org.sonar.api.measures.CoreMetrics.NEW_COVERAGE_KEY; -import static org.sonar.api.measures.CoreMetrics.NEW_CRITICAL_VIOLATIONS_KEY; import static org.sonar.api.measures.CoreMetrics.NEW_SQALE_DEBT_RATIO_KEY; +import static org.sonar.api.measures.CoreMetrics.NEW_VULNERABILITIES_KEY; import static org.sonar.db.qualitygate.QualityGateConditionDto.OPERATOR_GREATER_THAN; import static org.sonar.db.qualitygate.QualityGateConditionDto.OPERATOR_LESS_THAN; @@ -58,8 +58,8 @@ public class RegisterQualityGatesTest { verify(templateDao).countByTypeAndKey(templateType, templateName); verify(qualityGates).create(templateName); - verify(qualityGates).createCondition(eq(QGATE_ID), eq(NEW_BLOCKER_VIOLATIONS_KEY), eq(OPERATOR_GREATER_THAN), eq((String) null), eq("0"), eq(1)); - verify(qualityGates).createCondition(eq(QGATE_ID), eq(NEW_CRITICAL_VIOLATIONS_KEY), eq(OPERATOR_GREATER_THAN), eq((String) null), eq("0"), eq(1)); + verify(qualityGates).createCondition(eq(QGATE_ID), eq(NEW_BUGS_KEY), eq(OPERATOR_GREATER_THAN), eq((String) null), eq("0"), eq(1)); + verify(qualityGates).createCondition(eq(QGATE_ID), eq(NEW_VULNERABILITIES_KEY), eq(OPERATOR_GREATER_THAN), eq((String) null), eq("0"), eq(1)); verify(qualityGates).createCondition(eq(QGATE_ID), eq(NEW_SQALE_DEBT_RATIO_KEY), eq(OPERATOR_GREATER_THAN), eq((String) null), eq("5"), eq(1)); verify(qualityGates).createCondition(eq(QGATE_ID), eq(NEW_COVERAGE_KEY), eq(OPERATOR_LESS_THAN), eq((String) null), eq("80"), eq(1)); verify(qualityGates).setDefault(eq(QGATE_ID)); |