Skip to content

Commit 17e87ae

Browse files
author
Pelle Wessman
committed
Upload issueRules from any found socket.yml
1 parent c8a9818 commit 17e87ae

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/commands/report/create.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const create = {
2727

2828
if (input) {
2929
const {
30+
config,
3031
cwd,
3132
debugLog,
3233
dryRun,
@@ -38,7 +39,7 @@ export const create = {
3839
view,
3940
} = input
4041

41-
const result = input && await createReport(packagePaths, { cwd, debugLog, dryRun })
42+
const result = input && await createReport(packagePaths, { config, cwd, debugLog, dryRun })
4243

4344
if (result && view) {
4445
const reportId = result.data.id
@@ -58,6 +59,7 @@ export const create = {
5859

5960
/**
6061
* @typedef CommandContext
62+
* @property {import('@socketsecurity/config').SocketYml|undefined} config
6163
* @property {string} cwd
6264
* @property {typeof console.error} debugLog
6365
* @property {boolean} dryRun
@@ -191,6 +193,7 @@ async function setupCommand (name, description, argv, importMeta) {
191193
const packagePaths = await getPackageFiles(cwd, cli.input, config, debugLog)
192194

193195
return {
196+
config,
194197
cwd,
195198
debugLog,
196199
dryRun,
@@ -205,10 +208,10 @@ async function setupCommand (name, description, argv, importMeta) {
205208

206209
/**
207210
* @param {string[]} packagePaths
208-
* @param {Pick<CommandContext, 'cwd' | 'debugLog' | 'dryRun'>} context
211+
* @param {Pick<CommandContext, 'config' | 'cwd' | 'debugLog' | 'dryRun'>} context
209212
* @returns {Promise<void|import('@socketsecurity/sdk').SocketSdkReturnType<'createReport'>>}
210213
*/
211-
async function createReport (packagePaths, { cwd, debugLog, dryRun }) {
214+
async function createReport (packagePaths, { config, cwd, debugLog, dryRun }) {
212215
debugLog('Uploading:', packagePaths.join(`\n${logSymbols.info} Uploading: `))
213216

214217
if (dryRun) {
@@ -217,7 +220,8 @@ async function createReport (packagePaths, { cwd, debugLog, dryRun }) {
217220

218221
const socketSdk = await setupSdk()
219222
const spinner = ora(`Creating report with ${packagePaths.length} package files`).start()
220-
const result = await handleApiCall(socketSdk.createReportFromFilePaths(packagePaths, cwd), spinner, 'creating report')
223+
const apiCall = socketSdk.createReportFromFilePaths(packagePaths, cwd, config?.issueRules)
224+
const result = await handleApiCall(apiCall, spinner, 'creating report')
221225

222226
if (result.success === false) {
223227
return handleUnsuccessfulApiResponse(result, spinner)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"dependencies": {
7777
"@apideck/better-ajv-errors": "^0.3.6",
7878
"@socketsecurity/config": "^2.0.0",
79-
"@socketsecurity/sdk": "^0.5.1",
79+
"@socketsecurity/sdk": "^0.5.2",
8080
"chalk": "^5.1.2",
8181
"globby": "^13.1.3",
8282
"hpagent": "^1.2.0",

0 commit comments

Comments
 (0)