aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRevanshu Paliwal <revanshu.paliwal@sonarsource.com>2022-03-07 18:00:17 +0100
committersonartech <sonartech@sonarsource.com>2022-03-10 20:03:37 +0000
commit71e21dc3c44a60999828060bf2d4b9ed1c95f03a (patch)
tree0d31f2add0ddd7f262495370efdbbd5faa10e611
parentda6f21361124bd388f806184082a501764e6cb12 (diff)
downloadsonarqube-71e21dc3c44a60999828060bf2d4b9ed1c95f03a.tar.gz
sonarqube-71e21dc3c44a60999828060bf2d4b9ed1c95f03a.zip
SONAR-16101 Adding new status for security hotspot
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/FilterBar.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/FilterBar-test.tsx.snap20
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/StatusUpdateSuccessModal-test.tsx.snap42
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelectionRenderer.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/__snapshots__/StatusSelectionRenderer-test.tsx.snap20
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/utils.ts6
-rw-r--r--server/sonar-web/src/main/js/types/security-hotspots.ts9
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties22
9 files changed, 94 insertions, 53 deletions
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/FilterBar.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/FilterBar.tsx
index 1c5ecea9142..720b7fd5454 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/FilterBar.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/FilterBar.tsx
@@ -45,6 +45,10 @@ export interface FilterBarProps {
const statusOptions: Array<{ label: string; value: string }> = [
{ value: HotspotStatusFilter.TO_REVIEW, label: translate('hotspot.filters.status.to_review') },
+ {
+ value: HotspotStatusFilter.ACKNOWLEDGED,
+ label: translate('hotspot.filters.status.acknowledged')
+ },
{ value: HotspotStatusFilter.FIXED, label: translate('hotspot.filters.status.fixed') },
{ value: HotspotStatusFilter.SAFE, label: translate('hotspot.filters.status.safe') }
];
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx
index 5c149957829..39b038eb624 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx
@@ -17,7 +17,6 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import classNames from 'classnames';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { Button, ButtonLink } from '../../../components/controls/buttons';
@@ -48,26 +47,16 @@ export default function StatusUpdateSuccessModal(props: StatusUpdateSuccessModal
return (
<Modal contentLabel={modalTitle}>
- <div className="modal-head">
- <h2
- className={classNames('huge text-normal', {
- 'text-success': closingHotspots
- })}>
- {modalTitle}
- </h2>
+ <div className="modal-head huge text-center text-bold">
+ <p>{translateWithParameters('hotspots.successful_status_change_to_x', statusLabel)}</p>
</div>
- <div className="modal-body">
+ <div className="modal-body text-center big">
<FormattedMessage
id="hotspots.successfully_changed_to_x"
- defaultMessage={translate('hotspots.successfully_changed_to_x')}
+ defaultMessage={translate('hotspots.find_in_status_filter_x')}
values={{
- status_label: statusLabel,
- status_change: (
- <strong>
- {translateWithParameters('hotspots.successful_status_change_to_x', statusLabel)}
- </strong>
- )
+ status_label: <strong>{statusLabel}</strong>
}}
/>
{closingHotspots && (
@@ -93,7 +82,7 @@ export default function StatusUpdateSuccessModal(props: StatusUpdateSuccessModal
<ButtonLink onClick={props.onSwitchFilterToStatusOfUpdatedHotspot}>
{translateWithParameters('hotspots.see_x_hotspots', statusLabel)}
</ButtonLink>
- <Button className="button-primary padded" onClick={props.onClose}>
+ <Button className="button padded" onClick={props.onClose}>
{translate('hotspots.continue_to_next_hotspot')}
</Button>
</div>
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/FilterBar-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/FilterBar-test.tsx.snap
index 2332ce7de08..89dd2770842 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/FilterBar-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/FilterBar-test.tsx.snap
@@ -60,6 +60,10 @@ exports[`should render correctly: anonymous 1`] = `
"value": "TO_REVIEW",
},
Object {
+ "label": "hotspot.filters.status.acknowledged",
+ "value": "ACKNOWLEDGED",
+ },
+ Object {
"label": "hotspot.filters.status.fixed",
"value": "FIXED",
},
@@ -176,6 +180,10 @@ exports[`should render correctly: logged-in 1`] = `
"value": "TO_REVIEW",
},
Object {
+ "label": "hotspot.filters.status.acknowledged",
+ "value": "ACKNOWLEDGED",
+ },
+ Object {
"label": "hotspot.filters.status.fixed",
"value": "FIXED",
},
@@ -292,6 +300,10 @@ exports[`should render correctly: non-project 1`] = `
"value": "TO_REVIEW",
},
Object {
+ "label": "hotspot.filters.status.acknowledged",
+ "value": "ACKNOWLEDGED",
+ },
+ Object {
"label": "hotspot.filters.status.fixed",
"value": "FIXED",
},
@@ -367,6 +379,10 @@ exports[`should render correctly: on Pull request 1`] = `
"value": "TO_REVIEW",
},
Object {
+ "label": "hotspot.filters.status.acknowledged",
+ "value": "ACKNOWLEDGED",
+ },
+ Object {
"label": "hotspot.filters.status.fixed",
"value": "FIXED",
},
@@ -445,6 +461,10 @@ exports[`should render correctly: with hotspots reviewed measure 1`] = `
"value": "TO_REVIEW",
},
Object {
+ "label": "hotspot.filters.status.acknowledged",
+ "value": "ACKNOWLEDGED",
+ },
+ Object {
"label": "hotspot.filters.status.fixed",
"value": "FIXED",
},
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/StatusUpdateSuccessModal-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/StatusUpdateSuccessModal-test.tsx.snap
index f6f4cc4189a..3fedbef7b09 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/StatusUpdateSuccessModal-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/StatusUpdateSuccessModal-test.tsx.snap
@@ -5,26 +5,23 @@ exports[`should render correctly: default 1`] = `
contentLabel="hotspots.congratulations"
>
<div
- className="modal-head"
+ className="modal-head huge text-center text-bold"
>
- <h2
- className="huge text-normal text-success"
- >
- hotspots.congratulations
- </h2>
+ <p>
+ hotspots.successful_status_change_to_x.hotspots.status_option.FIXED
+ </p>
</div>
<div
- className="modal-body"
+ className="modal-body text-center big"
>
<FormattedMessage
- defaultMessage="hotspots.successfully_changed_to_x"
+ defaultMessage="hotspots.find_in_status_filter_x"
id="hotspots.successfully_changed_to_x"
values={
Object {
- "status_change": <strong>
- hotspots.successful_status_change_to_x.hotspots.status_option.FIXED
+ "status_label": <strong>
+ hotspots.status_option.FIXED
</strong>,
- "status_label": "hotspots.status_option.FIXED",
}
}
/>
@@ -53,7 +50,7 @@ exports[`should render correctly: default 1`] = `
hotspots.see_x_hotspots.hotspots.status_option.FIXED
</ButtonLink>
<Button
- className="button-primary padded"
+ className="button padded"
onClick={[MockFunction]}
>
hotspots.continue_to_next_hotspot
@@ -67,26 +64,23 @@ exports[`should render correctly: opening hotspots again 1`] = `
contentLabel="hotspots.update.success"
>
<div
- className="modal-head"
+ className="modal-head huge text-center text-bold"
>
- <h2
- className="huge text-normal"
- >
- hotspots.update.success
- </h2>
+ <p>
+ hotspots.successful_status_change_to_x.hotspots.status_option.TO_REVIEW
+ </p>
</div>
<div
- className="modal-body"
+ className="modal-body text-center big"
>
<FormattedMessage
- defaultMessage="hotspots.successfully_changed_to_x"
+ defaultMessage="hotspots.find_in_status_filter_x"
id="hotspots.successfully_changed_to_x"
values={
Object {
- "status_change": <strong>
- hotspots.successful_status_change_to_x.hotspots.status_option.TO_REVIEW
+ "status_label": <strong>
+ hotspots.status_option.TO_REVIEW
</strong>,
- "status_label": "hotspots.status_option.TO_REVIEW",
}
}
/>
@@ -100,7 +94,7 @@ exports[`should render correctly: opening hotspots again 1`] = `
hotspots.see_x_hotspots.hotspots.status_option.TO_REVIEW
</ButtonLink>
<Button
- className="button-primary padded"
+ className="button padded"
onClick={[MockFunction]}
>
hotspots.continue_to_next_hotspot
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelectionRenderer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelectionRenderer.tsx
index 66e9c7f2630..e9af5ed7f5e 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelectionRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelectionRenderer.tsx
@@ -57,6 +57,7 @@ export default function StatusSelectionRenderer(props: StatusSelectionRendererPr
<div className="abs-width-400">
<div className="big-padded">
{renderOption(HotspotStatusOption.TO_REVIEW)}
+ {renderOption(HotspotStatusOption.ACKNOWLEDGED)}
{renderOption(HotspotStatusOption.FIXED)}
{renderOption(HotspotStatusOption.SAFE)}
</div>
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/__snapshots__/StatusSelectionRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/__snapshots__/StatusSelectionRenderer-test.tsx.snap
index 7d0722dd835..0f1f287ca77 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/__snapshots__/StatusSelectionRenderer-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/__snapshots__/StatusSelectionRenderer-test.tsx.snap
@@ -21,6 +21,16 @@ exports[`should render correctly 1`] = `
checked={false}
className="big-spacer-bottom"
onCheck={[MockFunction]}
+ value="ACKNOWLEDGED"
+ >
+ <StatusDescription
+ statusOption="ACKNOWLEDGED"
+ />
+ </Radio>
+ <Radio
+ checked={false}
+ className="big-spacer-bottom"
+ onCheck={[MockFunction]}
value="FIXED"
>
<StatusDescription
@@ -91,6 +101,16 @@ exports[`should render correctly: loading 1`] = `
checked={false}
className="big-spacer-bottom"
onCheck={[MockFunction]}
+ value="ACKNOWLEDGED"
+ >
+ <StatusDescription
+ statusOption="ACKNOWLEDGED"
+ />
+ </Radio>
+ <Radio
+ checked={false}
+ className="big-spacer-bottom"
+ onCheck={[MockFunction]}
value="FIXED"
>
<StatusDescription
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/utils.ts b/server/sonar-web/src/main/js/apps/security-hotspots/utils.ts
index cdcdd8cae45..ca95c095990 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/utils.ts
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/utils.ts
@@ -157,6 +157,7 @@ export function getHotspotReviewHistory(hotspot: Hotspot): ReviewHistoryElement[
const STATUS_AND_RESOLUTION_TO_STATUS_OPTION = {
[HotspotStatus.TO_REVIEW]: HotspotStatusOption.TO_REVIEW,
[HotspotStatus.REVIEWED]: HotspotStatusOption.FIXED,
+ [HotspotResolution.ACKNOWLEDGED]: HotspotStatusOption.ACKNOWLEDGED,
[HotspotResolution.FIXED]: HotspotStatusOption.FIXED,
[HotspotResolution.SAFE]: HotspotStatusOption.SAFE
};
@@ -172,6 +173,10 @@ export function getStatusOptionFromStatusAndResolution(
const STATUS_OPTION_TO_STATUS_AND_RESOLUTION_MAP = {
[HotspotStatusOption.TO_REVIEW]: { status: HotspotStatus.TO_REVIEW, resolution: undefined },
+ [HotspotStatusOption.ACKNOWLEDGED]: {
+ status: HotspotStatus.REVIEWED,
+ resolution: HotspotResolution.ACKNOWLEDGED
+ },
[HotspotStatusOption.FIXED]: {
status: HotspotStatus.REVIEWED,
resolution: HotspotResolution.FIXED
@@ -188,6 +193,7 @@ export function getStatusAndResolutionFromStatusOption(statusOption: HotspotStat
const STATUS_OPTION_TO_STATUS_FILTER = {
[HotspotStatusOption.TO_REVIEW]: HotspotStatusFilter.TO_REVIEW,
+ [HotspotStatusOption.ACKNOWLEDGED]: HotspotStatusFilter.ACKNOWLEDGED,
[HotspotStatusOption.FIXED]: HotspotStatusFilter.FIXED,
[HotspotStatusOption.SAFE]: HotspotStatusFilter.SAFE
};
diff --git a/server/sonar-web/src/main/js/types/security-hotspots.ts b/server/sonar-web/src/main/js/types/security-hotspots.ts
index 8d0a15fcde0..6dfa65c923b 100644
--- a/server/sonar-web/src/main/js/types/security-hotspots.ts
+++ b/server/sonar-web/src/main/js/types/security-hotspots.ts
@@ -40,19 +40,22 @@ export enum HotspotStatus {
export enum HotspotResolution {
FIXED = 'FIXED',
- SAFE = 'SAFE'
+ SAFE = 'SAFE',
+ ACKNOWLEDGED = 'ACKNOWLEDGED'
}
export enum HotspotStatusFilter {
FIXED = 'FIXED',
SAFE = 'SAFE',
- TO_REVIEW = 'TO_REVIEW'
+ TO_REVIEW = 'TO_REVIEW',
+ ACKNOWLEDGED = 'ACKNOWLEDGED'
}
export enum HotspotStatusOption {
FIXED = 'FIXED',
SAFE = 'SAFE',
- TO_REVIEW = 'TO_REVIEW'
+ TO_REVIEW = 'TO_REVIEW',
+ ACKNOWLEDGED = 'ACKNOWLEDGED'
}
export interface HotspotFilters {
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 4653f0ec0f7..a2ce05c61bc 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -731,6 +731,7 @@ hotspots.no_hotspots_for_keys.description=They have been closed because the code
hotspots.learn_more=Learn more about Security Hotspots
hotspots.list_title={0} Security Hotspots
hotspots.list_title.TO_REVIEW={0} Security Hotspots to review
+hotspots.list_title.ACKNOWLEDGED={0} Security Hotspots reviewed as acknowledged
hotspots.list_title.FIXED={0} Security Hotspots reviewed as fixed
hotspots.list_title.SAFE={0} Security Hotspots reviewed as safe
hotspots.risk_exposure=Review priority
@@ -754,32 +755,35 @@ hotspots.status.select_status=Change status
hotspots.status.add_comment=Add a comment (Optional)
hotspots.status.change_status=Change status
hotspots.status_option.TO_REVIEW=To review
-hotspots.status_option.TO_REVIEW.description=This Security Hotspot needs to be reviewed to assess whether the code poses a risk.
+hotspots.status_option.TO_REVIEW.description=This security hotspot needs to be reviewed to assess whether the code poses a risk.
+hotspots.status_option.ACKNOWLEDGED=Acknowledged
+hotspots.status_option.ACKNOWLEDGED.description=The code has been reviewed and does pose a risk. A fix is required.
hotspots.status_option.FIXED=Fixed
-hotspots.status_option.FIXED.description=The code has been modified to follow recommended secure coding practices.
+hotspots.status_option.FIXED.description=The code has been reviewed and modified to follow the recommended secure coding practices.
hotspots.status_option.SAFE=Safe
-hotspots.status_option.SAFE.description=The code is not at risk and doesn't need to be modified.
+hotspots.status_option.SAFE.description=The code has been reviewed and does not pose a risk. It does not need to be modified.
hotspots.get_permalink=Get Permalink
hotspots.no_associated_lines=Security Hotspot raised on the following file:
hotspots.congratulations=Congratulations!
-hotspots.successfully_changed_to_x=The Security Hotspot was {status_change}. You can find it by changing the top filter to display "{status_label}" Security Hotspots.
-hotspots.successful_status_change_to_x=successfully changed to "{0}"
+hotspots.find_in_status_filter_x= You can find it again by setting status filter to {status_label}.
+hotspots.successful_status_change_to_x=The Security Hotspot was successfully changed to {0}.
hotspots.x_done_keep_going={percentage} of the Security Hotspots have been reviewed, keep going!
hotspots.see_x_hotspots=See "{0}" Security Hotspots
-hotspots.continue_to_next_hotspot=Continue reviewing next Security Hotspot
+hotspots.continue_to_next_hotspot=Continue Reviewing
hotspot.filters.title=Filters
hotspot.filters.assignee.assigned_to_me=Assigned to me
hotspot.filters.assignee.all=All
hotspot.filters.status.to_review=To review
-hotspot.filters.status.fixed=Reviewed as fixed
+hotspot.filters.status.acknowledged=Acknowledged
+hotspot.filters.status.fixed=Fixed
hotspot.filters.period.since_leak_period=New code
hotspot.filters.period.overall=Overall code
-hotspot.filters.status.safe=Reviewed as safe
+hotspot.filters.status.safe=Safe
hotspot.filters.show_all=Show all hotspots
hotspot.section.activity=Recent activity:
-hotspots.reviewed.tooltip=Percentage of Security Hotspots reviewed (fixed or safe) among all non-closed Security Hotspots.
+hotspots.reviewed.tooltip=Percentage of Security Hotspots reviewed (Acknowledged, Fixed or Safe) among all non-closed Security Hotspots.
hotspots.review_hotspot=Review Hotspot
hotspots.assign.success=Security Hotspot was successfully assigned to {0}