Skip to content

Commit 87d161e

Browse files
committed
Period and newline nits
1 parent f60b83b commit 87d161e

File tree

14 files changed

+28
-27
lines changed

14 files changed

+28
-27
lines changed

src/commands/analytics/cmd-analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const config: CliCommandConfig = {
2626
shortFlag: 'f',
2727
default: '-',
2828
description:
29-
'Path to a local file to save the output. Only valid with --json/--markdown. Defaults to stdout.'
29+
'Filepath to save output. Only valid with --json/--markdown. Defaults to stdout.'
3030
},
3131
repo: {
3232
type: 'string',

src/commands/audit-log/output-audit-log.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export async function outputAsJson(
100100
'There was a problem converting the logs to JSON, please try without the `--json` flag'
101101
)
102102
if (isDebug()) {
103-
debugLog('Error:', e)
103+
debugLog('Error:\n', e)
104104
}
105105
return '{}'
106106
}
@@ -150,7 +150,7 @@ ${table}
150150
'There was a problem converting the logs to Markdown, please try the `--json` flag'
151151
)
152152
if (isDebug()) {
153-
debugLog('Error:', e)
153+
debugLog('Error:\n', e)
154154
}
155155
// logger.error(e)
156156
return ''

src/commands/config/discover-config-value.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export async function discoverConfigValue(
3535
success: false,
3636
value: undefined,
3737
message:
38-
'When uncertain, unset this key. Otherwise ask your network administrator.'
38+
'When uncertain, unset this key. Otherwise ask your network administrator'
3939
}
4040
}
4141

src/commands/diff-scan/cmd-diff-scan-get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ async function run(
101101
{
102102
test: !!(before && after),
103103
message:
104-
'Specify a before and after scan ID\nThe args are expecting a full `aaa0aa0a-aaaa-0000-0a0a-0000000a00a0` scan ID.',
104+
'Specify a before and after scan ID.\nThe args are expecting a full `aaa0aa0a-aaaa-0000-0a0a-0000000a00a0` scan ID.',
105105
pass: 'ok',
106106
fail:
107107
!before && !after

src/commands/package/output-purl-score.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export async function outputPurlScore(
243243
)
244244
} else {
245245
logger.log(
246-
'This package had no alerts and neither did any of its direct/transitive dependencies.'
246+
'This package had no alerts and neither did any of its direct/transitive dependencies'
247247
)
248248
}
249249
logger.log('')

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export async function fetchReportData(
8282
)
8383
} else {
8484
spinner.successAndStop(
85-
`Completed fetching ${haves.join(haves.length > 2 ? ', ' : ' and ')}.`
85+
`Completed fetching ${haves.join(haves.length > 2 ? ', ' : ' and ')}`
8686
)
8787
}
8888
}
@@ -133,7 +133,7 @@ export async function fetchReportData(
133133
return data
134134
} catch (e) {
135135
spinner.errorAndStop(
136-
'There was an issue while fetching full scan data.'
136+
'There was an issue while fetching full scan data'
137137
)
138138
throw e
139139
}

src/commands/scan/suggest-org-slug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export async function suggestOrgSlug(): Promise<string | void> {
3838
}
3939
} else {
4040
logger.fail(
41-
'Failed to lookup organization list from API, unable to suggest.'
41+
'Failed to lookup organization list from API, unable to suggest'
4242
)
4343
}
4444
}

src/commands/wrapper/check-socket-wrapper-setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function checkSocketWrapperSetup(file: string): boolean {
1212

1313
if (linesWithSocketAlias.length) {
1414
logger.log(
15-
`The Socket npm/npx wrapper is set up in your bash profile (${file}).`
15+
`The Socket npm/npx wrapper is set up in your bash profile (${file})`
1616
)
1717
return true
1818
}

src/shadow/npm/paths.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const { NODE_MODULES, NPM, NPX, SOCKET_CLI_ISSUES_URL } = constants
1616

1717
function exitWithBinPathError(binName: string): never {
1818
logger.fail(
19-
`Socket unable to locate ${binName}; ensure it is available in the PATH environment variable.`
19+
`Socket unable to locate ${binName}; ensure it is available in the PATH environment variable`
2020
)
2121
// The exit code 127 indicates that the command or binary being executed
2222
// could not be found.

src/utils/api.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function handleUnsuccessfulApiResponse<T extends SocketSdkOperations>(
2828

2929
throw new AuthError(message)
3030
}
31-
logger.fail(failMsgWithBadge('API returned an error', message))
31+
logger.fail(failMsgWithBadge('Socket API returned an error', message))
3232
// eslint-disable-next-line n/no-process-exit
3333
process.exit(1)
3434
}
@@ -40,23 +40,24 @@ export async function handleApiCall<T>(
4040
let result: T
4141
try {
4242
result = await value
43-
} catch (cause) {
44-
debugLog('handleApiCall[', description, '] error:\n', cause)
45-
throw new Error(`Failed ${description}`, { cause })
43+
} catch (e) {
44+
debugLog(`handleApiCall[${description}] error:\n`, e)
45+
throw new Error(`Failed ${description}`, { cause: e })
4646
}
4747
return result
4848
}
4949

5050
export async function handleApiError(code: number) {
5151
if (code === 400) {
52-
return 'One of the options passed might be incorrect.'
53-
} else if (code === 403) {
54-
return 'Your API token may not have the required permissions for this command or you might be trying to access (data from) an organization that is not linked to the API key you are logged in with.'
55-
} else if (code === 404) {
52+
return 'One of the options passed might be incorrect'
53+
}
54+
if (code === 403) {
55+
return 'Your API token may not have the required permissions for this command or you might be trying to access (data from) an organization that is not linked to the API key you are logged in with'
56+
}
57+
if (code === 404) {
5658
return 'The requested Socket API endpoint was not found (404) or there was no result for the requested parameters. This could be a temporary problem caused by an incident or a bug in the CLI. If the problem persists please let us know.'
57-
} else {
58-
return `Server responded with status code ${code}`
5959
}
60+
return `Server responded with status code ${code}`
6061
}
6162

6263
export function getLastFiveOfApiToken(token: string): string {

0 commit comments

Comments
 (0)