Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Merge pull request #1664 from snyk/feat/add-snyk-code-as-plugin-for-test" #1682

Merged
merged 1 commit into from
Mar 4, 2021
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
3 changes: 0 additions & 3 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ help/ @snyk/hammer
src/cli/commands/test/iac-output.ts @snyk/cloudconfig
src/cli/commands/test/iac-local-execution/ @snyk/cloudconfig
src/lib/cloud-config-projects.ts @snyk/cloudconfig
src/lib/plugins/sast/ @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 @@ -15,8 +14,6 @@ test/acceptance/cli-test/iac/ @snyk/cloudconfig
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
src/lib/errors/invalid-iac-file.ts @snyk/cloudconfig
src/lib/errors/unsupported-options-iac-error.ts @snyk/cloudconfig
help/commands-docs/iac-examples.md @snyk/cloudconfig
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
test/acceptance/workspaces/**/.gradle
test/**/.gradle
.iac-data
.dccache
!test/smoke/.iac-data
# Jest
coverage
3 changes: 1 addition & 2 deletions config.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
"API": "https://snyk.io/api/v1",
"devDeps": false,
"PRUNE_DEPS_THRESHOLD": 40000,
"MAX_PATH_COUNT": 1500000,
"CODE_CLIENT_PROXY_URL": "http://deeproxy.snyk.io"
"MAX_PATH_COUNT": 1500000
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"dependencies": {
"@open-policy-agent/opa-wasm": "^1.2.0",
"@snyk/cli-interface": "2.11.0",
"@snyk/code-client": "3.1.1",
"@snyk/dep-graph": "1.23.1",
"@snyk/gemfile": "1.2.0",
"@snyk/graphlib": "^2.1.9-patch.3",
Expand Down
6 changes: 1 addition & 5 deletions src/cli/commands/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,7 @@ async function test(...args: MethodArgs): Promise<TestCommandResult> {
);
return commandResult;
} catch (error) {
if (error instanceof Error) {
throw error;
} else {
throw new Error(error);
}
throw new Error(error);
}
}

Expand Down
8 changes: 0 additions & 8 deletions src/cli/modes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ const modes: Record<string, ModeData> = {
config: (args): [] => {
args['iac'] = true;

return args;
},
},
code: {
allowedCommands: ['test'],
config: (args): [] => {
args['code'] = true;

return args;
},
},
Expand Down
1 change: 0 additions & 1 deletion src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ interface Config {
timeout: number;
PROJECT_NAME: string;
TOKEN: string;
CODE_CLIENT_PROXY_URL: string;
}

// TODO: fix the types!
Expand Down
3 changes: 0 additions & 3 deletions src/lib/ecosystems/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ export function getEcosystemForTest(options: Options): Ecosystem | null {
if (options.source) {
return 'cpp';
}
if (options.code) {
return 'code';
}
return null;
}

Expand Down
2 changes: 0 additions & 2 deletions src/lib/ecosystems/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as cppPlugin from 'snyk-cpp-plugin';
import * as dockerPlugin from 'snyk-docker-plugin';
import { codePlugin } from '../plugins/sast';
import { Ecosystem, EcosystemPlugin } from './types';

const EcosystemPlugins: {
Expand All @@ -9,7 +8,6 @@ const EcosystemPlugins: {
cpp: cppPlugin as EcosystemPlugin,
// TODO: not any
docker: dockerPlugin as any,
code: codePlugin,
};

export function getPlugin(ecosystem: Ecosystem): EcosystemPlugin {
Expand Down
6 changes: 0 additions & 6 deletions src/lib/ecosystems/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ export async function testEcosystem(
options: Options,
): Promise<TestCommandResult> {
const plugin = getPlugin(ecosystem);
// TODO: this is an intermediate step before consolidating ecosystem plugins
// to accept flows that act differently in the testDependencies step
if (plugin.test) {
const { readableResult: res } = await plugin.test(paths, options);
return TestCommandResult.createHumanReadableTestCommandResult(res, '');
}
const scanResultsByPath: { [dir: string]: ScanResult[] } = {};
for (const path of paths) {
await spinner(`Scanning dependencies in ${path}`);
Expand Down
6 changes: 1 addition & 5 deletions src/lib/ecosystems/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DepGraphData } from '@snyk/dep-graph';
import { Options } from '../types';

export type Ecosystem = 'cpp' | 'docker' | 'code';
export type Ecosystem = 'cpp' | 'docker';

export interface PluginResponse {
scanResults: ScanResult[];
Expand Down Expand Up @@ -81,10 +81,6 @@ export interface EcosystemPlugin {
errors: string[],
options: Options,
) => Promise<string>;
test?: (
paths: string[],
options: Options,
) => Promise<{ readableResult: string }>;
}

export interface EcosystemMonitorError {
Expand Down
1 change: 0 additions & 1 deletion src/lib/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export { UnsupportedPackageManagerError } from './unsupported-package-manager-er
export { FailedToRunTestError } from './failed-to-run-test-error';
export { TooManyVulnPaths } from './too-many-vuln-paths';
export { AuthFailedError } from './authentication-failed-error';
export { FeatureNotSupportedForOrgError } from './unsupported-feature-for-org-error';
export { OptionMissingErrorError } from './option-missing-error';
export { ExcludeFlagBadInputError } from './exclude-flag-bad-input';
export { UnsupportedOptionCombinationError } from './unsupported-option-combination-error';
Expand Down
13 changes: 0 additions & 13 deletions src/lib/errors/unsupported-feature-for-org-error.ts

This file was deleted.

108 changes: 0 additions & 108 deletions src/lib/plugins/sast/analysis.ts

This file was deleted.

13 changes: 0 additions & 13 deletions src/lib/plugins/sast/errors/unsupported-feature-snyk-code-error.ts

This file was deleted.

Loading