Commit 468cb9f0 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 37 files - 43 of 73

Part of our prettier migration; changing the arrow-parens style.
parent a536349d
...@@ -31,13 +31,13 @@ function getApprovalRuleNamesLeft(data) { ...@@ -31,13 +31,13 @@ function getApprovalRuleNamesLeft(data) {
return []; return [];
} }
const rulesLeft = groupBy(data.approval_rules_left, x => x.rule_type); const rulesLeft = groupBy(data.approval_rules_left, (x) => x.rule_type);
// Filter out empty names (fallback rule has no name) because the empties would look weird. // Filter out empty names (fallback rule has no name) because the empties would look weird.
const regularRules = (rulesLeft[RULE_TYPE_REGULAR] || []).map(x => x.name).filter(x => x); const regularRules = (rulesLeft[RULE_TYPE_REGULAR] || []).map((x) => x.name).filter((x) => x);
// Report Approvals // Report Approvals
const reportApprovalRules = (rulesLeft[RULE_TYPE_REPORT_APPROVER] || []).map(x => x.name); const reportApprovalRules = (rulesLeft[RULE_TYPE_REPORT_APPROVER] || []).map((x) => x.name);
// If there are code owners that need to approve, only mention that once. // If there are code owners that need to approve, only mention that once.
// As the names of code owner rules are patterns that don't mean much out of context. // As the names of code owner rules are patterns that don't mean much out of context.
...@@ -50,7 +50,7 @@ function getApprovalRuleNamesLeft(data) { ...@@ -50,7 +50,7 @@ function getApprovalRuleNamesLeft(data) {
* Map the approval rules response for use by the MR widget * Map the approval rules response for use by the MR widget
*/ */
export function mapApprovalRulesResponse(rules, settings) { export function mapApprovalRulesResponse(rules, settings) {
return rules.map(x => mapApprovalRule(x, settings)); return rules.map((x) => mapApprovalRule(x, settings));
} }
/** /**
......
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
}, },
degradedBrowserPerformanceTotalScore() { degradedBrowserPerformanceTotalScore() {
return this.mr?.browserPerformanceMetrics?.degraded.find( return this.mr?.browserPerformanceMetrics?.degraded.find(
metric => metric.name === __('Total Score'), (metric) => metric.name === __('Total Score'),
); );
}, },
hasBrowserPerformanceDegradation() { hasBrowserPerformanceDegradation() {
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
return ( return (
this.mr.canReadVulnerabilities && this.mr.canReadVulnerabilities &&
enabledReports && enabledReports &&
this.$options.securityReportTypes.some(reportType => enabledReports[reportType]) this.$options.securityReportTypes.some((reportType) => enabledReports[reportType])
); );
}, },
...@@ -191,7 +191,7 @@ export default { ...@@ -191,7 +191,7 @@ export default {
this.isLoadingBrowserPerformance = true; this.isLoadingBrowserPerformance = true;
Promise.all([this.service.fetchReport(head_path), this.service.fetchReport(base_path)]) Promise.all([this.service.fetchReport(head_path), this.service.fetchReport(base_path)])
.then(values => { .then((values) => {
this.mr.compareBrowserPerformanceMetrics(values[0], values[1]); this.mr.compareBrowserPerformanceMetrics(values[0], values[1]);
}) })
.catch(() => { .catch(() => {
...@@ -208,7 +208,7 @@ export default { ...@@ -208,7 +208,7 @@ export default {
this.isLoadingLoadPerformance = true; this.isLoadingLoadPerformance = true;
Promise.all([this.service.fetchReport(head_path), this.service.fetchReport(base_path)]) Promise.all([this.service.fetchReport(head_path), this.service.fetchReport(base_path)])
.then(values => { .then((values) => {
this.mr.compareLoadPerformanceMetrics(values[0], values[1]); this.mr.compareLoadPerformanceMetrics(values[0], values[1]);
}) })
.catch(() => { .catch(() => {
......
...@@ -11,15 +11,15 @@ export default class MRWidgetService extends CEWidgetService { ...@@ -11,15 +11,15 @@ export default class MRWidgetService extends CEWidgetService {
approveMergeRequestWithAuth(approvalPassword) { approveMergeRequestWithAuth(approvalPassword) {
return axios return axios
.post(this.apiApprovePath, { approval_password: approvalPassword }) .post(this.apiApprovePath, { approval_password: approvalPassword })
.then(res => res.data); .then((res) => res.data);
} }
fetchApprovalSettings() { fetchApprovalSettings() {
return axios.get(this.apiApprovalSettingsPath).then(res => res.data); return axios.get(this.apiApprovalSettingsPath).then((res) => res.data);
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
fetchReport(endpoint) { fetchReport(endpoint) {
return axios.get(endpoint).then(res => res.data); return axios.get(endpoint).then((res) => res.data);
} }
} }
...@@ -112,9 +112,9 @@ export default class MergeRequestStore extends CEMergeRequestStore { ...@@ -112,9 +112,9 @@ export default class MergeRequestStore extends CEMergeRequestStore {
const degraded = []; const degraded = [];
const same = []; const same = [];
Object.keys(headMetricsIndexed).forEach(subject => { Object.keys(headMetricsIndexed).forEach((subject) => {
const subjectMetrics = headMetricsIndexed[subject]; const subjectMetrics = headMetricsIndexed[subject];
Object.keys(subjectMetrics).forEach(metric => { Object.keys(subjectMetrics).forEach((metric) => {
const headMetricData = subjectMetrics[metric]; const headMetricData = subjectMetrics[metric];
if (baseMetricsIndexed[subject] && baseMetricsIndexed[subject][metric]) { if (baseMetricsIndexed[subject] && baseMetricsIndexed[subject][metric]) {
...@@ -168,7 +168,7 @@ export default class MergeRequestStore extends CEMergeRequestStore { ...@@ -168,7 +168,7 @@ export default class MergeRequestStore extends CEMergeRequestStore {
const degraded = []; const degraded = [];
const same = []; const same = [];
Object.keys(headMetricsIndexed).forEach(metric => { Object.keys(headMetricsIndexed).forEach((metric) => {
const headMetricData = headMetricsIndexed[metric]; const headMetricData = headMetricsIndexed[metric];
if (metric in baseMetricsIndexed) { if (metric in baseMetricsIndexed) {
const baseMetricData = baseMetricsIndexed[metric]; const baseMetricData = baseMetricsIndexed[metric];
...@@ -204,7 +204,7 @@ export default class MergeRequestStore extends CEMergeRequestStore { ...@@ -204,7 +204,7 @@ export default class MergeRequestStore extends CEMergeRequestStore {
const { metrics } = loadPerformanceData; const { metrics } = loadPerformanceData;
const indexedMetrics = {}; const indexedMetrics = {};
Object.keys(loadPerformanceData.metrics).forEach(metric => { Object.keys(loadPerformanceData.metrics).forEach((metric) => {
switch (metric) { switch (metric) {
case 'http_reqs': case 'http_reqs':
indexedMetrics[s__('ciReport|RPS')] = metrics.http_reqs.rate; indexedMetrics[s__('ciReport|RPS')] = metrics.http_reqs.rate;
......
...@@ -4,7 +4,7 @@ import { GlSkeletonLoader, GlIcon } from '@gitlab/ui'; ...@@ -4,7 +4,7 @@ import { GlSkeletonLoader, GlIcon } from '@gitlab/ui';
import accordionEventBus from './accordion_event_bus'; import accordionEventBus from './accordion_event_bus';
const accordionItemUniqueId = name => uniqueId(`gl-accordion-item-${name}-`); const accordionItemUniqueId = (name) => uniqueId(`gl-accordion-item-${name}-`);
export default { export default {
components: { components: {
......
...@@ -16,7 +16,7 @@ export const tributeConfig = { ...@@ -16,7 +16,7 @@ export const tributeConfig = {
config: { config: {
trigger: '&', trigger: '&',
fillAttr: 'iid', fillAttr: 'iid',
lookup: value => `${value.iid}${value.title}`, lookup: (value) => `${value.iid}${value.title}`,
menuItemTemplate: ({ original }) => menuItemTemplate: ({ original }) =>
`<small>${original.iid}</small> ${escape(original.title)}`, `<small>${original.iid}</small> ${escape(original.title)}`,
}, },
......
...@@ -24,7 +24,7 @@ export const setSelectedEpicIssueId = ({ commit }, selectedEpicIssueId) => ...@@ -24,7 +24,7 @@ export const setSelectedEpicIssueId = ({ commit }, selectedEpicIssueId) =>
export const requestEpics = ({ commit }) => commit(types.REQUEST_EPICS); export const requestEpics = ({ commit }) => commit(types.REQUEST_EPICS);
export const receiveEpicsSuccess = ({ commit }, data) => { export const receiveEpicsSuccess = ({ commit }, data) => {
const epics = data.map(rawEpic => const epics = data.map((rawEpic) =>
convertObjectPropsToCamelCase( convertObjectPropsToCamelCase(
{ ...rawEpic, url: rawEpic.web_edit_url }, { ...rawEpic, url: rawEpic.web_edit_url },
{ {
......
...@@ -11,9 +11,9 @@ import { DropdownVariant } from '../constants'; ...@@ -11,9 +11,9 @@ import { DropdownVariant } from '../constants';
* *
* @param {object} state * @param {object} state
*/ */
export const groupEpics = state => { export const groupEpics = (state) => {
if (state.searchQuery) { if (state.searchQuery) {
return state.epics.filter(epic => { return state.epics.filter((epic) => {
const { title, reference, url, iid } = epic; const { title, reference, url, iid } = epic;
// In case user has just pasted ID // In case user has just pasted ID
...@@ -37,11 +37,11 @@ export const groupEpics = state => { ...@@ -37,11 +37,11 @@ export const groupEpics = state => {
* is `sidebar` * is `sidebar`
* @param {object} state * @param {object} state
*/ */
export const isDropdownVariantSidebar = state => state.variant === DropdownVariant.Sidebar; export const isDropdownVariantSidebar = (state) => state.variant === DropdownVariant.Sidebar;
/** /**
* Returns boolean representing whether dropdown variant * Returns boolean representing whether dropdown variant
* is `standalone` * is `standalone`
* @param {object} state * @param {object} state
*/ */
export const isDropdownVariantStandalone = state => state.variant === DropdownVariant.Standalone; export const isDropdownVariantStandalone = (state) => state.variant === DropdownVariant.Standalone;
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
return ( return (
this.downstreamPipelines && this.downstreamPipelines &&
this.downstreamPipelines.some( this.downstreamPipelines.some(
pipeline => (pipeline) =>
pipeline.details && pipeline.details &&
pipeline.details.status && pipeline.details.status &&
pipeline.details.status.group === STATUS_FAILED, pipeline.details.status.group === STATUS_FAILED,
......
...@@ -27,9 +27,9 @@ export const forceProjectsRequest = () => { ...@@ -27,9 +27,9 @@ export const forceProjectsRequest = () => {
export const addProjectsToDashboard = ({ state, dispatch }) => export const addProjectsToDashboard = ({ state, dispatch }) =>
axios axios
.post(state.projectEndpoints.add, { .post(state.projectEndpoints.add, {
project_ids: state.selectedProjects.map(p => p.id), project_ids: state.selectedProjects.map((p) => p.id),
}) })
.then(response => dispatch('receiveAddProjectsToDashboardSuccess', response.data)) .then((response) => dispatch('receiveAddProjectsToDashboardSuccess', response.data))
.catch(() => dispatch('receiveAddProjectsToDashboardError')); .catch(() => dispatch('receiveAddProjectsToDashboardError'));
export const toggleSelectedProject = ({ commit, state }, project) => { export const toggleSelectedProject = ({ commit, state }, project) => {
...@@ -49,8 +49,8 @@ export const receiveAddProjectsToDashboardSuccess = ({ dispatch, state }, data) ...@@ -49,8 +49,8 @@ export const receiveAddProjectsToDashboardSuccess = ({ dispatch, state }, data)
if (invalid.length) { if (invalid.length) {
const [firstProject, secondProject, ...rest] = state.selectedProjects const [firstProject, secondProject, ...rest] = state.selectedProjects
.filter(project => invalid.includes(project.id)) .filter((project) => invalid.includes(project.id))
.map(project => project.name); .map((project) => project.name);
const translationValues = { const translationValues = {
firstProject, firstProject,
secondProject, secondProject,
...@@ -105,7 +105,7 @@ export const fetchProjects = ({ state, dispatch, commit }, page) => { ...@@ -105,7 +105,7 @@ export const fetchProjects = ({ state, dispatch, commit }, page) => {
fetchProjects: () => axios.get(state.projectEndpoints.list, { params: { page } }), fetchProjects: () => axios.get(state.projectEndpoints.list, { params: { page } }),
}, },
method: 'fetchProjects', method: 'fetchProjects',
successCallback: response => { successCallback: (response) => {
const { const {
data: { projects }, data: { projects },
headers, headers,
...@@ -160,7 +160,7 @@ export const fetchSearchResults = ({ state, dispatch }) => { ...@@ -160,7 +160,7 @@ export const fetchSearchResults = ({ state, dispatch }) => {
dispatch('minimumQueryMessage'); dispatch('minimumQueryMessage');
} else { } else {
Api.projects(searchQuery, {}) Api.projects(searchQuery, {})
.then(results => dispatch('receiveSearchResultsSuccess', results)) .then((results) => dispatch('receiveSearchResultsSuccess', results))
.catch(() => dispatch('receiveSearchResultsError')); .catch(() => dispatch('receiveSearchResultsError'));
} }
}; };
...@@ -170,7 +170,7 @@ export const fetchNextPage = ({ state, dispatch }) => { ...@@ -170,7 +170,7 @@ export const fetchNextPage = ({ state, dispatch }) => {
return; return;
} }
Api.projects(state.searchQuery, { page: state.pageInfo.nextPage }) Api.projects(state.searchQuery, { page: state.pageInfo.nextPage })
.then(results => dispatch('receiveNextPageSuccess', results)) .then((results) => dispatch('receiveNextPageSuccess', results))
.catch(() => dispatch('receiveSearchResultsError')); .catch(() => dispatch('receiveSearchResultsError'));
}; };
......
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
if (AccessorUtilities.isLocalStorageAccessSafe()) { if (AccessorUtilities.isLocalStorageAccessSafe()) {
localStorage.setItem( localStorage.setItem(
state.projectEndpoints.list, state.projectEndpoints.list,
state.projects.map(p => p.id), state.projects.map((p) => p.id),
); );
} else { } else {
createFlash( createFlash(
...@@ -44,12 +44,12 @@ export default { ...@@ -44,12 +44,12 @@ export default {
}, },
[types.ADD_SELECTED_PROJECT](state, project) { [types.ADD_SELECTED_PROJECT](state, project) {
if (!state.selectedProjects.some(p => p.id === project.id)) { if (!state.selectedProjects.some((p) => p.id === project.id)) {
state.selectedProjects.push(project); state.selectedProjects.push(project);
} }
}, },
[types.REMOVE_SELECTED_PROJECT](state, project) { [types.REMOVE_SELECTED_PROJECT](state, project) {
state.selectedProjects = state.selectedProjects.filter(p => p.id !== project.id); state.selectedProjects = state.selectedProjects.filter((p) => p.id !== project.id);
}, },
[types.REQUEST_PROJECTS](state) { [types.REQUEST_PROJECTS](state) {
...@@ -68,7 +68,7 @@ export default { ...@@ -68,7 +68,7 @@ export default {
if (AccessorUtilities.isLocalStorageAccessSafe()) { if (AccessorUtilities.isLocalStorageAccessSafe()) {
localStorage.setItem( localStorage.setItem(
state.projectEndpoints.list, state.projectEndpoints.list,
state.projects.map(p => p.id), state.projects.map((p) => p.id),
); );
} }
......
...@@ -30,14 +30,14 @@ export default { ...@@ -30,14 +30,14 @@ export default {
.select2({ .select2({
allowClear: true, allowClear: true,
placeholder: this.placeholder, placeholder: this.placeholder,
createSearchChoice: term => ({ id: term, text: term }), createSearchChoice: (term) => ({ id: term, text: term }),
createSearchChoicePosition: 'bottom', createSearchChoicePosition: 'bottom',
data: this.knownLicenses.map(license => ({ data: this.knownLicenses.map((license) => ({
id: license, id: license,
text: license, text: license,
})), })),
}) })
.on('change', e => { .on('change', (e) => {
this.$emit('input', e.target.value); this.$emit('input', e.target.value);
}); });
}) })
......
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
license: { license: {
type: Object, type: Object,
required: true, required: true,
validator: license => validator: (license) =>
Boolean(license.name) && Boolean(license.name) &&
Object.values(LICENSE_APPROVAL_STATUS).includes(license.approvalStatus), Object.values(LICENSE_APPROVAL_STATUS).includes(license.approvalStatus),
}, },
......
...@@ -47,7 +47,7 @@ export const deleteLicense = ({ dispatch, state }) => { ...@@ -47,7 +47,7 @@ export const deleteLicense = ({ dispatch, state }) => {
.then(() => { .then(() => {
dispatch('receiveDeleteLicense', licenseId); dispatch('receiveDeleteLicense', licenseId);
}) })
.catch(error => { .catch((error) => {
dispatch('receiveDeleteLicenseError', error); dispatch('receiveDeleteLicenseError', error);
dispatch('removePendingLicense', licenseId); dispatch('removePendingLicense', licenseId);
}); });
...@@ -72,7 +72,7 @@ export const fetchManagedLicenses = ({ dispatch, state }) => { ...@@ -72,7 +72,7 @@ export const fetchManagedLicenses = ({ dispatch, state }) => {
.then(({ data }) => { .then(({ data }) => {
dispatch('receiveManagedLicensesSuccess', data); dispatch('receiveManagedLicensesSuccess', data);
}) })
.catch(error => { .catch((error) => {
dispatch('receiveManagedLicensesError', error); dispatch('receiveManagedLicensesError', error);
}); });
}; };
...@@ -95,7 +95,7 @@ export const fetchParsedLicenseReport = ({ dispatch, state }) => { ...@@ -95,7 +95,7 @@ export const fetchParsedLicenseReport = ({ dispatch, state }) => {
const existingLicenses = (data.existing_licenses || []).map(convertToOldReportFormat); const existingLicenses = (data.existing_licenses || []).map(convertToOldReportFormat);
dispatch('receiveParsedLicenseReportSuccess', { newLicenses, existingLicenses }); dispatch('receiveParsedLicenseReportSuccess', { newLicenses, existingLicenses });
}) })
.catch(error => { .catch((error) => {
dispatch('receiveParsedLicenseReportError', error); dispatch('receiveParsedLicenseReportError', error);
}); });
}; };
...@@ -139,13 +139,13 @@ export const fetchLicenseCheckApprovalRule = ({ dispatch, state }) => { ...@@ -139,13 +139,13 @@ export const fetchLicenseCheckApprovalRule = ({ dispatch, state }) => {
return axios return axios
.get(state.approvalsApiPath) .get(state.approvalsApiPath)
.then(({ data }) => { .then(({ data }) => {
const hasLicenseCheckApprovalRule = data.approval_rules_left.some(rule => { const hasLicenseCheckApprovalRule = data.approval_rules_left.some((rule) => {
return rule.name === LICENSE_CHECK_NAME; return rule.name === LICENSE_CHECK_NAME;
}); });
dispatch('receiveLicenseCheckApprovalRuleSuccess', { hasLicenseCheckApprovalRule }); dispatch('receiveLicenseCheckApprovalRuleSuccess', { hasLicenseCheckApprovalRule });
}) })
.catch(error => { .catch((error) => {
dispatch('receiveLicenseCheckApprovalRuleError', error); dispatch('receiveLicenseCheckApprovalRuleError', error);
}); });
}; };
...@@ -196,7 +196,7 @@ export const setLicenseApproval = ({ dispatch, state }, payload) => { ...@@ -196,7 +196,7 @@ export const setLicenseApproval = ({ dispatch, state }, payload) => {
.then(() => { .then(() => {
dispatch('receiveSetLicenseApproval', id); dispatch('receiveSetLicenseApproval', id);
}) })
.catch(error => { .catch((error) => {
dispatch('receiveSetLicenseApprovalError', error); dispatch('receiveSetLicenseApprovalError', error);
dispatch('removePendingLicense', id); dispatch('removePendingLicense', id);
}); });
......
...@@ -2,20 +2,20 @@ import { n__, s__, sprintf } from '~/locale'; ...@@ -2,20 +2,20 @@ import { n__, s__, sprintf } from '~/locale';
import { addLicensesMatchingReportGroupStatus, reportGroupHasAtLeastOneLicense } from './utils'; import { addLicensesMatchingReportGroupStatus, reportGroupHasAtLeastOneLicense } from './utils';
import { LICENSE_APPROVAL_STATUS, REPORT_GROUPS } from '../constants'; import { LICENSE_APPROVAL_STATUS, REPORT_GROUPS } from '../constants';
export const isLoading = state => export const isLoading = (state) =>
state.isLoadingManagedLicenses || state.isLoadingManagedLicenses ||
state.isLoadingLicenseReport || state.isLoadingLicenseReport ||
state.isLoadingLicenseCheckApprovalRule; state.isLoadingLicenseCheckApprovalRule;
export const isLicenseBeingUpdated = state => (id = null) => state.pendingLicenses.includes(id); export const isLicenseBeingUpdated = (state) => (id = null) => state.pendingLicenses.includes(id);
export const isAddingNewLicense = (_, getters) => getters.isLicenseBeingUpdated(); export const isAddingNewLicense = (_, getters) => getters.isLicenseBeingUpdated();
export const hasPendingLicenses = state => state.pendingLicenses.length > 0; export const hasPendingLicenses = (state) => state.pendingLicenses.length > 0;
export const licenseReport = state => state.newLicenses; export const licenseReport = (state) => state.newLicenses;
export const licenseReportGroups = state => export const licenseReportGroups = (state) =>
REPORT_GROUPS.map(addLicensesMatchingReportGroupStatus(state.newLicenses)).filter( REPORT_GROUPS.map(addLicensesMatchingReportGroupStatus(state.newLicenses)).filter(
reportGroupHasAtLeastOneLicense, reportGroupHasAtLeastOneLicense,
); );
...@@ -24,7 +24,7 @@ export const hasReportItems = (_, getters) => { ...@@ -24,7 +24,7 @@ export const hasReportItems = (_, getters) => {
return Boolean(getters.licenseReportLength); return Boolean(getters.licenseReportLength);
}; };
export const baseReportHasLicenses = state => { export const baseReportHasLicenses = (state) => {
return Boolean(state.existingLicenses.length); return Boolean(state.existingLicenses.length);
}; };
...@@ -118,5 +118,5 @@ export const summaryTextWithoutLicenseCheck = (_, getters) => { ...@@ -118,5 +118,5 @@ export const summaryTextWithoutLicenseCheck = (_, getters) => {
export const reportContainsBlacklistedLicense = (_, getters) => export const reportContainsBlacklistedLicense = (_, getters) =>
(getters.licenseReport || []).some( (getters.licenseReport || []).some(
license => license.approvalStatus === LICENSE_APPROVAL_STATUS.DENIED, (license) => license.approvalStatus === LICENSE_APPROVAL_STATUS.DENIED,
); );
...@@ -121,6 +121,6 @@ export default { ...@@ -121,6 +121,6 @@ export default {
state.pendingLicenses.push(id); state.pendingLicenses.push(id);
}, },
[types.REMOVE_PENDING_LICENSE](state, id) { [types.REMOVE_PENDING_LICENSE](state, id) {
state.pendingLicenses = state.pendingLicenses.filter(pendingLicense => pendingLicense !== id); state.pendingLicenses = state.pendingLicenses.filter((pendingLicense) => pendingLicense !== id);
}, },
}; };
...@@ -11,7 +11,7 @@ import { STATUS_FAILED, STATUS_NEUTRAL, STATUS_SUCCESS } from '~/reports/constan ...@@ -11,7 +11,7 @@ import { STATUS_FAILED, STATUS_NEUTRAL, STATUS_SUCCESS } from '~/reports/constan
* @returns {Object} * @returns {Object}
* *
*/ */
export const normalizeLicense = license => { export const normalizeLicense = (license) => {
const { approval_status: approvalStatus, ...rest } = license; const { approval_status: approvalStatus, ...rest } = license;
return { return {
...rest, ...rest,
...@@ -19,7 +19,7 @@ export const normalizeLicense = license => { ...@@ -19,7 +19,7 @@ export const normalizeLicense = license => {
}; };
}; };
export const getStatusTranslationsFromLicenseStatus = approvalStatus => { export const getStatusTranslationsFromLicenseStatus = (approvalStatus) => {
if (approvalStatus === LICENSE_APPROVAL_STATUS.ALLOWED) { if (approvalStatus === LICENSE_APPROVAL_STATUS.ALLOWED) {
return s__('LicenseCompliance|Allowed'); return s__('LicenseCompliance|Allowed');
} else if (approvalStatus === LICENSE_APPROVAL_STATUS.DENIED) { } else if (approvalStatus === LICENSE_APPROVAL_STATUS.DENIED) {
...@@ -28,7 +28,7 @@ export const getStatusTranslationsFromLicenseStatus = approvalStatus => { ...@@ -28,7 +28,7 @@ export const getStatusTranslationsFromLicenseStatus = approvalStatus => {
return ''; return '';
}; };
export const getIssueStatusFromLicenseStatus = approvalStatus => { export const getIssueStatusFromLicenseStatus = (approvalStatus) => {
if (approvalStatus === LICENSE_APPROVAL_STATUS.ALLOWED) { if (approvalStatus === LICENSE_APPROVAL_STATUS.ALLOWED) {
return STATUS_SUCCESS; return STATUS_SUCCESS;
} else if (approvalStatus === LICENSE_APPROVAL_STATUS.DENIED) { } else if (approvalStatus === LICENSE_APPROVAL_STATUS.DENIED) {
...@@ -55,13 +55,13 @@ export const getPackagesString = (packages, truncate, maxPackages) => { ...@@ -55,13 +55,13 @@ export const getPackagesString = (packages, truncate, maxPackages) => {
// and truncate is true. // and truncate is true.
packagesString = packages packagesString = packages
.slice(0, maxPackages) .slice(0, maxPackages)
.map(packageItem => packageItem.name) .map((packageItem) => packageItem.name)
.join(', '); .join(', ');
} else { } else {
// Return all package names separated by comma with proper grammar // Return all package names separated by comma with proper grammar
packagesString = packages packagesString = packages
.slice(0, packages.length - 1) .slice(0, packages.length - 1)
.map(packageItem => packageItem.name) .map((packageItem) => packageItem.name)
.join(', '); .join(', ');
lastPackage = packages[packages.length - 1].name; lastPackage = packages[packages.length - 1].name;
} }
...@@ -83,7 +83,7 @@ export const getPackagesString = (packages, truncate, maxPackages) => { ...@@ -83,7 +83,7 @@ export const getPackagesString = (packages, truncate, maxPackages) => {
* @returns {Object} The converted license; * @returns {Object} The converted license;
*/ */
export const convertToOldReportFormat = license => { export const convertToOldReportFormat = (license) => {
const approvalStatus = license.classification.approval_status; const approvalStatus = license.classification.approval_status;
return { return {
...@@ -104,10 +104,10 @@ export const convertToOldReportFormat = license => { ...@@ -104,10 +104,10 @@ export const convertToOldReportFormat = license => {
* @param {Array} licenses * @param {Array} licenses
* @returns {function(*): {licenses: (*|*[])}} * @returns {function(*): {licenses: (*|*[])}}
*/ */
export const addLicensesMatchingReportGroupStatus = licenses => { export const addLicensesMatchingReportGroupStatus = (licenses) => {
const licensesGroupedByStatus = groupBy(licenses, 'status'); const licensesGroupedByStatus = groupBy(licenses, 'status');
return reportGroup => ({ return (reportGroup) => ({
...reportGroup, ...reportGroup,
licenses: licensesGroupedByStatus[reportGroup.status] || [], licenses: licensesGroupedByStatus[reportGroup.status] || [],
}); });
......
import { LOADING, ERROR, SUCCESS } from '../constants'; import { LOADING, ERROR, SUCCESS } from '../constants';
export const summaryStatus = state => { export const summaryStatus = (state) => {
if (state.isLoading) { if (state.isLoading) {
return LOADING; return LOADING;
} }
...@@ -12,8 +12,8 @@ export const summaryStatus = state => { ...@@ -12,8 +12,8 @@ export const summaryStatus = state => {
return SUCCESS; return SUCCESS;
}; };
export const metrics = state => [ export const metrics = (state) => [
...state.newMetrics.map(metric => ({ ...metric, isNew: true })), ...state.newMetrics.map((metric) => ({ ...metric, isNew: true })),
...state.existingMetrics, ...state.existingMetrics,
...state.removedMetrics.map(metric => ({ ...metric, wasRemoved: true })), ...state.removedMetrics.map((metric) => ({ ...metric, wasRemoved: true })),
]; ];
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
state.removedMetrics = response.removed_metrics || []; state.removedMetrics = response.removed_metrics || [];
state.numberOfChanges = state.numberOfChanges =
state.existingMetrics.filter(metric => metric.previous_value !== undefined).length + state.existingMetrics.filter((metric) => metric.previous_value !== undefined).length +
state.newMetrics.length + state.newMetrics.length +
state.removedMetrics.length; state.removedMetrics.length;
}, },
......
...@@ -66,7 +66,7 @@ export default { ...@@ -66,7 +66,7 @@ export default {
}, },
recordedMessage() { recordedMessage() {
return this.vulnerability.supporting_messages?.find( return this.vulnerability.supporting_messages?.find(
msg => msg.name === SUPPORTING_MESSAGE_TYPES.RECORDED, (msg) => msg.name === SUPPORTING_MESSAGE_TYPES.RECORDED,
)?.response; )?.response;
}, },
constructedRequest() { constructedRequest() {
......
...@@ -67,7 +67,7 @@ export const fetchContainerScanningDiff = ({ state, dispatch }) => { ...@@ -67,7 +67,7 @@ export const fetchContainerScanningDiff = ({ state, dispatch }) => {
dispatch('requestContainerScanningDiff'); dispatch('requestContainerScanningDiff');
return fetchDiffData(state, state.containerScanning.paths.diffEndpoint, 'container_scanning') return fetchDiffData(state, state.containerScanning.paths.diffEndpoint, 'container_scanning')
.then(data => { .then((data) => {
dispatch('receiveContainerScanningDiffSuccess', data); dispatch('receiveContainerScanningDiffSuccess', data);
}) })
.catch(() => { .catch(() => {
...@@ -96,7 +96,7 @@ export const fetchDastDiff = ({ state, dispatch }) => { ...@@ -96,7 +96,7 @@ export const fetchDastDiff = ({ state, dispatch }) => {
dispatch('requestDastDiff'); dispatch('requestDastDiff');
return fetchDiffData(state, state.dast.paths.diffEndpoint, 'dast') return fetchDiffData(state, state.dast.paths.diffEndpoint, 'dast')
.then(data => { .then((data) => {
dispatch('receiveDastDiffSuccess', data); dispatch('receiveDastDiffSuccess', data);
}) })
.catch(() => { .catch(() => {
...@@ -124,7 +124,7 @@ export const fetchDependencyScanningDiff = ({ state, dispatch }) => { ...@@ -124,7 +124,7 @@ export const fetchDependencyScanningDiff = ({ state, dispatch }) => {
dispatch('requestDependencyScanningDiff'); dispatch('requestDependencyScanningDiff');
return fetchDiffData(state, state.dependencyScanning.paths.diffEndpoint, 'dependency_scanning') return fetchDiffData(state, state.dependencyScanning.paths.diffEndpoint, 'dependency_scanning')
.then(data => { .then((data) => {
dispatch('receiveDependencyScanningDiffSuccess', data); dispatch('receiveDependencyScanningDiffSuccess', data);
}) })
.catch(() => { .catch(() => {
...@@ -161,7 +161,7 @@ export const fetchCoverageFuzzingDiff = ({ state, dispatch }) => { ...@@ -161,7 +161,7 @@ export const fetchCoverageFuzzingDiff = ({ state, dispatch }) => {
}, },
}), }),
]) ])
.then(values => { .then((values) => {
dispatch('receiveCoverageFuzzingDiffSuccess', { dispatch('receiveCoverageFuzzingDiffSuccess', {
diff: values[0].data, diff: values[0].data,
enrichData: values[1].data, enrichData: values[1].data,
...@@ -371,7 +371,7 @@ export const createNewIssue = ({ state, dispatch }) => { ...@@ -371,7 +371,7 @@ export const createNewIssue = ({ state, dispatch }) => {
vulnerability_data: state.modal.vulnerability, vulnerability_data: state.modal.vulnerability,
}, },
}) })
.then(response => { .then((response) => {
dispatch('receiveCreateIssue'); dispatch('receiveCreateIssue');
// redirect the user to the created issue // redirect the user to the created issue
visitUrl(response.data.issue_url); visitUrl(response.data.issue_url);
......
...@@ -59,13 +59,13 @@ export const dependencyScanningStatusIcon = ({ dependencyScanning }) => ...@@ -59,13 +59,13 @@ export const dependencyScanningStatusIcon = ({ dependencyScanning }) =>
export const coverageFuzzingStatusIcon = ({ coverageFuzzing }) => export const coverageFuzzingStatusIcon = ({ coverageFuzzing }) =>
statusIcon(coverageFuzzing.isLoading, coverageFuzzing.hasError, coverageFuzzing.newIssues.length); statusIcon(coverageFuzzing.isLoading, coverageFuzzing.hasError, coverageFuzzing.newIssues.length);
export const isBaseSecurityReportOutOfDate = state => export const isBaseSecurityReportOutOfDate = (state) =>
state.reportTypes.some(reportType => state[reportType].baseReportOutofDate); state.reportTypes.some((reportType) => state[reportType].baseReportOutofDate);
export const canCreateIssue = state => Boolean(state.createVulnerabilityFeedbackIssuePath); export const canCreateIssue = (state) => Boolean(state.createVulnerabilityFeedbackIssuePath);
export const canCreateMergeRequest = state => export const canCreateMergeRequest = (state) =>
Boolean(state.createVulnerabilityFeedbackMergeRequestPath); Boolean(state.createVulnerabilityFeedbackMergeRequestPath);
export const canDismissVulnerability = state => export const canDismissVulnerability = (state) =>
Boolean(state.createVulnerabilityFeedbackDismissalPath); Boolean(state.createVulnerabilityFeedbackDismissalPath);
...@@ -15,7 +15,7 @@ export const fetchDiff = ({ state, rootState, dispatch }) => { ...@@ -15,7 +15,7 @@ export const fetchDiff = ({ state, rootState, dispatch }) => {
dispatch('requestDiff'); dispatch('requestDiff');
return fetchDiffData(rootState, state.paths.diffEndpoint, 'api_fuzzing') return fetchDiffData(rootState, state.paths.diffEndpoint, 'api_fuzzing')
.then(data => { .then((data) => {
dispatch('receiveDiffSuccess', data); dispatch('receiveDiffSuccess', data);
}) })
.catch(() => { .catch(() => {
......
import { statusIcon, groupedReportText } from '../../utils'; import { statusIcon, groupedReportText } from '../../utils';
import messages from '../../messages'; import messages from '../../messages';
export const groupedApiFuzzingText = state => export const groupedApiFuzzingText = (state) =>
groupedReportText( groupedReportText(
state, state,
messages.API_FUZZING, messages.API_FUZZING,
......
import { statusIcon, groupedReportText } from '../../utils'; import { statusIcon, groupedReportText } from '../../utils';
import messages from '../../messages'; import messages from '../../messages';
export const groupedSastText = state => export const groupedSastText = (state) =>
groupedReportText(state, messages.SAST, messages.SAST_HAS_ERROR, messages.SAST_IS_LOADING); groupedReportText(state, messages.SAST, messages.SAST_HAS_ERROR, messages.SAST_IS_LOADING);
export const sastStatusIcon = ({ isLoading, hasError, newIssues }) => export const sastStatusIcon = ({ isLoading, hasError, newIssues }) =>
......
import { statusIcon, groupedReportText } from '../../utils'; import { statusIcon, groupedReportText } from '../../utils';
import messages from '../../messages'; import messages from '../../messages';
export const groupedSecretDetectionText = state => export const groupedSecretDetectionText = (state) =>
groupedReportText( groupedReportText(
state, state,
messages.SECRET_SCANNING, messages.SECRET_SCANNING,
......
...@@ -11,7 +11,7 @@ export { groupedTextBuilder, countVulnerabilities }; ...@@ -11,7 +11,7 @@ export { groupedTextBuilder, countVulnerabilities };
* @param {Object} issue * @param {Object} issue
*/ */
export const findIssueIndex = (issues, issue) => export const findIssueIndex = (issues, issue) =>
issues.findIndex(el => el.project_fingerprint === issue.project_fingerprint); issues.findIndex((el) => el.project_fingerprint === issue.project_fingerprint);
export const statusIcon = (loading = false, failed = false, newIssues = 0, neutralIssues = 0) => { export const statusIcon = (loading = false, failed = false, newIssues = 0, neutralIssues = 0) => {
if (loading) { if (loading) {
......
...@@ -6,7 +6,7 @@ import { humanize } from '~/lib/utils/text_utility'; ...@@ -6,7 +6,7 @@ import { humanize } from '~/lib/utils/text_utility';
* @param {string} reportType that is not human-readable * @param {string} reportType that is not human-readable
* @returns {string} a human-readable version of the report type * @returns {string} a human-readable version of the report type
*/ */
const convertReportType = reportType => { const convertReportType = (reportType) => {
if (!reportType) return ''; if (!reportType) return '';
const lowerCaseType = reportType.toLowerCase(); const lowerCaseType = reportType.toLowerCase();
return REPORT_TYPES[lowerCaseType] || humanize(lowerCaseType); return REPORT_TYPES[lowerCaseType] || humanize(lowerCaseType);
......
...@@ -6,7 +6,7 @@ import { PRIMARY_IDENTIFIER_TYPE } from 'ee/security_dashboard/store/constants'; ...@@ -6,7 +6,7 @@ import { PRIMARY_IDENTIFIER_TYPE } from 'ee/security_dashboard/store/constants';
* @returns {String} the primary identifier's name * @returns {String} the primary identifier's name
*/ */
const getPrimaryIdentifier = (identifiers = [], property) => { const getPrimaryIdentifier = (identifiers = [], property) => {
const identifier = identifiers.find(value => value[property] === PRIMARY_IDENTIFIER_TYPE); const identifier = identifiers.find((value) => value[property] === PRIMARY_IDENTIFIER_TYPE);
return identifier?.name || identifiers[0]?.name || ''; return identifier?.name || identifiers[0]?.name || '';
}; };
......
...@@ -62,7 +62,7 @@ export default { ...@@ -62,7 +62,7 @@ export default {
}, },
recordedMessage() { recordedMessage() {
return this.vulnerability?.supportingMessages?.find( return this.vulnerability?.supportingMessages?.find(
msg => msg.name === SUPPORTING_MESSAGE_TYPES.RECORDED, (msg) => msg.name === SUPPORTING_MESSAGE_TYPES.RECORDED,
)?.response; )?.response;
}, },
constructedRequest() { constructedRequest() {
...@@ -85,7 +85,7 @@ export default { ...@@ -85,7 +85,7 @@ export default {
content: this.constructedRequest, content: this.constructedRequest,
isCode: true, isCode: true,
}, },
].filter(x => x.content); ].filter((x) => x.content);
}, },
responseData() { responseData() {
if (!this.vulnerability.response) { if (!this.vulnerability.response) {
...@@ -98,7 +98,7 @@ export default { ...@@ -98,7 +98,7 @@ export default {
content: this.constructedResponse, content: this.constructedResponse,
isCode: true, isCode: true,
}, },
].filter(x => x.content); ].filter((x) => x.content);
}, },
recordedResponseData() { recordedResponseData() {
if (!this.recordedMessage) { if (!this.recordedMessage) {
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
content: this.constructedRecordedResponse, content: this.constructedRecordedResponse,
isCode: true, isCode: true,
}, },
].filter(x => x.content); ].filter((x) => x.content);
}, },
shouldShowLocation() { shouldShowLocation() {
return ( return (
......
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
}, },
noteDictionary() { noteDictionary() {
return this.discussions return this.discussions
.flatMap(x => x.notes) .flatMap((x) => x.notes)
.reduce((acc, note) => { .reduce((acc, note) => {
acc[note.id] = note; acc[note.id] = note;
return acc; return acc;
...@@ -156,11 +156,11 @@ export default { ...@@ -156,11 +156,11 @@ export default {
updateNotes(notes) { updateNotes(notes) {
let isVulnerabilityStateChanged = false; let isVulnerabilityStateChanged = false;
notes.forEach(note => { notes.forEach((note) => {
// If the note exists, update it. // If the note exists, update it.
if (this.noteDictionary[note.id]) { if (this.noteDictionary[note.id]) {
const updatedDiscussion = { ...this.discussionsDictionary[note.discussionId] }; const updatedDiscussion = { ...this.discussionsDictionary[note.discussionId] };
updatedDiscussion.notes = updatedDiscussion.notes.map(curr => updatedDiscussion.notes = updatedDiscussion.notes.map((curr) =>
curr.id === note.id ? note : curr, curr.id === note.id ? note : curr,
); );
this.discussionsDictionary[note.discussionId] = updatedDiscussion; this.discussionsDictionary[note.discussionId] = updatedDiscussion;
......
...@@ -116,7 +116,7 @@ export default { ...@@ -116,7 +116,7 @@ export default {
this.isLoadingUser = true; this.isLoadingUser = true;
UsersCache.retrieveById(id) UsersCache.retrieveById(id)
.then(userData => { .then((userData) => {
this.user = userData; this.user = userData;
}) })
.catch(() => { .catch(() => {
...@@ -221,7 +221,7 @@ export default { ...@@ -221,7 +221,7 @@ export default {
.then(({ data }) => { .then(({ data }) => {
Object.assign(this.vulnerability, data); Object.assign(this.vulnerability, data);
}) })
.catch(e => { .catch((e) => {
// Don't show an error message if the request was cancelled through the cancel token. // Don't show an error message if the request was cancelled through the cancel token.
if (!axios.isCancel(e)) { if (!axios.isCancel(e)) {
createFlash( createFlash(
......
...@@ -21,10 +21,10 @@ export default { ...@@ -21,10 +21,10 @@ export default {
}, },
computed: { computed: {
systemNote() { systemNote() {
return this.notes.find(x => x.system === true); return this.notes.find((x) => x.system === true);
}, },
comments() { comments() {
return this.notes.filter(x => x !== this.systemNote); return this.notes.filter((x) => x !== this.systemNote);
}, },
}, },
watch: { watch: {
......
...@@ -54,7 +54,7 @@ export default { ...@@ -54,7 +54,7 @@ export default {
return this.projectPath.replace(/^\//, ''); // Remove the leading slash, i.e. '/root/test' -> 'root/test'. return this.projectPath.replace(/^\//, ''); // Remove the leading slash, i.e. '/root/test' -> 'root/test'.
}, },
isIssueAlreadyCreated() { isIssueAlreadyCreated() {
return Boolean(this.state.relatedIssues.find(i => i.lockIssueRemoval)); return Boolean(this.state.relatedIssues.find((i) => i.lockIssueRemoval));
}, },
canCreateIssue() { canCreateIssue() {
return !this.isIssueAlreadyCreated && !this.isFetching && Boolean(this.newIssueUrl); return !this.isIssueAlreadyCreated && !this.isFetching && Boolean(this.newIssueUrl);
...@@ -102,7 +102,7 @@ export default { ...@@ -102,7 +102,7 @@ export default {
const errors = []; const errors = [];
// The endpoint can only accept one issue, so we need to do a separate call for each pending reference. // The endpoint can only accept one issue, so we need to do a separate call for each pending reference.
const requests = this.state.pendingReferences.map(reference => { const requests = this.state.pendingReferences.map((reference) => {
return axios return axios
.post( .post(
this.endpoint, this.endpoint,
...@@ -132,7 +132,7 @@ export default { ...@@ -132,7 +132,7 @@ export default {
this.isFormVisible = hasErrors; this.isFormVisible = hasErrors;
if (hasErrors) { if (hasErrors) {
const messages = errors.map(error => sprintf(RELATED_ISSUES_ERRORS.LINK_ERROR, error)); const messages = errors.map((error) => sprintf(RELATED_ISSUES_ERRORS.LINK_ERROR, error));
createFlash(messages.join(' ')); createFlash(messages.join(' '));
} }
}); });
...@@ -157,7 +157,7 @@ export default { ...@@ -157,7 +157,7 @@ export default {
.then(({ data }) => { .then(({ data }) => {
const issues = data.map(getFormattedIssue); const issues = data.map(getFormattedIssue);
this.store.setRelatedIssues( this.store.setRelatedIssues(
issues.map(i => { issues.map((i) => {
const lockIssueRemoval = i.vulnerability_link_type === 'created'; const lockIssueRemoval = i.vulnerability_link_type === 'created';
return { return {
...@@ -185,7 +185,7 @@ export default { ...@@ -185,7 +185,7 @@ export default {
this.store.removePendingRelatedIssue(indexToRemove); this.store.removePendingRelatedIssue(indexToRemove);
}, },
processAllReferences(value = '') { processAllReferences(value = '') {
const rawReferences = value.split(/\s+/).filter(reference => reference.trim().length > 0); const rawReferences = value.split(/\s+/).filter((reference) => reference.trim().length > 0);
this.addPendingReferences({ untouchedRawReferences: rawReferences }); this.addPendingReferences({ untouchedRawReferences: rawReferences });
}, },
}, },
......
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
} }
}, },
isAlreadyDismissed() { isAlreadyDismissed() {
return this.alreadyDismissedVulnerabilities().some(id => id === this.vulnerabilityId); return this.alreadyDismissedVulnerabilities().some((id) => id === this.vulnerabilityId);
}, },
dismiss() { dismiss() {
const dismissed = this.alreadyDismissedVulnerabilities().concat(this.vulnerabilityId); const dismissed = this.alreadyDismissedVulnerabilities().concat(this.vulnerabilityId);
......
...@@ -2,7 +2,7 @@ import { isAbsolute, isSafeURL } from '~/lib/utils/url_utility'; ...@@ -2,7 +2,7 @@ import { isAbsolute, isSafeURL } from '~/lib/utils/url_utility';
import { REGEXES } from './constants'; import { REGEXES } from './constants';
// Get the issue in the format expected by the descendant components of related_issues_block.vue. // Get the issue in the format expected by the descendant components of related_issues_block.vue.
export const getFormattedIssue = issue => ({ export const getFormattedIssue = (issue) => ({
...issue, ...issue,
reference: `#${issue.iid}`, reference: `#${issue.iid}`,
path: issue.web_url, path: issue.web_url,
......
...@@ -3,7 +3,7 @@ import App from 'ee/vulnerabilities/components/vulnerability.vue'; ...@@ -3,7 +3,7 @@ import App from 'ee/vulnerabilities/components/vulnerability.vue';
import apolloProvider from 'ee/security_dashboard/graphql/provider'; import apolloProvider from 'ee/security_dashboard/graphql/provider';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
export default el => { export default (el) => {
if (!el) { if (!el) {
return null; return null;
} }
...@@ -23,7 +23,7 @@ export default el => { ...@@ -23,7 +23,7 @@ export default el => {
issueTrackingHelpPath: vulnerability.issueTrackingHelpPath, issueTrackingHelpPath: vulnerability.issueTrackingHelpPath,
permissionsHelpPath: vulnerability.permissionsHelpPath, permissionsHelpPath: vulnerability.permissionsHelpPath,
}, },
render: h => render: (h) =>
h(App, { h(App, {
props: { vulnerability }, props: { vulnerability },
}), }),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment