]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-16465 Replace parameter sinceLeakPeriod with inNewCodePeriod (#6275)
authorguillaume-peoch-sonarsource <91735163+guillaume-peoch-sonarsource@users.noreply.github.com>
Thu, 14 Jul 2022 13:52:56 +0000 (15:52 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 14 Jul 2022 20:03:47 +0000 (20:03 +0000)
* SONAR-16465 Replace parameter sinceLeakPeriod with inNewCodePeriod

25 files changed:
server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts
server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesApp-test.tsx.snap
server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx
server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/CreationDateFacet-test.tsx
server/sonar-web/src/main/js/apps/issues/utils.ts
server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx
server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx
server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/IssueLabel-test.tsx.snap
server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/QualityGateCondition-test.tsx.snap
server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx
server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx
server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-test.tsx
server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsAppRenderer-test.tsx
server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsApp-test.tsx.snap
server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsAppRenderer-test.tsx.snap
server/sonar-web/src/main/js/apps/security-hotspots/components/FilterBar.tsx
server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/FilterBar-test.tsx
server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx
server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx
server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts
server/sonar-web/src/main/js/helpers/urls.ts
server/sonar-web/src/main/js/types/security-hotspots.ts
server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java
sonar-ws-generator/src/main/resources/snapshot-of-api.json

index a220b5fb9082cd7e0322c2fcb66ba61f8a2e1065..2b4751b9b8e09909ad7091f5280fbc391f36c162 100644 (file)
@@ -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',
index 13685dbe0a5880f8a7658c5a9de71e166c1280f0..515eae8fa6e325cc09028a7a69ccfcb367556438 100644 (file)
@@ -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 [],
index ede16fd2a0cc9bf727ef1e2110d9bc6be353fceb..26169778ac2f9a801a51aaec6429fab92aeab6ba 100644 (file)
@@ -49,7 +49,7 @@ interface Props {
   onChange: (changes: Partial<Query>) => void;
   onToggle: (property: string) => void;
   open: boolean;
-  sinceLeakPeriod: boolean;
+  inNewCodePeriod: boolean;
   stats: Dict<number> | undefined;
 }
 
@@ -65,7 +65,7 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon
     this.props.createdAt.length > 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<Props & WrappedCompon
       createdAt: undefined,
       createdBefore: undefined,
       createdInLast: undefined,
-      sinceLeakPeriod: undefined,
+      inNewCodePeriod: undefined,
       ...changes
     });
   };
@@ -102,7 +102,7 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon
 
   handlePeriodClick = (period: string) => 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<Props & WrappedCompon
       createdAt,
       createdBefore,
       createdInLast,
-      sinceLeakPeriod
+      inNewCodePeriod
     } = this.props;
     const { formatDate } = this.props.intl;
     const values = [];
@@ -138,7 +138,7 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon
     if (createdInLast === '1y') {
       values.push(translate('issues.facet.createdAt.last_year'));
     }
-    if (sinceLeakPeriod) {
+    if (inNewCodePeriod) {
       values.push(translate('issues.new_code'));
     }
     return values;
@@ -221,7 +221,7 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon
   }
 
   renderPredefinedPeriods() {
-    const { component, createdInLast, sinceLeakPeriod } = this.props;
+    const { component, createdInLast, inNewCodePeriod } = this.props;
     return (
       <div className="spacer-top issues-predefined-periods">
         <FacetItem
@@ -233,7 +233,7 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon
         />
         {component && !isPortfolioLike(component.qualifier) ? (
           <FacetItem
-            active={sinceLeakPeriod}
+            active={inNewCodePeriod}
             name={translate('issues.new_code')}
             onClick={this.handleLeakPeriodClick}
             tooltip={translate('issues.new_code_period')}
index dc69ae3909af3add4c858c6e06f3eb6ae700fdcc..29dc3ed819b481941cbb86aff3dd13a2d832bc90 100644 (file)
@@ -212,7 +212,7 @@ export class Sidebar extends React.PureComponent<Props> {
           onChange={this.props.onFilterChange}
           onToggle={this.props.onFacetToggle}
           open={!!openFacets.createdAt}
-          sinceLeakPeriod={query.sinceLeakPeriod}
+          inNewCodePeriod={query.inNewCodePeriod}
           stats={facets.createdAt}
         />
         <LanguageFacet
index ecdf204ce2a69034fd9fce517225f42be736776b..b7dc314c05801b277ba12b9c75b8526d0939dd7c 100644 (file)
@@ -64,7 +64,7 @@ function shallowRender(props?: Partial<CreationDateFacet['props']>) {
       createdAt=""
       createdBefore={undefined}
       createdInLast=""
-      sinceLeakPeriod={false}
+      inNewCodePeriod={false}
       intl={
         {
           formatDate: (date: string) => 'formatted.' + date
index 590e1a4af58f6ceeb738e9e184d72d56de6a62d7..e89d4b011caa04cbddbaf64952f5bcc3d9aa8e37 100644 (file)
@@ -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),
index f1cad7fab13fafc737526bfe1d9934638f80888d..858d3a168da99173c8ace4aa3cd0519d6e725a25 100644 (file)
@@ -54,7 +54,7 @@ export function IssueLabel(props: IssueLabelProps) {
     ...getBranchLikeQuery(branchLike),
     resolved: 'false',
     types: type,
-    sinceLeakPeriod: useDiffMetric ? 'true' : 'false'
+    inNewCodePeriod: useDiffMetric ? 'true' : 'false'
   };
 
   return (
index 084d159d323f0858b0b7813441bc07e648661700..5f8d91fafe81e12f78548e236114a7c9f67749c6 100644 (file)
@@ -40,33 +40,33 @@ interface Props {
 }
 
 export default class QualityGateCondition extends React.PureComponent<Props> {
-  getIssuesUrl = (sinceLeakPeriod: boolean, customQuery: Dict<string>) => {
+  getIssuesUrl = (inNewCodePeriod: boolean, customQuery: Dict<string>) => {
     const query: Dict<string | undefined> = {
       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<string | undefined> = {
       ...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<Props> {
     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<Props> {
         className={className}
         component={component.key}
         metric={condition.measure.metric.key}
-        sinceLeakPeriod={condition.period != null}>
+        inNewCodePeriod={condition.period != null}>
         {children}
       </DrilldownLink>
     );
index ffd998312f22251cb43582373454c947bdc763ec..07600034dc30a752c64cf165a54c347a1d42827b 100644 (file)
@@ -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",
       }
     }
   >
index b4eb8987e86962ab32dd57066518afe56a7b96de..6fc13d55ee83335c1c8a9830459a9c6c8772337a 100644 (file)
@@ -4,8 +4,8 @@ exports[`should render correclty 1`] = `
 <DrilldownLink
   className="overview-quality-gate-condition overview-quality-gate-condition-error"
   component="abcd-key"
+  inNewCodePeriod={false}
   metric="open_issues"
-  sinceLeakPeriod={false}
 >
   <div
     className="overview-quality-gate-condition-container display-flex-center"
@@ -187,7 +187,7 @@ exports[`should render correclty 5`] = `
     Object {
       "hash": "",
       "pathname": "/project/issues",
-      "search": "?resolved=false&types=BUG&severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&sinceLeakPeriod=true&id=abcd-key",
+      "search": "?resolved=false&types=BUG&severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&inNewCodePeriod=true&id=abcd-key",
     }
   }
 >
@@ -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",
     }
   }
 >
index 83b805bd143282bdc67ca16a87c0766ebb6f5322..e8fbee0ee0c8e3b5ddfb306861f2ebb6d0700829 100644 (file)
@@ -127,7 +127,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
       !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<Props, State> {
 
   constructFiltersFromProps(
     props: Props
-  ): Pick<HotspotFilters, 'assignedToMe' | 'sinceLeakPeriod'> {
+  ): Pick<HotspotFilters, 'assignedToMe' | 'inNewCodePeriod'> {
     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<Props, State> {
     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<Props, State> {
           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<Props, State> {
         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<Props, State> {
       status,
       resolution,
       onlyMine: filters.assignedToMe,
-      inNewCodePeriod: filters.sinceLeakPeriod,
+      inNewCodePeriod: filters.inNewCodePeriod,
       ...getBranchLikeQuery(branchLike)
     });
   }
@@ -397,7 +397,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
       ({ filters }) => ({ filters: { ...filters, ...changes } }),
       () => {
         this.reloadSecurityHotspotList();
-        if (changes.sinceLeakPeriod !== undefined) {
+        if (changes.inNewCodePeriod !== undefined) {
           this.fetchSecurityHotspotsReviewed();
         }
       }
index f09495eb815553d778d96640f3d8175c5cf71cf1..0ebff755db02c87b363123350c99ca8edc2b7161 100644 (file)
@@ -130,7 +130,7 @@ export default function SecurityHotspotsAppRenderer(props: SecurityHotspotsAppRe
           <EmptyHotspotsPage
             filtered={
               filters.assignedToMe ||
-              (isBranch(branchLike) && filters.sinceLeakPeriod) ||
+              (isBranch(branchLike) && filters.inNewCodePeriod) ||
               filters.status !== HotspotStatusFilter.TO_REVIEW
             }
             filterByFile={Boolean(filterByFile)}
index 6793d8597439a96fa388aa838cc952dfc1eeda1f..78f58e927e1b240ccf90ef00615b31ade8ef586f 100644 (file)
@@ -201,13 +201,13 @@ it('should load data correctly when hotspot key list is forced', async () => {
 });
 
 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 }));
index 6eb01ce93d001a97449f9b460338f427c03172ca..224eabe8688b960aabf5201fdfa01638277f0d6b 100644 (file)
@@ -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<SecurityHotspotsAppRendererProps> = {}) {
       component={mockComponent()}
       filters={{
         assignedToMe: false,
-        sinceLeakPeriod: false,
+        inNewCodePeriod: false,
         status: HotspotStatusFilter.TO_REVIEW
       }}
       hotspots={[]}
index 2ab1904234a9fd30fca0320d66a3b606dd7f1273..17229150d8811bd1bc6946633ef097910ae856c4 100644 (file)
@@ -35,7 +35,7 @@ exports[`should render correctly 1`] = `
   filters={
     Object {
       "assignedToMe": false,
-      "sinceLeakPeriod": false,
+      "inNewCodePeriod": false,
       "status": "TO_REVIEW",
     }
   }
index 6012cd9ffa7410eafdab0ca66d92d8d78e65eb42..fb069b020e5394786c24d2e5ed209cd223c746dc 100644 (file)
@@ -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",
       }
     }
index 3a7e2733616cf9e1364a4e4783bb08ecf1920f5c..2f4ef10966dac061c60a041f643ef0709c3d43de 100644 (file)
@@ -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)}
                   />
                 )}
               </div>
@@ -151,7 +151,7 @@ export function FilterBar(props: FilterBarProps) {
                     <Measure
                       className="spacer-left huge it__hs-review-percentage"
                       metricKey={
-                        onBranch && !filters.sinceLeakPeriod
+                        onBranch && !filters.inNewCodePeriod
                           ? 'security_hotspots_reviewed'
                           : 'new_security_hotspots_reviewed'
                       }
index 1cb08607edc0232b28646a6547e34d7420a7819e..82aff8346dec55a4920cd474377d4fddcc356842 100644 (file)
@@ -88,7 +88,7 @@ it('should trigger onChange for leak period', () => {
     .props();
 
   onChange({ value: true });
-  expect(onChangeFilters).toBeCalledWith({ sinceLeakPeriod: true });
+  expect(onChangeFilters).toBeCalledWith({ inNewCodePeriod: true });
 });
 
 function shallowRender(props: Partial<FilterBarProps> = {}) {
@@ -98,7 +98,7 @@ function shallowRender(props: Partial<FilterBarProps> = {}) {
       currentUser={mockCurrentUser()}
       filters={{
         assignedToMe: false,
-        sinceLeakPeriod: false,
+        inNewCodePeriod: false,
         status: HotspotStatusFilter.TO_REVIEW
       }}
       isStaticListOfHotspots={false}
index bd368a08cf7a10680efe5856dac2654473f1bcff..56ed2212faf47d30e920b5a65e80ca5e8ee1cdc2 100644 (file)
@@ -78,7 +78,7 @@ interface Props {
   className?: string;
   component: string;
   metric: string;
-  sinceLeakPeriod?: boolean;
+  inNewCodePeriod?: boolean;
 }
 
 export default class DrilldownLink extends React.PureComponent<Props> {
@@ -91,8 +91,8 @@ export default class DrilldownLink extends React.PureComponent<Props> {
       ...(issueParamsPerMetric[this.props.metric] || { resolved: 'false' })
     };
 
-    if (this.props.sinceLeakPeriod) {
-      params.sinceLeakPeriod = true;
+    if (this.props.inNewCodePeriod) {
+      params.inNewCodePeriod = true;
     }
 
     return params;
index 94471a87ad9d53359e257fc1a9289c26817cf4dc..4d7e2c2863b38300f651f35fe1bc26262ef1fc89 100644 (file)
@@ -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
     });
   });
 });
index a881a16e4a15a78b0abd74d245c886ce70e15677..a46d5ae3f83f2b45e2a2cc76b0405324d5f5a86d 100644 (file)
@@ -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',
index d6e71bead373121f67385f88c99c898b4a8a7c1d..0e7ab419f9cc53069b15f9fb232bdcdca965c9ce 100644 (file)
@@ -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,
index 4bd3c60778b307a852d191f0fc5e7b297710eea7..38b3cb5513c90c9ffb95bc7fbfb029db3077a6d8 100644 (file)
@@ -54,7 +54,7 @@ export enum HotspotStatusOption {
 
 export interface HotspotFilters {
   assignedToMe: boolean;
-  sinceLeakPeriod: boolean;
+  inNewCodePeriod: boolean;
   status: HotspotStatusFilter;
 }
 
index fe773f380d0dc0fe1bac5725f3ce6074b5b8c16d..462affd308742833bae382115748a3d4fff619d1 100644 (file)
@@ -317,6 +317,7 @@ public class SearchAction implements IssuesWsAction {
     action.createParam(PARAM_SINCE_LEAK_PERIOD)
       .setDescription("To retrieve issues created since the leak period.<br>" +
         "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.<br>" +
index 8ea56326f974779814ac8483fd65424a394f515e..72630f2deeee0fa1dbd9c0ddf87f1fbbd093a3b6 100644 (file)
               ]
             },
             {
-              "key": "sinceLeakPeriod",
+              "key": "inNewCodePeriod",
               "description": "To retrieve issues created since the leak period.<br>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,