From 2cc3517422bc90150ebe5dfcc70a95f76b2a9f9d Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 06:36:05 +0000 Subject: [PATCH] refactor: autofix issues in 11 files Many built-in functions defined on prototypes for `Object` and `Array` are pure, and return modified versions of their inputs. If the return values from these functions aren't used, the function call is essentially a no-op and might as well be removed. --- .../components/ActivityLog/activityLogLogic.insight.test.tsx | 2 +- frontend/src/lib/integrations/IntegrationScopesWarning.tsx | 2 +- frontend/src/mocks/utils.ts | 4 ++-- .../scenes/feature-flags/FeatureFlagReleaseConditionsLogic.ts | 2 +- frontend/src/scenes/pipeline/utils.tsx | 2 +- frontend/src/scenes/projectLogic.ts | 2 +- .../player/inspector/playerInspectorLogic.ts | 2 +- frontend/src/scenes/teamLogic.tsx | 2 +- .../src/cdp/legacy-plugins/_destinations/salesforce/index.ts | 2 +- plugin-server/src/worker/ingestion/person-state.ts | 4 ++-- plugin-server/tests/worker/console.test.ts | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/frontend/src/lib/components/ActivityLog/activityLogLogic.insight.test.tsx b/frontend/src/lib/components/ActivityLog/activityLogLogic.insight.test.tsx index a302f831743a..b25da7118305 100644 --- a/frontend/src/lib/components/ActivityLog/activityLogLogic.insight.test.tsx +++ b/frontend/src/lib/components/ActivityLog/activityLogLogic.insight.test.tsx @@ -430,7 +430,7 @@ describe('the activity log logic', () => { ) }) const formats = ['png', 'pdf', 'csv'] - formats.map((format) => { + formats.forEach((format) => { it(`can handle export of insight to ${format}`, async () => { const logic = await insightTestSetup('test insight', 'exported', [ { diff --git a/frontend/src/lib/integrations/IntegrationScopesWarning.tsx b/frontend/src/lib/integrations/IntegrationScopesWarning.tsx index c9e6c7a61d76..5000f8dbb450 100644 --- a/frontend/src/lib/integrations/IntegrationScopesWarning.tsx +++ b/frontend/src/lib/integrations/IntegrationScopesWarning.tsx @@ -16,7 +16,7 @@ export function IntegrationScopesWarning({ const scopes: any[] = [] const possibleScopeLocation = [integration.config.scope, integration.config.scopes] - possibleScopeLocation.map((scope) => { + possibleScopeLocation.forEach((scope) => { if (typeof scope === 'string') { scopes.push(scope.split(' ')) scopes.push(scope.split(',')) diff --git a/frontend/src/mocks/utils.ts b/frontend/src/mocks/utils.ts index e6bcda39be06..ffe8a53658c8 100644 --- a/frontend/src/mocks/utils.ts +++ b/frontend/src/mocks/utils.ts @@ -11,8 +11,8 @@ export type Mocks = Partial[] => { const response: ReturnType<(typeof rest)['get']>[] = [] - Object.entries(mocks).map(([method, mockHandlers]) => { - Object.entries(mockHandlers).map(([path, handler]) => { + Object.entries(mocks).forEach(([method, mockHandlers]) => { + Object.entries(mockHandlers).forEach(([path, handler]) => { const pathWithoutTrailingSlash = path.replace(/\/$/, '') response.push( (rest[method] as (typeof rest)['get'])(pathWithoutTrailingSlash, async (req, res, ctx) => { diff --git a/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsLogic.ts b/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsLogic.ts index f4b5e9dc45a4..24e96530b7a5 100644 --- a/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsLogic.ts +++ b/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsLogic.ts @@ -171,7 +171,7 @@ export const featureFlagReleaseConditionsLogic = kea { const previousLength = Object.keys(values.affectedUsers).length - range(index, previousLength).map((idx) => { + range(index, previousLength).forEach((idx) => { const count = previousLength - 1 === idx ? undefined : values.affectedUsers[idx + 1] actions.setAffectedUsers(idx, count) }) diff --git a/frontend/src/scenes/pipeline/utils.tsx b/frontend/src/scenes/pipeline/utils.tsx index a2463cfccc94..83ebc32f5070 100644 --- a/frontend/src/scenes/pipeline/utils.tsx +++ b/frontend/src/scenes/pipeline/utils.tsx @@ -286,7 +286,7 @@ export function pipelineNodeMenuCommonItems(node: Transformation | SiteApp | Imp }, ] if (node.backend === PipelineBackend.Plugin) { - items.concat(pluginMenuItems(node)) + items.push(...pluginMenuItems(node)) } return items } diff --git a/frontend/src/scenes/projectLogic.ts b/frontend/src/scenes/projectLogic.ts index da2d3eaddb7b..37aa7cdef784 100644 --- a/frontend/src/scenes/projectLogic.ts +++ b/frontend/src/scenes/projectLogic.ts @@ -69,7 +69,7 @@ export const projectLogic = kea([ actions.loadCurrentOrganization() actions.loadUser() - Object.keys(payload).map((property) => { + Object.keys(payload).forEach((property) => { eventUsageLogic.findMounted()?.actions?.reportProjectSettingChange(property, payload[property]) }) diff --git a/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.ts b/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.ts index 09cdb719805e..256775f1b3e6 100644 --- a/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.ts +++ b/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.ts @@ -558,7 +558,7 @@ export const playerInspectorLogic = kea([ segments .filter((segment) => segment.kind === 'gap') .filter((segment) => segment.durationMs > 15000) - .map((segment) => { + .forEach((segment) => { const { timestamp, timeInRecording } = timeRelativeToStart( { timestamp: segment.startTimestamp }, start diff --git a/frontend/src/scenes/teamLogic.tsx b/frontend/src/scenes/teamLogic.tsx index 78da67045ff1..e3a72fc0f4b8 100644 --- a/frontend/src/scenes/teamLogic.tsx +++ b/frontend/src/scenes/teamLogic.tsx @@ -132,7 +132,7 @@ export const teamLogic = kea([ message = `${parseUpdatedAttributeName(updatedAttribute)} updated successfully!` } - Object.keys(payload).map((property) => { + Object.keys(payload).forEach((property) => { eventUsageLogic.findMounted()?.actions?.reportTeamSettingChange(property, payload[property]) }) diff --git a/plugin-server/src/cdp/legacy-plugins/_destinations/salesforce/index.ts b/plugin-server/src/cdp/legacy-plugins/_destinations/salesforce/index.ts index 6f77a133cf86..f24f75592e8c 100644 --- a/plugin-server/src/cdp/legacy-plugins/_destinations/salesforce/index.ts +++ b/plugin-server/src/cdp/legacy-plugins/_destinations/salesforce/index.ts @@ -57,7 +57,7 @@ const validateEventSinkConfig = (config: SalesforcePluginConfig): void => { const eventMapping = parseEventSinkConfig(config) if (eventMapping !== null) { - Object.entries(eventMapping).map((entry) => { + Object.entries(eventMapping).forEach((entry) => { const eventSink = entry[1] if (eventSink.salesforcePath == null || eventSink.salesforcePath.trim() === '') { throw new Error('You must provide a salesforce path for each mapping in config.eventEndpointMapping.') diff --git a/plugin-server/src/worker/ingestion/person-state.ts b/plugin-server/src/worker/ingestion/person-state.ts index ea770a58119b..f6c015f70e1d 100644 --- a/plugin-server/src/worker/ingestion/person-state.ts +++ b/plugin-server/src/worker/ingestion/person-state.ts @@ -363,14 +363,14 @@ export class PersonState { let updated = false // tracking as set because we only care about if other or geoip was the cause of the update, not how many properties got updated const metricsKeys = new Set() - Object.entries(propertiesOnce).map(([key, value]) => { + Object.entries(propertiesOnce).forEach(([key, value]) => { if (typeof personProperties[key] === 'undefined') { updated = true metricsKeys.add(this.getMetricKey(key)) personProperties[key] = value } }) - Object.entries(properties).map(([key, value]) => { + Object.entries(properties).forEach(([key, value]) => { if (personProperties[key] !== value) { if (typeof personProperties[key] === 'undefined' || this.shouldUpdatePersonIfOnlyChange(key)) { updated = true diff --git a/plugin-server/tests/worker/console.test.ts b/plugin-server/tests/worker/console.test.ts index 7ebd551427c4..0fd0a2cd95dc 100644 --- a/plugin-server/tests/worker/console.test.ts +++ b/plugin-server/tests/worker/console.test.ts @@ -22,7 +22,7 @@ describe('console extension', () => { await closeHub(hub) }) - Object.values(PluginLogEntryType).map((type) => { + Object.values(PluginLogEntryType).forEach((type) => { const typeMethod = type.toLowerCase() as keyof ConsoleExtension describe(`console#${typeMethod}`, () => {