Skip to content

Commit

Permalink
CM-32304 - Add new SCA flow which decreases execution time (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshalX authored Feb 13, 2024
1 parent e46ac7a commit e84bcc0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [v1.3.0]

- Add new SCA flow which decreases execution time

## [v1.2.2]

- Fix detections count in SCA notifications
Expand Down Expand Up @@ -30,6 +34,8 @@

The first stable release with the support of Secrets, SCA, TreeView, Violation Card, and more.

[v1.3.0]: https://github.com/cycodehq/vscode-extension/releases/tag/v1.3.0

[v1.2.2]: https://github.com/cycodehq/vscode-extension/releases/tag/v1.2.2

[v1.2.1]: https://github.com/cycodehq/vscode-extension/releases/tag/v1.2.1
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"url": "https://github.com/cycodehq/vscode-extension"
},
"homepage": "https://cycode.com/",
"version": "1.2.2",
"version": "1.3.0",
"publisher": "cycode",
"engines": {
"vscode": "^1.63.0"
Expand Down Expand Up @@ -110,6 +110,11 @@
"type": "string",
"default": "",
"markdownDescription": "Changes the app URL when running scans. Equivalent to setting CYCODE_APP_URL env var in the CLI."
},
"cycode.experimentalScaSyncFlow": {
"type": "boolean",
"default": "true",
"description": "Enable experimental SCA sync flow"
}
}
},
Expand Down
11 changes: 11 additions & 0 deletions src/cli-wrapper/cli-wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as vscode from 'vscode';
import {IgnoreCommandConfig} from '../types/commands';
import {CliCommands, CommandParameters, getScanTypeCliValue} from './constants';
import {IConfig, RunCliResult, UserAgent} from './types';
import {getRunnableCliCommand} from './runner';
import {experimentalScaSyncFlowProperty, extensionId} from '../utils/texts';

export const generateUserAgentCommandParam = (config: IConfig) => {
const userAgent: UserAgent = {
Expand Down Expand Up @@ -93,6 +95,15 @@ export const cliWrapper = {
commandParams.push(CliCommands.Scan);
commandParams.push(CommandParameters.scanType);
commandParams.push(CommandParameters.SCAScanType);

const experimentalScaSyncFlowPropertyEnabled =
vscode.workspace.getConfiguration(extensionId).get(experimentalScaSyncFlowProperty);
if (experimentalScaSyncFlowPropertyEnabled) {
// TODO(MarshalX): remove experimental setting if stable
commandParams.push(CommandParameters.Sync);
commandParams.push(CommandParameters.NoRestore);
}

commandParams.push(CliCommands.Path);
commandParams.push(`"${params.path}"`);

Expand Down
4 changes: 3 additions & 1 deletion src/cli-wrapper/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ export enum CommandParameters {
Version = '--version',
scanType = '--scan-type',
SCAScanType = 'sca',
Sync = '--sync',
NoRestore = '--no-restore',
}

export const MinCLIVersion = '1.7.0';
export const MinCLIVersion = '1.9.0';

const SCAN_TYPE_TO_SCAN_TYPE_CLI_FLAG_VALUE = {
[ScanType.Secrets]: 'secret',
Expand Down
2 changes: 2 additions & 0 deletions src/utils/texts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ export const publisherId = 'cycode';
export const extensionName = 'Cycode';
export const scanOnSaveProperty = 'scanOnSave';

export const experimentalScaSyncFlowProperty = 'experimentalScaSyncFlow';

export enum StatusBarTexts {
ScanButton = '$(cycode-logo) Scan with Cycode',
ScanWait = '$(loading~spin) Waiting for scan to complete….',
Expand Down

0 comments on commit e84bcc0

Please sign in to comment.