Skip to content

Commit 0660442

Browse files
committed
Minor cleanup
1 parent ea695c2 commit 0660442

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/commands/scan/fetch-report-data.mts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ export async function fetchReportData(
2929
}
3030
const sockSdk = sockSdkResult.data
3131

32-
let scanStatus = 'requested..'
33-
let policyStatus = 'requested..'
32+
let policyStatus = 'requested...'
33+
let scanStatus = 'requested...'
3434
let finishedFetching = false
3535

3636
// Lazily access constants.spinner.
@@ -70,10 +70,10 @@ export async function fetchReportData(
7070
return result
7171
}
7272

73-
const jsonsString = result.data
73+
const ndJsonString = result.data
7474

7575
// This is nd-json; each line is a json object.
76-
const lines = jsonsString.split('\n').filter(Boolean)
76+
const lines = ndJsonString.split('\n').filter(Boolean)
7777
let ok = true
7878
const data = lines.map(line => {
7979
try {
@@ -86,11 +86,11 @@ export async function fetchReportData(
8686
}) as unknown as SocketArtifact[]
8787

8888
if (ok) {
89-
updateScan(`success`)
89+
updateScan('success')
9090
return { ok: true, data }
9191
}
9292

93-
updateScan(`received invalid JSON response`)
93+
updateScan('received invalid JSON response')
9494

9595
return {
9696
ok: false,
@@ -120,15 +120,15 @@ export async function fetchReportData(
120120
CResult<SocketSdkReturnType<'getOrgSecurityPolicy'>['data']>,
121121
] = await Promise.all([
122122
fetchScanResult().catch(e => {
123-
updateScan(`failure; unknown blocking problem occurred`)
123+
updateScan('failure; unknown blocking problem occurred')
124124
return {
125125
ok: false as const,
126126
message: 'Unexpected API problem',
127127
cause: `We encountered an unexpected problem while requesting the Scan from the API: ${e?.message || '(no error message found)'}${e?.cause ? ` (cause: ${e.cause})` : ''}`,
128128
}
129129
}),
130130
fetchSecurityPolicy().catch(e => {
131-
updatePolicy(`failure; unknown blocking problem occurred`)
131+
updatePolicy('failure; unknown blocking problem occurred')
132132
return {
133133
ok: false as const,
134134
message: 'Unexpected API problem',

src/commands/wrapper/remove-socket-wrapper.mts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ import { readFileSync, writeFileSync } from 'node:fs'
33
import { logger } from '@socketsecurity/registry/lib/logger'
44

55
export function removeSocketWrapper(filepath: string): void {
6-
let data: string | undefined
6+
let content: string | undefined
77
try {
8-
data = readFileSync(filepath, 'utf8')
8+
content = readFileSync(filepath, 'utf8')
99
} catch (e) {
10-
logger.fail('There was an error removing the alias:')
10+
logger.fail(`There was an error removing the alias${e ? ':' : '.'}`)
1111
if (e) {
1212
logger.error(e)
1313
}
1414
return
1515
}
1616

17-
const linesWithoutSocketAlias = data
17+
const linesWithoutSocketAlias = content
1818
.split('\n')
1919
.filter(
2020
l => l !== 'alias npm="socket npm"' && l !== 'alias npx="socket npx"',
2121
)
22-
const updatedFileContent = linesWithoutSocketAlias.join('\n')
22+
const updatedContent = linesWithoutSocketAlias.join('\n')
2323
try {
24-
writeFileSync(filepath, updatedFileContent, 'utf8')
24+
writeFileSync(filepath, updatedContent, 'utf8')
2525
} catch (e) {
2626
if (e) {
2727
logger.error(e)

0 commit comments

Comments
 (0)