diff options
10 files changed, 38 insertions, 48 deletions
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatuses.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatuses.java index 8cd5db78a77..ca988261401 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatuses.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatuses.java @@ -45,8 +45,8 @@ public class UpdateSecurityHotspotsStatuses extends DataChange { private static final String STATUS_REOPENED = "REOPENED"; private static final String STATUS_RESOLVED = "RESOLVED"; - private static final String STATUS_TO_REVIEW = "TOREVIEW"; - private static final String STATUS_IN_REVIEW = "INREVIEW"; + private static final String STATUS_TO_REVIEW = "TO_REVIEW"; + private static final String STATUS_IN_REVIEW = "IN_REVIEW"; private static final String STATUS_REVIEWED = "REVIEWED"; private static final int RULE_TYPE_SECURITY_HOTSPOT = 4; diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatusesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatusesTest.java index cefd7097832..a3b10a97883 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatusesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatusesTest.java @@ -68,8 +68,8 @@ public class UpdateSecurityHotspotsStatusesTest { underTest.execute(); assertIssues( - tuple(issue1, "TOREVIEW", null, 4, NOW), - tuple(issue2, "TOREVIEW", null, 4, NOW), + tuple(issue1, "TO_REVIEW", null, 4, NOW), + tuple(issue2, "TO_REVIEW", null, 4, NOW), // Not updated tuple(issue3, "OPEN", null, 1, PAST), tuple(issue4, "REOPENED", null, 2, PAST), @@ -89,7 +89,7 @@ public class UpdateSecurityHotspotsStatusesTest { underTest.execute(); assertIssues( - tuple(issue1, "INREVIEW", null, 4, NOW), + tuple(issue1, "IN_REVIEW", null, 4, NOW), tuple(issue2, "REVIEWED", "FIXED", 4, NOW), // Not updated tuple(issue3, "RESOLVED", "FIXED", 1, PAST), @@ -109,8 +109,8 @@ public class UpdateSecurityHotspotsStatusesTest { underTest.execute(); assertIssueChanges( - tuple(issue1, "diff", "status=REOPENED|TOREVIEW,resolution=", NOW, NOW, NOW), - tuple(issue3, "diff", "status=RESOLVED|INREVIEW,resolution=FIXED|", NOW, NOW, NOW), + tuple(issue1, "diff", "status=REOPENED|TO_REVIEW,resolution=", NOW, NOW, NOW), + tuple(issue3, "diff", "status=RESOLVED|IN_REVIEW,resolution=FIXED|", NOW, NOW, NOW), tuple(issue4, "diff", "status=RESOLVED|REVIEWED,resolution=WONTFIX|FIXED", NOW, NOW, NOW)); } @@ -159,15 +159,15 @@ public class UpdateSecurityHotspotsStatusesTest { underTest.execute(); assertIssues( - tuple(issue1, "TOREVIEW", null, 4, NOW), - tuple(issue2, "TOREVIEW", null, 4, NOW)); + tuple(issue1, "TO_REVIEW", null, 4, NOW), + tuple(issue2, "TO_REVIEW", null, 4, NOW)); // Set a new date for NOW in order to check that issues has not been updated again system2.setNow(NOW + 1_000_000_000L); underTest.execute(); assertIssues( - tuple(issue1, "TOREVIEW", null, 4, NOW), - tuple(issue2, "TOREVIEW", null, 4, NOW)); + tuple(issue1, "TO_REVIEW", null, 4, NOW), + tuple(issue2, "TO_REVIEW", null, 4, NOW)); } @Test diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/State.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/State.java index 7cd8d5308f3..5d2405f8f38 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/State.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/State.java @@ -27,7 +27,6 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; import javax.annotation.CheckForNull; -import org.apache.commons.lang.StringUtils; import org.sonar.api.issue.Issue; public class State { @@ -36,7 +35,6 @@ public class State { public State(String key, Transition[] outTransitions) { Preconditions.checkArgument(!Strings.isNullOrEmpty(key), "State key must be set"); - Preconditions.checkArgument(StringUtils.isAllUpperCase(key), "State key must be upper-case"); checkDuplications(outTransitions, key); this.key = key; diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/StateTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/StateTest.java index 8793705984f..0e7c438bad9 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/StateTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/StateTest.java @@ -28,7 +28,7 @@ public class StateTest { @Rule public ExpectedException expectedException = ExpectedException.none(); - Transition t1 = Transition.builder("close").from("OPEN").to("CLOSED").build(); + private Transition t1 = Transition.builder("close").from("OPEN").to("CLOSED").build(); @Test public void key_should_be_set() { @@ -39,14 +39,6 @@ public class StateTest { } @Test - public void key_should_be_upper_case() { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("State key must be upper-case"); - - new State("close", new Transition[0]); - } - - @Test public void no_duplicated_out_transitions() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Transition 'close' is declared several times from the originating state 'CLOSE'"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionFacetsTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionFacetsTest.java index 8ef8027a667..1d5d65750a9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionFacetsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionFacetsTest.java @@ -115,7 +115,7 @@ public class SearchActionFacetsTest { .executeProtobuf(SearchWsResponse.class); Map<String, Number> expectedStatuses = ImmutableMap.<String, Number>builder().put("OPEN", 1L).put("CONFIRMED", 0L) - .put("REOPENED", 0L).put("RESOLVED", 0L).put("CLOSED", 0L).put("INREVIEW", 0L).put("TOREVIEW", 0L).put("REVIEWED", 0L).build(); + .put("REOPENED", 0L).put("RESOLVED", 0L).put("CLOSED", 0L).put("IN_REVIEW", 0L).put("TO_REVIEW", 0L).put("REVIEWED", 0L).build(); assertThat(response.getFacets().getFacetsList()) .extracting(Common.Facet::getProperty, facet -> facet.getValuesList().stream().collect(toMap(FacetValue::getVal, FacetValue::getCount))) @@ -153,7 +153,7 @@ public class SearchActionFacetsTest { .executeProtobuf(SearchWsResponse.class); Map<String, Number> expectedStatuses = ImmutableMap.<String, Number>builder().put("OPEN", 10L).put("CONFIRMED", 0L) - .put("REOPENED", 0L).put("RESOLVED", 0L).put("CLOSED", 0L).put("INREVIEW", 0L).put("TOREVIEW", 0L).put("REVIEWED", 0L).build(); + .put("REOPENED", 0L).put("RESOLVED", 0L).put("CLOSED", 0L).put("IN_REVIEW", 0L).put("TO_REVIEW", 0L).put("REVIEWED", 0L).build(); assertThat(response.getFacets().getFacetsList()) .extracting(Common.Facet::getProperty, facet -> facet.getValuesList().stream().collect(toMap(FacetValue::getVal, FacetValue::getCount))) @@ -507,7 +507,7 @@ public class SearchActionFacetsTest { .executeProtobuf(SearchWsResponse.class); Map<String, Number> expectedStatuses = ImmutableMap.<String, Number>builder().put("OPEN", 1L).put("CONFIRMED", 0L) - .put("REOPENED", 0L).put("RESOLVED", 0L).put("CLOSED", 0L).put("INREVIEW", 0L).put("TOREVIEW", 0L).put("REVIEWED", 0L).build(); + .put("REOPENED", 0L).put("RESOLVED", 0L).put("CLOSED", 0L).put("IN_REVIEW", 0L).put("TO_REVIEW", 0L).put("REVIEWED", 0L).build(); assertThat(response.getFacets().getFacetsList()) .extracting(Common.Facet::getProperty, facet -> facet.getValuesList().stream().collect(toMap(FacetValue::getVal, FacetValue::getCount))) diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.tsx index 5c0c51f433e..ea83e7a20c2 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.tsx @@ -39,7 +39,7 @@ interface Props { } const STATUSES = ['OPEN', 'CONFIRMED', 'REOPENED', 'RESOLVED']; -const HOTSPOT_STATUSES = ['TOREVIEW', 'REVIEWED', 'INREVIEW']; +const HOTSPOT_STATUSES = ['TO_REVIEW', 'REVIEWED', 'IN_REVIEW']; const COMMON_STATUSES = ['CLOSED']; export default class StatusFacet extends React.PureComponent<Props> { diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StatusFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StatusFacet-test.tsx index 6e7ee1ec10d..3b7b1482d35 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StatusFacet-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StatusFacet-test.tsx @@ -35,7 +35,7 @@ it('should toggle status facet', () => { it('should clear status facet', () => { const onChange = jest.fn(); - const wrapper = shallowRender({ onChange, statuses: ['TOREVIEW'] }); + const wrapper = shallowRender({ onChange, statuses: ['TO_REVIEW'] }); wrapper.children('FacetHeader').prop<Function>('onClear')(); expect(onChange).toBeCalledWith({ statuses: [] }); }); @@ -43,8 +43,8 @@ it('should clear status facet', () => { it('should select a status', () => { const onChange = jest.fn(); const wrapper = shallowRender({ onChange }); - clickAndCheck('TOREVIEW'); - clickAndCheck('OPEN', true, ['OPEN', 'TOREVIEW']); + clickAndCheck('TO_REVIEW'); + clickAndCheck('OPEN', true, ['OPEN', 'TO_REVIEW']); clickAndCheck('CONFIRMED'); function clickAndCheck(status: string, multiple = false, expected = [status]) { @@ -70,8 +70,8 @@ function shallowRender(props: Partial<StatusFacet['props']> = {}) { REOPENED: 0, RESOLVED: 0, CLOSED: 8, - TOREVIEW: 150, - INREVIEW: 7, + TO_REVIEW: 150, + IN_REVIEW: 7, REVIEWED: 1105 }} statuses={[]} diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/StatusFacet-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/StatusFacet-test.tsx.snap index de473009503..9d01da1c88e 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/StatusFacet-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/StatusFacet-test.tsx.snap @@ -90,17 +90,17 @@ exports[`should render correctly 1`] = ` active={false} disabled={false} halfWidth={true} - key="TOREVIEW" + key="TO_REVIEW" loading={false} name={ <StatusHelper - status="TOREVIEW" + status="TO_REVIEW" /> } onClick={[Function]} stat="150" - tooltip="issue.status.TOREVIEW" - value="TOREVIEW" + tooltip="issue.status.TO_REVIEW" + value="TO_REVIEW" /> <FacetItem active={false} @@ -122,17 +122,17 @@ exports[`should render correctly 1`] = ` active={false} disabled={false} halfWidth={true} - key="INREVIEW" + key="IN_REVIEW" loading={false} name={ <StatusHelper - status="INREVIEW" + status="IN_REVIEW" /> } onClick={[Function]} stat="7" - tooltip="issue.status.INREVIEW" - value="INREVIEW" + tooltip="issue.status.IN_REVIEW" + value="IN_REVIEW" /> </FacetItemsList> <FacetItemsList diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 0990e9f1e5a..6b0c1d1399a 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -619,17 +619,17 @@ issue.transition.close.description= issue.transition.wontfix=Resolve as won't fix issue.transition.wontfix.description=This issue can be ignored because the rule is irrelevant in this context. Its effort won't be counted. issue.transition.setinreview=Set as In Review -issue.transition.setinreview.description=A review is required to check for a Vulnerability +issue.transition.setinreview.description=A review is in progress to check for a vulnerability issue.transition.openasvulnerability=Open as Vulnerability issue.transition.openasvulnerability.description=There's a Vulnerability in the code that must be fixed issue.transition.resolveasreviewed=Resolve as Reviewed issue.transition.resolveasreviewed.description=There is no Vulnerability in the code issue.transition.resetastoreview=Reset as To Review issue.transition.resetastoreview.description=The Security Hotspot should be analyzed again -vulnerability.transition.resetastoreview=Reset as Security Hotspot To Review -vulnerability.transition.resetastoreview.description=The Vulnerability can't be fixed as is and needs more details -vulnerability.transition.resolveasreviewed=Resolve as Reviewed Security Hotspot -vulnerability.transition.resolveasreviewed.description=The Vulnerability has been fixed +vulnerability.transition.resetastoreview=Reset as To Review +vulnerability.transition.resetastoreview.description=The vulnerability can't be fixed as is and needs more details. The security hotspot needs to be reviewed again +vulnerability.transition.resolveasreviewed=Resolve as Reviewed +vulnerability.transition.resolveasreviewed.description=The vulnerability has been fixed. The security hotspot is considered reviewed issue.set_severity=Change Severity issue.set_type=Change Type @@ -648,8 +648,8 @@ issue.status.RESOLVED=Resolved issue.status.OPEN=Open issue.status.CONFIRMED=Confirmed issue.status.CLOSED=Closed -issue.status.TOREVIEW=To Review -issue.status.INREVIEW=In Review +issue.status.TO_REVIEW=To Review +issue.status.IN_REVIEW=In Review issue.status.REVIEWED=Reviewed issue.resolution.FALSE-POSITIVE=False Positive diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java index 2f0f25aec86..f409969aab8 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java @@ -79,12 +79,12 @@ public interface Issue extends Serializable { /** * @since 7.8 */ - String STATUS_TO_REVIEW = "TOREVIEW"; + String STATUS_TO_REVIEW = "TO_REVIEW"; /** * @since 7.8 */ - String STATUS_IN_REVIEW = "INREVIEW"; + String STATUS_IN_REVIEW = "IN_REVIEW"; /** * @since 7.8 |