Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/commands/analytics/cmd-analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ async function run(
},
{
nook: true,
test: scope === 'org' || repo,
test: scope === 'org' || !!repo,
message: 'When scope=repo, repo name should be set through --repo',
pass: 'ok',
fail: 'missing'
},
{
nook: true,
test: file === '-' || json || markdown,
test: file === '-' || !!json || !!markdown,
message:
'The `--file` flag is only valid when using `--json` or `--markdown`',
pass: 'ok',
Expand All @@ -129,7 +129,7 @@ async function run(
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
4 changes: 2 additions & 2 deletions src/commands/audit-log/cmd-audit-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ async function run(

const wasBadInput = handleBadInput(
{
test: orgSlug,
test: !!orgSlug,
message: 'Org name should be the first arg',
pass: 'ok',
fail: 'missing'
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
4 changes: 2 additions & 2 deletions src/commands/config/cmd-config-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ async function run(

const wasBadInput = handleBadInput(
{
test: supportedConfigKeys.has(key as keyof LocalConfig) || key === 'test',
test: key === 'test' || supportedConfigKeys.has(key as keyof LocalConfig),
message: 'Config key should be the first arg',
pass: 'ok',
fail: key ? 'invalid config key' : 'missing'
},
{
test: value, // This is a string, empty string is not ok
test: !!value, // This is a string, empty string is not ok
message:
'Key value should be the remaining args (use `unset` to unset a value)',
pass: 'ok',
Expand Down
2 changes: 1 addition & 1 deletion src/commands/config/cmd-config-unset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function run(

const wasBadInput = handleBadInput(
{
test: supportedConfigKeys.has(key as keyof LocalConfig) || key === 'test',
test: key === 'test' || supportedConfigKeys.has(key as keyof LocalConfig),
message: 'Config key should be the first arg',
pass: 'ok',
fail: key ? 'invalid config key' : 'missing'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/dependencies/cmd-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async function run(
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
2 changes: 1 addition & 1 deletion src/commands/diff-scan/cmd-diff-scan-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async function run(
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
2 changes: 1 addition & 1 deletion src/commands/info/cmd-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async function run(

const wasBadInput = handleBadInput(
{
test: rawPkgName,
test: !!rawPkgName,
message: 'Expecting a package name',
pass: 'ok',
fail: 'missing'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/manifest/cmd-manifest-gradle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ async function run(

const wasBadInput = handleBadInput(
{
test: target && target !== '-',
test: !!target && target !== '-',
message: 'The DIR arg is required',
pass: 'ok',
fail: target === '-' ? 'stdin is not supported' : 'missing'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/manifest/cmd-manifest-kotlin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ async function run(

const wasBadInput = handleBadInput(
{
test: target && target !== '-',
test: !!target && target !== '-',
message: 'The DIR arg is required',
pass: 'ok',
fail: target === '-' ? 'stdin is not supported' : 'missing'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/manifest/cmd-manifest-scala.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async function run(

const wasBadInput = handleBadInput(
{
test: target && target !== '-',
test: !!target && target !== '-',
message: 'The DIR arg is required',
pass: 'ok',
fail: target === '-' ? 'stdin is not supported' : 'missing'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/organization/cmd-organization-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async function run(
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
4 changes: 2 additions & 2 deletions src/commands/organization/cmd-organization-policy-license.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async function run(
const wasBadInput = handleBadInput(
{
nook: true,
test: orgSlug,
test: !!orgSlug,
message: 'Org name as the first argument',
pass: 'ok',
fail: 'missing'
Expand All @@ -84,7 +84,7 @@ async function run(
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
4 changes: 2 additions & 2 deletions src/commands/organization/cmd-organization-policy-security.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async function run(
const wasBadInput = handleBadInput(
{
nook: true,
test: orgSlug,
test: !!orgSlug,
message: 'Org name as the first argument',
pass: 'ok',
fail: 'missing'
Expand All @@ -84,7 +84,7 @@ async function run(
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
2 changes: 1 addition & 1 deletion src/commands/organization/cmd-organization-quota.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async function run(
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
2 changes: 1 addition & 1 deletion src/commands/package/cmd-package-score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async function run(
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
6 changes: 3 additions & 3 deletions src/commands/repos/cmd-repos-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,20 @@ async function run(
const wasBadInput = handleBadInput(
{
nook: true,
test: orgSlug,
test: !!orgSlug,
message: 'Org name as the first argument',
pass: 'ok',
fail: 'missing'
},
{
test: repoName,
test: !!repoName,
message: 'Repository name using --repoNam',
pass: 'ok',
fail: 'missing'
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
6 changes: 3 additions & 3 deletions src/commands/repos/cmd-repos-del.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,20 @@ async function run(
const wasBadInput = handleBadInput(
{
nook: true,
test: orgSlug,
test: !!orgSlug,
message: 'Org name as the first argument',
pass: 'ok',
fail: 'missing'
},
{
test: repoName,
test: !!repoName,
message: 'Repository name argument',
pass: 'ok',
fail: 'missing'
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
4 changes: 2 additions & 2 deletions src/commands/repos/cmd-repos-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async function run(
const wasBadInput = handleBadInput(
{
nook: true,
test: orgSlug,
test: !!orgSlug,
message: 'Org name as the first argument',
pass: 'ok',
fail: 'missing'
Expand All @@ -101,7 +101,7 @@ async function run(
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
6 changes: 3 additions & 3 deletions src/commands/repos/cmd-repos-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,20 @@ async function run(
const wasBadInput = handleBadInput(
{
nook: true,
test: orgSlug,
test: !!orgSlug,
message: 'Org name as the first argument',
pass: 'ok',
fail: 'missing'
},
{
test: repoName,
test: !!repoName,
message: 'Repository name using --repoName',
pass: 'ok',
fail: 'missing'
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
6 changes: 3 additions & 3 deletions src/commands/repos/cmd-repos-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ async function run(
const wasBadInput = handleBadInput(
{
nook: true,
test: orgSlug,
test: !!orgSlug,
message: 'Org name as the first argument',
pass: 'ok',
fail: 'missing'
},
{
test: repoName,
test: !!repoName,
message: 'Repository name using --repoName',
pass: 'ok',
fail: 'missing'
Expand All @@ -90,7 +90,7 @@ async function run(
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
6 changes: 3 additions & 3 deletions src/commands/scan/cmd-scan-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ async function run(
const wasBadInput = handleBadInput(
{
nook: !!defaultOrgSlug,
test: orgSlug && orgSlug !== '.',
test: !!orgSlug && orgSlug !== '.',
message: 'Org name as the first argument',
pass: 'ok',
fail:
Expand All @@ -246,7 +246,7 @@ async function run(
: 'missing'
},
{
test: targets.length,
test: !!targets.length,
message: 'At least one TARGET (e.g. `.` or `./package.json`)',
pass: 'ok',
fail: 'missing (or perhaps you forgot the org slug?)'
Expand All @@ -260,7 +260,7 @@ async function run(
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message: 'This command requires an API token for access',
pass: 'ok',
fail: 'missing (try `socket login`)'
Expand Down
6 changes: 3 additions & 3 deletions src/commands/scan/cmd-scan-del.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async function run(
const wasBadInput = handleBadInput(
{
nook: !!defaultOrgSlug,
test: orgSlug && orgSlug !== '.',
test: !!orgSlug && orgSlug !== '.',
message: 'Org name as the first argument',
pass: 'ok',
fail:
Expand All @@ -72,14 +72,14 @@ async function run(
: 'missing'
},
{
test: scanId,
test: !!scanId,
message: 'Scan ID to delete',
pass: 'ok',
fail: 'missing'
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
4 changes: 2 additions & 2 deletions src/commands/scan/cmd-scan-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async function run(
const wasBadInput = handleBadInput(
{
nook: !!defaultOrgSlug,
test: orgSlug && orgSlug !== '.',
test: !!orgSlug && orgSlug !== '.',
message: 'Org name as the first argument',
pass: 'ok',
fail:
Expand All @@ -120,7 +120,7 @@ async function run(
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
6 changes: 3 additions & 3 deletions src/commands/scan/cmd-scan-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async function run(
const wasBadInput = handleBadInput(
{
nook: !!defaultOrgSlug,
test: orgSlug && orgSlug !== '.',
test: !!orgSlug && orgSlug !== '.',
message: 'Org name as the first argument',
pass: 'ok',
fail:
Expand All @@ -76,7 +76,7 @@ async function run(
: 'missing'
},
{
test: scanId,
test: !!scanId,
message: 'Scan ID to inspect as argument',
pass: 'ok',
fail: 'missing'
Expand All @@ -90,7 +90,7 @@ async function run(
},
{
nook: true,
test: apiToken,
test: !!apiToken,
message:
'You need to be logged in to use this command. See `socket login`.',
pass: 'ok',
Expand Down
Loading