Skip to content

Commit

Permalink
Merge pull request #2120 from snyk/fix/code-new-code-api-support
Browse files Browse the repository at this point in the history
fix: support of the new Code API
  • Loading branch information
Arvi3d committed Aug 3, 2021
2 parents b7a190b + a102ba4 commit 48035f8
Show file tree
Hide file tree
Showing 5 changed files with 1,566 additions and 4,403 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -8,6 +8,8 @@ src/cli/commands/test/iac-output.ts @snyk/cloudconfig
src/cli/commands/test/iac-test-shim.ts @snyk/cloudconfig
src/lib/cloud-config-projects.ts @snyk/cloudconfig
src/lib/plugins/sast/ @snyk/sast-team
test/fixtures/sast/ @snyk/sast-team
test/jest/unit/snyk-code/ @snyk/sast-team
src/lib/iac/ @snyk/cloudconfig
src/lib/snyk-test/iac-test-result.ts @snyk/cloudconfig
src/lib/snyk-test/payload-schema.ts @snyk/cloudconfig
Expand All @@ -17,8 +19,6 @@ test/fixtures/container-projects/ @snyk/capsule
test/fixtures/iac/ @snyk/cloudconfig
test/smoke/spec/iac/ @snyk/cloudconfig
test/smoke/.iac-data/ @snyk/cloudconfig
test/fixtures/sast/ @snyk/sast-team
test/snyk-code-test.spec.ts @snyk/sast-team
test/jest/unit/iac-unit-tests/ @snyk/cloudconfig
test/jest/acceptance/iac/ @snyk/cloudconfig
src/lib/errors/invalid-iac-file.ts @snyk/cloudconfig
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -76,7 +76,7 @@
"@open-policy-agent/opa-wasm": "^1.2.0",
"@snyk/cli-interface": "2.11.0",
"@snyk/cloud-config-parser": "^1.9.2",
"@snyk/code-client": "3.9.0",
"@snyk/code-client": "4.0.0",
"@snyk/dep-graph": "^1.27.1",
"@snyk/fix": "1.650.0",
"@snyk/gemfile": "1.2.0",
Expand Down
13 changes: 5 additions & 8 deletions src/lib/plugins/sast/analysis.ts
Expand Up @@ -49,17 +49,14 @@ async function getCodeAnalysis(root: string, options: Options): Promise<Log> {
const severity = options.severityThreshold
? severityToAnalysisSeverity(options.severityThreshold)
: AnalysisSeverity.info;
const paths: string[] = [root];
const sarif = true;

const result = await analyzeFolders({
baseURL,
sessionToken,
severity,
paths,
sarif,
connection: { baseURL, sessionToken, source: 'snyk-cli' },
analysisOptions: { severity },
fileOptions: { paths: [root] },
});

return result.sarifResults!;
return result?.analysisResults.sarif!;
}

function severityToAnalysisSeverity(severity: SEVERITY): AnalysisSeverity {
Expand Down

0 comments on commit 48035f8

Please sign in to comment.