sansTop25: ['a', 'b'],
scopes: ['a', 'b'],
severities: ['a', 'b'],
- sinceLeakPeriod: true,
+ inNewCodePeriod: true,
sonarsourceSecurity: ['a', 'b'],
statuses: ['a', 'b'],
tags: ['a', 'b'],
sansTop25: 'a,b',
scopes: 'a,b',
severities: 'a,b',
- sinceLeakPeriod: 'true',
+ inNewCodePeriod: 'true',
sonarsourceSecurity: 'a,b',
statuses: 'a,b',
tags: 'a,b',
"cwe": Array [],
"directories": Array [],
"files": Array [],
+ "inNewCodePeriod": false,
"issues": Array [],
"languages": Array [],
"owaspTop10": Array [],
"sansTop25": Array [],
"scopes": Array [],
"severities": Array [],
- "sinceLeakPeriod": false,
"sonarsourceSecurity": Array [],
"sort": "",
"statuses": Array [],
onChange: (changes: Partial<Query>) => void;
onToggle: (property: string) => void;
open: boolean;
- sinceLeakPeriod: boolean;
+ inNewCodePeriod: boolean;
stats: Dict<number> | undefined;
}
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);
createdAt: undefined,
createdBefore: undefined,
createdInLast: undefined,
- sinceLeakPeriod: undefined,
+ inNewCodePeriod: undefined,
...changes
});
};
handlePeriodClick = (period: string) => this.resetTo({ createdInLast: period });
- handleLeakPeriodClick = () => this.resetTo({ sinceLeakPeriod: true });
+ handleLeakPeriodClick = () => this.resetTo({ inNewCodePeriod: true });
getValues() {
const {
createdAt,
createdBefore,
createdInLast,
- sinceLeakPeriod
+ inNewCodePeriod
} = this.props;
const { formatDate } = this.props.intl;
const values = [];
if (createdInLast === '1y') {
values.push(translate('issues.facet.createdAt.last_year'));
}
- if (sinceLeakPeriod) {
+ if (inNewCodePeriod) {
values.push(translate('issues.new_code'));
}
return values;
}
renderPredefinedPeriods() {
- const { component, createdInLast, sinceLeakPeriod } = this.props;
+ const { component, createdInLast, inNewCodePeriod } = this.props;
return (
<div className="spacer-top issues-predefined-periods">
<FacetItem
/>
{component && !isPortfolioLike(component.qualifier) ? (
<FacetItem
- active={sinceLeakPeriod}
+ active={inNewCodePeriod}
name={translate('issues.new_code')}
onClick={this.handleLeakPeriodClick}
tooltip={translate('issues.new_code_period')}
onChange={this.props.onFilterChange}
onToggle={this.props.onFacetToggle}
open={!!openFacets.createdAt}
- sinceLeakPeriod={query.sinceLeakPeriod}
+ inNewCodePeriod={query.inNewCodePeriod}
stats={facets.createdAt}
/>
<LanguageFacet
createdAt=""
createdBefore={undefined}
createdInLast=""
- sinceLeakPeriod={false}
+ inNewCodePeriod={false}
intl={
{
formatDate: (date: string) => 'formatted.' + date
sansTop25: string[];
scopes: string[];
severities: string[];
- sinceLeakPeriod: boolean;
+ inNewCodePeriod: boolean;
sonarsourceSecurity: string[];
sort: string;
statuses: string[];
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),
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),
...getBranchLikeQuery(branchLike),
resolved: 'false',
types: type,
- sinceLeakPeriod: useDiffMetric ? 'true' : 'false'
+ inNewCodePeriod: useDiffMetric ? 'true' : 'false'
};
return (
}
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',
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]
});
className={className}
component={component.key}
metric={condition.measure.metric.key}
- sinceLeakPeriod={condition.period != null}>
+ inNewCodePeriod={condition.period != null}>
{children}
</DrilldownLink>
);
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",
}
}
>
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",
}
}
>
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",
}
}
>
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",
}
}
>
Object {
"hash": "",
"pathname": "/security_hotspots",
- "search": "?id=my-project&pullRequest=1001&sinceLeakPeriod=false",
+ "search": "?id=my-project&pullRequest=1001&inNewCodePeriod=false",
}
}
>
Object {
"hash": "",
"pathname": "/security_hotspots",
- "search": "?id=my-project&pullRequest=1001&sinceLeakPeriod=true",
+ "search": "?id=my-project&pullRequest=1001&inNewCodePeriod=true",
}
}
>
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",
}
}
>
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",
}
}
>
<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"
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",
}
}
>
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",
}
}
>
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",
}
}
>
Object {
"hash": "",
"pathname": "/security_hotspots",
- "search": "?id=abcd-key&sinceLeakPeriod=true",
+ "search": "?id=abcd-key&inNewCodePeriod=true",
}
}
>
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",
}
}
>
!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 }
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'
};
}
const { branchLike, component } = this.props;
const { filters } = this.state;
- const reviewedHotspotsMetricKey = filters.sinceLeakPeriod
+ const reviewedHotspotsMetricKey = filters.inNewCodePeriod
? 'new_security_hotspots_reviewed'
: 'security_hotspots_reviewed';
return;
}
const measure = measures && measures.length > 0 ? measures[0] : undefined;
- const hotspotsReviewedMeasure = filters.sinceLeakPeriod
+ const hotspotsReviewedMeasure = filters.inNewCodePeriod
? getLeakValue(measure)
: measure?.value;
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)
});
}
status,
resolution,
onlyMine: filters.assignedToMe,
- inNewCodePeriod: filters.sinceLeakPeriod,
+ inNewCodePeriod: filters.inNewCodePeriod,
...getBranchLikeQuery(branchLike)
});
}
({ filters }) => ({ filters: { ...filters, ...changes } }),
() => {
this.reloadSecurityHotspotList();
- if (changes.sinceLeakPeriod !== undefined) {
+ if (changes.inNewCodePeriod !== undefined) {
this.fetchSecurityHotspotsReviewed();
}
}
<EmptyHotspotsPage
filtered={
filters.assignedToMe ||
- (isBranch(branchLike) && filters.sinceLeakPeriod) ||
+ (isBranch(branchLike) && filters.inNewCodePeriod) ||
filters.status !== HotspotStatusFilter.TO_REVIEW
}
filterByFile={Boolean(filterByFile)}
});
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);
});
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 }));
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');
component={mockComponent()}
filters={{
assignedToMe: false,
- sinceLeakPeriod: false,
+ inNewCodePeriod: false,
status: HotspotStatusFilter.TO_REVIEW
}}
hotspots={[]}
filters={
Object {
"assignedToMe": false,
- "sinceLeakPeriod": false,
+ "inNewCodePeriod": false,
"status": "TO_REVIEW",
}
}
filters={
Object {
"assignedToMe": false,
- "sinceLeakPeriod": false,
+ "inNewCodePeriod": false,
"status": "TO_REVIEW",
}
}
filters={
Object {
"assignedToMe": false,
- "sinceLeakPeriod": false,
+ "inNewCodePeriod": false,
"status": "TO_REVIEW",
}
}
filters={
Object {
"assignedToMe": false,
- "sinceLeakPeriod": false,
+ "inNewCodePeriod": false,
"status": "TO_REVIEW",
}
}
filters={
Object {
"assignedToMe": true,
- "sinceLeakPeriod": false,
+ "inNewCodePeriod": false,
"status": "TO_REVIEW",
}
}
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>
<Measure
className="spacer-left huge it__hs-review-percentage"
metricKey={
- onBranch && !filters.sinceLeakPeriod
+ onBranch && !filters.inNewCodePeriod
? 'security_hotspots_reviewed'
: 'new_security_hotspots_reviewed'
}
.props();
onChange({ value: true });
- expect(onChangeFilters).toBeCalledWith({ sinceLeakPeriod: true });
+ expect(onChangeFilters).toBeCalledWith({ inNewCodePeriod: true });
});
function shallowRender(props: Partial<FilterBarProps> = {}) {
currentUser={mockCurrentUser()}
filters={{
assignedToMe: false,
- sinceLeakPeriod: false,
+ inNewCodePeriod: false,
status: HotspotStatusFilter.TO_REVIEW
}}
isStaticListOfHotspots={false}
className?: string;
component: string;
metric: string;
- sinceLeakPeriod?: boolean;
+ inNewCodePeriod?: boolean;
}
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;
});
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
});
});
});
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',
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',
* 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,
export interface HotspotFilters {
assignedToMe: boolean;
- sinceLeakPeriod: boolean;
+ inNewCodePeriod: boolean;
status: HotspotStatusFilter;
}
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>" +
]
},
{
- "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,