From c679155c37f3d154807d07a3afaea8c42e91ebbf Mon Sep 17 00:00:00 2001 From: guillaume-peoch-sonarsource <91735163+guillaume-peoch-sonarsource@users.noreply.github.com> Date: Thu, 14 Jul 2022 15:52:56 +0200 Subject: SONAR-16465 Replace parameter sinceLeakPeriod with inNewCodePeriod (#6275) * SONAR-16465 Replace parameter sinceLeakPeriod with inNewCodePeriod --- .../main/js/apps/issues/__tests__/utils-test.ts | 4 ++-- .../__snapshots__/IssuesApp-test.tsx.snap | 2 +- .../js/apps/issues/sidebar/CreationDateFacet.tsx | 16 ++++++++-------- .../src/main/js/apps/issues/sidebar/Sidebar.tsx | 2 +- .../sidebar/__tests__/CreationDateFacet-test.tsx | 2 +- server/sonar-web/src/main/js/apps/issues/utils.ts | 6 +++--- .../js/apps/overview/components/IssueLabel.tsx | 2 +- .../overview/components/QualityGateCondition.tsx | 22 +++++++++++----------- .../__snapshots__/IssueLabel-test.tsx.snap | 16 ++++++++-------- .../QualityGateCondition-test.tsx.snap | 12 ++++++------ .../apps/security-hotspots/SecurityHotspotsApp.tsx | 18 +++++++++--------- .../SecurityHotspotsAppRenderer.tsx | 2 +- .../__tests__/SecurityHotspotsApp-test.tsx | 10 +++++----- .../__tests__/SecurityHotspotsAppRenderer-test.tsx | 4 ++-- .../SecurityHotspotsApp-test.tsx.snap | 2 +- .../SecurityHotspotsAppRenderer-test.tsx.snap | 8 ++++---- .../security-hotspots/components/FilterBar.tsx | 6 +++--- .../components/__tests__/FilterBar-test.tsx | 4 ++-- .../main/js/components/shared/DrilldownLink.tsx | 6 +++--- .../shared/__tests__/DrilldownLink-test.tsx | 4 ++-- .../src/main/js/helpers/__tests__/urls-test.ts | 4 ++-- server/sonar-web/src/main/js/helpers/urls.ts | 4 ++-- .../src/main/js/types/security-hotspots.ts | 2 +- .../org/sonar/server/issue/ws/SearchAction.java | 1 + .../src/main/resources/snapshot-of-api.json | 2 +- 25 files changed, 81 insertions(+), 80 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts index a220b5fb908..2b4751b9b8e 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts @@ -61,7 +61,7 @@ describe('serialize/deserialize', () => { sansTop25: ['a', 'b'], scopes: ['a', 'b'], severities: ['a', 'b'], - sinceLeakPeriod: true, + inNewCodePeriod: true, sonarsourceSecurity: ['a', 'b'], statuses: ['a', 'b'], tags: ['a', 'b'], @@ -88,7 +88,7 @@ describe('serialize/deserialize', () => { sansTop25: 'a,b', scopes: 'a,b', severities: 'a,b', - sinceLeakPeriod: 'true', + inNewCodePeriod: 'true', sonarsourceSecurity: 'a,b', statuses: 'a,b', tags: 'a,b', diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesApp-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesApp-test.tsx.snap index 13685dbe0a5..515eae8fa6e 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesApp-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesApp-test.tsx.snap @@ -119,6 +119,7 @@ exports[`should show warnning when not all projects are accessible 1`] = ` "cwe": Array [], "directories": Array [], "files": Array [], + "inNewCodePeriod": false, "issues": Array [], "languages": Array [], "owaspTop10": Array [], @@ -130,7 +131,6 @@ exports[`should show warnning when not all projects are accessible 1`] = ` "sansTop25": Array [], "scopes": Array [], "severities": Array [], - "sinceLeakPeriod": false, "sonarsourceSecurity": Array [], "sort": "", "statuses": Array [], diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx index ede16fd2a0c..26169778ac2 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx @@ -49,7 +49,7 @@ interface Props { onChange: (changes: Partial) => void; onToggle: (property: string) => void; open: boolean; - sinceLeakPeriod: boolean; + inNewCodePeriod: boolean; stats: Dict | undefined; } @@ -65,7 +65,7 @@ export class CreationDateFacet extends React.PureComponent 0 || this.props.createdBefore !== undefined || this.props.createdInLast.length > 0 || - this.props.sinceLeakPeriod; + this.props.inNewCodePeriod; handleHeaderClick = () => { this.props.onToggle(this.property); @@ -81,7 +81,7 @@ export class CreationDateFacet extends React.PureComponent this.resetTo({ createdInLast: period }); - handleLeakPeriodClick = () => this.resetTo({ sinceLeakPeriod: true }); + handleLeakPeriodClick = () => this.resetTo({ inNewCodePeriod: true }); getValues() { const { @@ -111,7 +111,7 @@ export class CreationDateFacet extends React.PureComponent {component && !isPortfolioLike(component.qualifier) ? ( { onChange={this.props.onFilterChange} onToggle={this.props.onFacetToggle} open={!!openFacets.createdAt} - sinceLeakPeriod={query.sinceLeakPeriod} + inNewCodePeriod={query.inNewCodePeriod} stats={facets.createdAt} /> ) { createdAt="" createdBefore={undefined} createdInLast="" - sinceLeakPeriod={false} + inNewCodePeriod={false} intl={ { formatDate: (date: string) => 'formatted.' + date diff --git a/server/sonar-web/src/main/js/apps/issues/utils.ts b/server/sonar-web/src/main/js/apps/issues/utils.ts index 590e1a4af58..e89d4b011ca 100644 --- a/server/sonar-web/src/main/js/apps/issues/utils.ts +++ b/server/sonar-web/src/main/js/apps/issues/utils.ts @@ -61,7 +61,7 @@ export interface Query { sansTop25: string[]; scopes: string[]; severities: string[]; - sinceLeakPeriod: boolean; + inNewCodePeriod: boolean; sonarsourceSecurity: string[]; sort: string; statuses: string[]; @@ -104,7 +104,7 @@ export function parseQuery(query: RawQuery): Query { sansTop25: parseAsArray(query.sansTop25, parseAsString), scopes: parseAsArray(query.scopes, parseAsString), severities: parseAsArray(query.severities, parseAsString), - sinceLeakPeriod: parseAsBoolean(query.sinceLeakPeriod, false), + inNewCodePeriod: parseAsBoolean(query.inNewCodePeriod, false), sonarsourceSecurity: parseAsArray(query.sonarsourceSecurity, parseAsString), sort: parseAsSort(query.s), statuses: parseAsArray(query.statuses, parseAsString), @@ -148,7 +148,7 @@ export function serializeQuery(query: Query): RawQuery { sansTop25: serializeStringArray(query.sansTop25), scopes: serializeStringArray(query.scopes), severities: serializeStringArray(query.severities), - sinceLeakPeriod: query.sinceLeakPeriod ? 'true' : undefined, + inNewCodePeriod: query.inNewCodePeriod ? 'true' : undefined, sonarsourceSecurity: serializeStringArray(query.sonarsourceSecurity), statuses: serializeStringArray(query.statuses), tags: serializeStringArray(query.tags), diff --git a/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx b/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx index f1cad7fab13..858d3a168da 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx @@ -54,7 +54,7 @@ export function IssueLabel(props: IssueLabelProps) { ...getBranchLikeQuery(branchLike), resolved: 'false', types: type, - sinceLeakPeriod: useDiffMetric ? 'true' : 'false' + inNewCodePeriod: useDiffMetric ? 'true' : 'false' }; return ( diff --git a/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx b/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx index 084d159d323..5f8d91fafe8 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx @@ -40,33 +40,33 @@ interface Props { } export default class QualityGateCondition extends React.PureComponent { - getIssuesUrl = (sinceLeakPeriod: boolean, customQuery: Dict) => { + getIssuesUrl = (inNewCodePeriod: boolean, customQuery: Dict) => { const query: Dict = { resolved: 'false', ...getBranchLikeQuery(this.props.branchLike), ...customQuery }; - if (sinceLeakPeriod) { - Object.assign(query, { sinceLeakPeriod: 'true' }); + if (inNewCodePeriod) { + Object.assign(query, { inNewCodePeriod: 'true' }); } return getComponentIssuesUrl(this.props.component.key, query); }; - getUrlForSecurityHotspot(sinceLeakPeriod: boolean) { + getUrlForSecurityHotspot(inNewCodePeriod: boolean) { const query: Dict = { ...getBranchLikeQuery(this.props.branchLike) }; - if (sinceLeakPeriod) { - Object.assign(query, { sinceLeakPeriod: 'true' }); + if (inNewCodePeriod) { + Object.assign(query, { inNewCodePeriod: 'true' }); } return getComponentSecurityHotspotsUrl(this.props.component.key, query); } - getUrlForCodeSmells(sinceLeakPeriod: boolean) { - return this.getIssuesUrl(sinceLeakPeriod, { types: 'CODE_SMELL' }); + getUrlForCodeSmells(inNewCodePeriod: boolean) { + return this.getIssuesUrl(inNewCodePeriod, { types: 'CODE_SMELL' }); } - getUrlForBugsOrVulnerabilities(type: string, sinceLeakPeriod: boolean) { + getUrlForBugsOrVulnerabilities(type: string, inNewCodePeriod: boolean) { const RATING_TO_SEVERITIES_MAPPING = [ 'BLOCKER,CRITICAL,MAJOR,MINOR', 'BLOCKER,CRITICAL,MAJOR', @@ -77,7 +77,7 @@ export default class QualityGateCondition extends React.PureComponent { const { condition } = this.props; const threshold = condition.level === 'ERROR' ? condition.error : condition.warning; - return this.getIssuesUrl(sinceLeakPeriod, { + return this.getIssuesUrl(inNewCodePeriod, { types: type, severities: RATING_TO_SEVERITIES_MAPPING[Number(threshold) - 1] }); @@ -118,7 +118,7 @@ export default class QualityGateCondition extends React.PureComponent { className={className} component={component.key} metric={condition.measure.metric.key} - sinceLeakPeriod={condition.period != null}> + inNewCodePeriod={condition.period != null}> {children} ); diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/IssueLabel-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/IssueLabel-test.tsx.snap index ffd998312f2..07600034dc3 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/IssueLabel-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/IssueLabel-test.tsx.snap @@ -8,7 +8,7 @@ exports[`should render correctly for bugs 1`] = ` Object { "hash": "", "pathname": "/project/issues", - "search": "?pullRequest=1001&resolved=false&types=BUG&sinceLeakPeriod=false&id=my-project", + "search": "?pullRequest=1001&resolved=false&types=BUG&inNewCodePeriod=false&id=my-project", } } > @@ -29,7 +29,7 @@ exports[`should render correctly for bugs 2`] = ` Object { "hash": "", "pathname": "/project/issues", - "search": "?pullRequest=1001&resolved=false&types=BUG&sinceLeakPeriod=true&id=my-project", + "search": "?pullRequest=1001&resolved=false&types=BUG&inNewCodePeriod=true&id=my-project", } } > @@ -50,7 +50,7 @@ exports[`should render correctly for code smells 1`] = ` Object { "hash": "", "pathname": "/project/issues", - "search": "?pullRequest=1001&resolved=false&types=CODE_SMELL&sinceLeakPeriod=false&id=my-project", + "search": "?pullRequest=1001&resolved=false&types=CODE_SMELL&inNewCodePeriod=false&id=my-project", } } > @@ -71,7 +71,7 @@ exports[`should render correctly for code smells 2`] = ` Object { "hash": "", "pathname": "/project/issues", - "search": "?pullRequest=1001&resolved=false&types=CODE_SMELL&sinceLeakPeriod=true&id=my-project", + "search": "?pullRequest=1001&resolved=false&types=CODE_SMELL&inNewCodePeriod=true&id=my-project", } } > @@ -92,7 +92,7 @@ exports[`should render correctly for hotspots 1`] = ` Object { "hash": "", "pathname": "/security_hotspots", - "search": "?id=my-project&pullRequest=1001&sinceLeakPeriod=false", + "search": "?id=my-project&pullRequest=1001&inNewCodePeriod=false", } } > @@ -117,7 +117,7 @@ exports[`should render correctly for hotspots 2`] = ` Object { "hash": "", "pathname": "/security_hotspots", - "search": "?id=my-project&pullRequest=1001&sinceLeakPeriod=true", + "search": "?id=my-project&pullRequest=1001&inNewCodePeriod=true", } } > @@ -142,7 +142,7 @@ exports[`should render correctly for vulnerabilities 1`] = ` Object { "hash": "", "pathname": "/project/issues", - "search": "?pullRequest=1001&resolved=false&types=VULNERABILITY&sinceLeakPeriod=false&id=my-project", + "search": "?pullRequest=1001&resolved=false&types=VULNERABILITY&inNewCodePeriod=false&id=my-project", } } > @@ -163,7 +163,7 @@ exports[`should render correctly for vulnerabilities 2`] = ` Object { "hash": "", "pathname": "/project/issues", - "search": "?pullRequest=1001&resolved=false&types=VULNERABILITY&sinceLeakPeriod=true&id=my-project", + "search": "?pullRequest=1001&resolved=false&types=VULNERABILITY&inNewCodePeriod=true&id=my-project", } } > diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/QualityGateCondition-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/QualityGateCondition-test.tsx.snap index b4eb8987e86..6fc13d55ee8 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/QualityGateCondition-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/QualityGateCondition-test.tsx.snap @@ -4,8 +4,8 @@ exports[`should render correclty 1`] = `
@@ -233,7 +233,7 @@ exports[`should render correclty 6`] = ` Object { "hash": "", "pathname": "/project/issues", - "search": "?resolved=false&types=VULNERABILITY&severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&sinceLeakPeriod=true&id=abcd-key", + "search": "?resolved=false&types=VULNERABILITY&severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&inNewCodePeriod=true&id=abcd-key", } } > @@ -279,7 +279,7 @@ exports[`should render correclty 7`] = ` Object { "hash": "", "pathname": "/project/issues", - "search": "?resolved=false&types=CODE_SMELL&sinceLeakPeriod=true&id=abcd-key", + "search": "?resolved=false&types=CODE_SMELL&inNewCodePeriod=true&id=abcd-key", } } > @@ -371,7 +371,7 @@ exports[`should render correclty 9`] = ` Object { "hash": "", "pathname": "/security_hotspots", - "search": "?id=abcd-key&sinceLeakPeriod=true", + "search": "?id=abcd-key&inNewCodePeriod=true", } } > @@ -417,7 +417,7 @@ exports[`should work with branch 1`] = ` Object { "hash": "", "pathname": "/project/issues", - "search": "?resolved=false&branch=branch-6.7&types=CODE_SMELL&sinceLeakPeriod=true&id=abcd-key", + "search": "?resolved=false&branch=branch-6.7&types=CODE_SMELL&inNewCodePeriod=true&id=abcd-key", } } > diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx index 83b805bd143..e8fbee0ee0c 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx @@ -127,7 +127,7 @@ export class SecurityHotspotsApp extends React.PureComponent { !isSameBranchLike(this.props.branchLike, previous.branchLike) || isLoggedIn(this.props.currentUser) !== isLoggedIn(previous.currentUser) || this.props.location.query.assignedToMe !== previous.location.query.assignedToMe || - this.props.location.query.sinceLeakPeriod !== previous.location.query.sinceLeakPeriod + this.props.location.query.inNewCodePeriod !== previous.location.query.inNewCodePeriod ) { this.setState(({ filters }) => ({ filters: { ...this.constructFiltersFromProps, ...filters } @@ -228,11 +228,11 @@ export class SecurityHotspotsApp extends React.PureComponent { constructFiltersFromProps( props: Props - ): Pick { + ): Pick { return { assignedToMe: props.location.query.assignedToMe === 'true' && isLoggedIn(props.currentUser), - sinceLeakPeriod: - isPullRequest(props.branchLike) || props.location.query.sinceLeakPeriod === 'true' + inNewCodePeriod: + isPullRequest(props.branchLike) || props.location.query.inNewCodePeriod === 'true' }; } @@ -270,7 +270,7 @@ export class SecurityHotspotsApp extends React.PureComponent { const { branchLike, component } = this.props; const { filters } = this.state; - const reviewedHotspotsMetricKey = filters.sinceLeakPeriod + const reviewedHotspotsMetricKey = filters.inNewCodePeriod ? 'new_security_hotspots_reviewed' : 'security_hotspots_reviewed'; @@ -285,7 +285,7 @@ export class SecurityHotspotsApp extends React.PureComponent { return; } const measure = measures && measures.length > 0 ? measures[0] : undefined; - const hotspotsReviewedMeasure = filters.sinceLeakPeriod + const hotspotsReviewedMeasure = filters.inNewCodePeriod ? getLeakValue(measure) : measure?.value; @@ -345,7 +345,7 @@ export class SecurityHotspotsApp extends React.PureComponent { p: page, ps: PAGE_SIZE, status: HotspotStatus.TO_REVIEW, // we're only interested in unresolved hotspots - inNewCodePeriod: filters.sinceLeakPeriod && Boolean(filterByFile), // only add leak period when filtering by file + inNewCodePeriod: filters.inNewCodePeriod && Boolean(filterByFile), // only add leak period when filtering by file ...getBranchLikeQuery(branchLike) }); } @@ -367,7 +367,7 @@ export class SecurityHotspotsApp extends React.PureComponent { status, resolution, onlyMine: filters.assignedToMe, - inNewCodePeriod: filters.sinceLeakPeriod, + inNewCodePeriod: filters.inNewCodePeriod, ...getBranchLikeQuery(branchLike) }); } @@ -397,7 +397,7 @@ export class SecurityHotspotsApp extends React.PureComponent { ({ filters }) => ({ filters: { ...filters, ...changes } }), () => { this.reloadSecurityHotspotList(); - if (changes.sinceLeakPeriod !== undefined) { + if (changes.inNewCodePeriod !== undefined) { this.fetchSecurityHotspotsReviewed(); } } diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx index f09495eb815..0ebff755db0 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx @@ -130,7 +130,7 @@ export default function SecurityHotspotsAppRenderer(props: SecurityHotspotsAppRe { }); it('should set "leakperiod" filter according to context (branchlike & location query)', () => { - expect(shallowRender().state().filters.sinceLeakPeriod).toBe(false); - expect(shallowRender({ branchLike: mockPullRequest() }).state().filters.sinceLeakPeriod).toBe( + expect(shallowRender().state().filters.inNewCodePeriod).toBe(false); + expect(shallowRender({ branchLike: mockPullRequest() }).state().filters.inNewCodePeriod).toBe( true ); expect( - shallowRender({ location: mockLocation({ query: { sinceLeakPeriod: 'true' } }) }).state() - .filters.sinceLeakPeriod + shallowRender({ location: mockLocation({ query: { inNewCodePeriod: 'true' } }) }).state() + .filters.inNewCodePeriod ).toBe(true); }); @@ -383,7 +383,7 @@ it('should handle leakPeriod filter change', async () => { expect(getMeasures).toBeCalledTimes(1); - wrapper.instance().handleChangeFilters({ sinceLeakPeriod: true }); + wrapper.instance().handleChangeFilters({ inNewCodePeriod: true }); expect(getMeasures).toBeCalledTimes(2); expect(getSecurityHotspots).toBeCalledWith(expect.objectContaining({ inNewCodePeriod: true })); diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsAppRenderer-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsAppRenderer-test.tsx index 6eb01ce93d0..224eabe8688 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsAppRenderer-test.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsAppRenderer-test.tsx @@ -52,7 +52,7 @@ it('should render correctly', () => { expect(shallowRender()).toMatchSnapshot(); expect( shallowRender({ - filters: { assignedToMe: true, sinceLeakPeriod: false, status: HotspotStatusFilter.TO_REVIEW } + filters: { assignedToMe: true, inNewCodePeriod: false, status: HotspotStatusFilter.TO_REVIEW } }) ).toMatchSnapshot('no hotspots with filters'); expect(shallowRender({ loading: true })).toMatchSnapshot('loading'); @@ -139,7 +139,7 @@ function shallowRender(props: Partial = {}) { component={mockComponent()} filters={{ assignedToMe: false, - sinceLeakPeriod: false, + inNewCodePeriod: false, status: HotspotStatusFilter.TO_REVIEW }} hotspots={[]} diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsApp-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsApp-test.tsx.snap index 2ab1904234a..17229150d88 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsApp-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsApp-test.tsx.snap @@ -35,7 +35,7 @@ exports[`should render correctly 1`] = ` filters={ Object { "assignedToMe": false, - "sinceLeakPeriod": false, + "inNewCodePeriod": false, "status": "TO_REVIEW", } } diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsAppRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsAppRenderer-test.tsx.snap index 6012cd9ffa7..fb069b020e5 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsAppRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsAppRenderer-test.tsx.snap @@ -42,7 +42,7 @@ exports[`should render correctly 1`] = ` filters={ Object { "assignedToMe": false, - "sinceLeakPeriod": false, + "inNewCodePeriod": false, "status": "TO_REVIEW", } } @@ -371,7 +371,7 @@ exports[`should render correctly with hotspots 1`] = ` filters={ Object { "assignedToMe": false, - "sinceLeakPeriod": false, + "inNewCodePeriod": false, "status": "TO_REVIEW", } } @@ -509,7 +509,7 @@ exports[`should render correctly: loading 1`] = ` filters={ Object { "assignedToMe": false, - "sinceLeakPeriod": false, + "inNewCodePeriod": false, "status": "TO_REVIEW", } } @@ -575,7 +575,7 @@ exports[`should render correctly: no hotspots with filters 1`] = ` filters={ Object { "assignedToMe": true, - "sinceLeakPeriod": false, + "inNewCodePeriod": false, "status": "TO_REVIEW", } } 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 3a7e2733616..2f4ef10966d 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 @@ -128,11 +128,11 @@ export function FilterBar(props: FilterBarProps) { className="input-medium big-spacer-right" aria-label={translate('hotspot.filters.period')} onChange={(option: { value: boolean }) => - props.onChangeFilters({ sinceLeakPeriod: option.value }) + props.onChangeFilters({ inNewCodePeriod: option.value }) } options={periodOptions} isSearchable={false} - value={periodOptions.find(period => period.value === filters.sinceLeakPeriod)} + value={periodOptions.find(period => period.value === filters.inNewCodePeriod)} /> )}
@@ -151,7 +151,7 @@ export function FilterBar(props: FilterBarProps) { { .props(); onChange({ value: true }); - expect(onChangeFilters).toBeCalledWith({ sinceLeakPeriod: true }); + expect(onChangeFilters).toBeCalledWith({ inNewCodePeriod: true }); }); function shallowRender(props: Partial = {}) { @@ -98,7 +98,7 @@ function shallowRender(props: Partial = {}) { currentUser={mockCurrentUser()} filters={{ assignedToMe: false, - sinceLeakPeriod: false, + inNewCodePeriod: false, status: HotspotStatusFilter.TO_REVIEW }} isStaticListOfHotspots={false} diff --git a/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx b/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx index bd368a08cf7..56ed2212faf 100644 --- a/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx +++ b/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx @@ -78,7 +78,7 @@ interface Props { className?: string; component: string; metric: string; - sinceLeakPeriod?: boolean; + inNewCodePeriod?: boolean; } export default class DrilldownLink extends React.PureComponent { @@ -91,8 +91,8 @@ export default class DrilldownLink extends React.PureComponent { ...(issueParamsPerMetric[this.props.metric] || { resolved: 'false' }) }; - if (this.props.sinceLeakPeriod) { - params.sinceLeakPeriod = true; + if (this.props.inNewCodePeriod) { + params.inNewCodePeriod = true; } return params; diff --git a/server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx b/server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx index 94471a87ad9..4d7e2c2863b 100644 --- a/server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx +++ b/server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx @@ -37,10 +37,10 @@ describe('propsToIssueParams', () => { }); it(`should render correct params`, () => { - const wrapper = shallowRender({ metric: 'false_positive_issues', sinceLeakPeriod: true }); + const wrapper = shallowRender({ metric: 'false_positive_issues', inNewCodePeriod: true }); expect(wrapper.instance().propsToIssueParams()).toEqual({ resolutions: 'FALSE-POSITIVE', - sinceLeakPeriod: true + inNewCodePeriod: true }); }); }); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts index a881a16e4a1..a46d5ae3f83 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts @@ -122,7 +122,7 @@ describe('#getComponentSecurityHotspotsUrl', () => { it('should forward some query parameters', () => { expect( getComponentSecurityHotspotsUrl(SIMPLE_COMPONENT_KEY, { - sinceLeakPeriod: 'true', + inNewCodePeriod: 'true', [SecurityStandard.OWASP_TOP10_2021]: 'a1', [SecurityStandard.CWE]: 'a1', [SecurityStandard.OWASP_TOP10]: 'a1', @@ -135,7 +135,7 @@ describe('#getComponentSecurityHotspotsUrl', () => { pathname: '/security_hotspots', search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, - sinceLeakPeriod: 'true', + inNewCodePeriod: 'true', [SecurityStandard.OWASP_TOP10_2021]: 'a1', [SecurityStandard.SONARSOURCE]: 'a1', [SecurityStandard.OWASP_TOP10]: 'a1', diff --git a/server/sonar-web/src/main/js/helpers/urls.ts b/server/sonar-web/src/main/js/helpers/urls.ts index d6e71bead37..0e7ab419f9c 100644 --- a/server/sonar-web/src/main/js/helpers/urls.ts +++ b/server/sonar-web/src/main/js/helpers/urls.ts @@ -196,14 +196,14 @@ export function getComponentIssuesUrl(componentKey: string, query?: Query): Path * Generate URL for a component's security hotspot page */ export function getComponentSecurityHotspotsUrl(componentKey: string, query: Query = {}): Path { - const { branch, pullRequest, sinceLeakPeriod, hotspots, assignedToMe, file } = query; + const { branch, pullRequest, inNewCodePeriod, hotspots, assignedToMe, file } = query; return { pathname: '/security_hotspots', search: queryToSearch({ id: componentKey, branch, pullRequest, - sinceLeakPeriod, + inNewCodePeriod, hotspots, assignedToMe, file, 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 4bd3c60778b..38b3cb5513c 100644 --- a/server/sonar-web/src/main/js/types/security-hotspots.ts +++ b/server/sonar-web/src/main/js/types/security-hotspots.ts @@ -54,7 +54,7 @@ export enum HotspotStatusOption { export interface HotspotFilters { assignedToMe: boolean; - sinceLeakPeriod: boolean; + inNewCodePeriod: boolean; status: HotspotStatusFilter; } diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java index fe773f380d0..462affd3087 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java @@ -317,6 +317,7 @@ public class SearchAction implements IssuesWsAction { action.createParam(PARAM_SINCE_LEAK_PERIOD) .setDescription("To retrieve issues created since the leak period.
" + "If this parameter is set to a truthy value, createdAfter must not be set and one component uuid or key must be provided.") + .setDeprecatedSince("9.4") .setBooleanPossibleValues(); action.createParam(PARAM_IN_NEW_CODE_PERIOD) .setDescription("To retrieve issues created in the new code period.
" + diff --git a/sonar-ws-generator/src/main/resources/snapshot-of-api.json b/sonar-ws-generator/src/main/resources/snapshot-of-api.json index 8ea56326f97..72630f2deee 100644 --- a/sonar-ws-generator/src/main/resources/snapshot-of-api.json +++ b/sonar-ws-generator/src/main/resources/snapshot-of-api.json @@ -1902,7 +1902,7 @@ ] }, { - "key": "sinceLeakPeriod", + "key": "inNewCodePeriod", "description": "To retrieve issues created since the leak period.
If this parameter is set to a truthy value, createdAfter must not be set and one component id or key must be provided.", "required": false, "internal": false, -- cgit v1.2.3