]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-12026 Update status names, transition names and description
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 21 May 2019 15:50:50 +0000 (17:50 +0200)
committerSonarTech <sonartech@sonarsource.com>
Wed, 22 May 2019 18:21:15 +0000 (20:21 +0200)
* Replace INREVIEW and TOREVIEW to IN_REVIEW and TO_REVIEW
* Update transition names and descriptions

server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatuses.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatusesTest.java
server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/State.java
server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/StateTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionFacetsTest.java
server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.tsx
server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StatusFacet-test.tsx
server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/StatusFacet-test.tsx.snap
sonar-core/src/main/resources/org/sonar/l10n/core.properties
sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java

index 8cd5db78a7793d491ebf3cf1b76604c92459e0a3..ca988261401427a9cba1ba459b2c72c3f0d9168b 100644 (file)
@@ -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;
index cefd7097832a45196ffa9ef054085967c6d3221f..a3b10a97883a31e978b2cc9b4ac41a241a69c141 100644 (file)
@@ -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
index 7cd8d5308f3c79253bf68f8bd77df4a020efd6bb..5d2405f8f381ca6d0fbb8ff8180f8499097512ad 100644 (file)
@@ -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;
index 8793705984ff07e6071f3fc3f4109cb5e184abf7..0e7c438bad99a9e286b7504bd1bad758bda302b5 100644 (file)
@@ -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() {
@@ -38,14 +38,6 @@ public class StateTest {
     new State("", new Transition[0]);
   }
 
-  @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);
index 8ef8027a66711e5ae6b645f89b0a9dd902081d97..1d5d65750a9892802ecd4813bd519e3d2a4ed46d 100644 (file)
@@ -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)))
index 5c0c51f433eebc1a247597441fa268b52bcc895e..ea83e7a20c25fd578d4274bf6703c1c7538a1d70 100644 (file)
@@ -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> {
index 6e7ee1ec10dc4c664864fd92f1c1610391abad34..3b7b1482d35ccc6a38887f00f8b174094ca5739d 100644 (file)
@@ -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={[]}
index de473009503be98e2732d4e57d17292a7a6277f4..9d01da1c88e1996e066dee2c47b61eb9ed0f76ff 100644 (file)
@@ -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
index 0990e9f1e5a733a72d408288f48d79ec324192f5..6b0c1d1399a61e5ec6d472531a53a0235fe3e755 100644 (file)
@@ -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
index 2f0f25aec8656568f68693be80fcecda770ba6e3..f409969aab83e8dbd910518621d808e2e84c8581 100644 (file)
@@ -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