Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/utils/alerts-map.mts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { arrayUnique } from '@socketsecurity/registry/lib/arrays'
import { debugFn } from '@socketsecurity/registry/lib/debug'
import { logger } from '@socketsecurity/registry/lib/logger'

import { extractPurlsFromPnpmLockfile } from './pnpm.mts'
import { getPublicToken, setupSdk } from './sdk.mts'
import { addArtifactToAlertsMap } from './socket-package-alert.mts'
import constants from '../constants.mts'

import type { CompactSocketArtifact } from './alert/artifact.mts'
import type {
Expand Down Expand Up @@ -117,6 +120,16 @@ export async function getAlertsMapFromPurls(
throw new Error(
`Socket API server error (${statusCode}): ${statusMessage}`,
)
} else {
const { spinner } = constants
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The codebase appears to be using a style where semicolons are optional. Since this is consistent with the surrounding code, adding an explicit semicolon here isn't necessary. If there's a specific linting rule or style guide requiring semicolons, consider applying it consistently across the entire codebase rather than to individual lines.

Spotted by Diamond (based on custom rules)

Is this helpful? React 👍 or 👎 to let us know.

spinner.stop()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The codebase appears to be using a style where semicolons are optional. Since this is consistent with the surrounding code (which also doesn't use semicolons), adding one here would actually be inconsistent with the project's style. Unless there's a specific linting rule for this project requiring semicolons, this code follows what appears to be the established convention.

Spotted by Diamond (based on custom rules)

Is this helpful? React 👍 or 👎 to let us know.

debugFn('Received a result=false:', batchResult)
logger.fail(
`Received a ${batchResult.status} response from Socket API which we consider a permanent failure:`,
batchResult.error,
batchResult.cause ? `( ${batchResult.cause} )` : '',
)
Comment on lines +127 to +131
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a semicolon at the end of the logger.fail statement for consistency. While JavaScript has automatic semicolon insertion, explicitly terminating statements helps maintain code clarity, especially in multi-line function calls.

logger.fail(
  `Received a ${batchResult.status} response from Socket API which we consider a permanent failure:`,
  batchResult.error,
  batchResult.cause ? `( ${batchResult.cause} )` : '',
);
Suggested change
logger.fail(
`Received a ${batchResult.status} response from Socket API which we consider a permanent failure:`,
batchResult.error,
batchResult.cause ? `( ${batchResult.cause} )` : '',
)
logger.fail(
`Received a ${batchResult.status} response from Socket API which we consider a permanent failure:`,
batchResult.error,
batchResult.cause ? `( ${batchResult.cause} )` : '',
)

Spotted by Diamond (based on custom rules)

Is this helpful? React 👍 or 👎 to let us know.

break
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The break statement is missing a semicolon. While JavaScript's automatic semicolon insertion will handle this case correctly, adding an explicit semicolon would maintain consistency with the codebase's style conventions.

Suggested change
break
break;

Spotted by Diamond (based on custom rules)

Is this helpful? React 👍 or 👎 to let us know.

}
remaining -= 1
if (spinner && remaining > 0) {
Expand Down