Skip to content

Commit

Permalink
Merge pull request #3311 from snyk/feat/remove-report-command-iac
Browse files Browse the repository at this point in the history
feat: remove report command from IaC [CFG-1954]
  • Loading branch information
teodora-sandu authored Jun 15, 2022
2 parents b701bff + 9cd5813 commit dd7b94c
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 419 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ help/ @snyk/hammer
help/cli-commands/iac*.md @snyk/group-infrastructure-as-code @snyk/hammer
src/cli/commands/test/iac/ @snyk/group-infrastructure-as-code
src/cli/commands/describe.ts @snyk/group-infrastructure-as-code
src/cli/commands/report/ @snyk/group-infrastructure-as-code
src/cli/commands/update-exclude-policy.ts @snyk/group-infrastructure-as-code
src/cli/commands/apps @snyk/moose
src/lib/apps @snyk/moose
Expand Down
1 change: 0 additions & 1 deletion src/cli/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const commands = {
policy: async (...args) => callModule(import('./policy'), args),
protect: async (...args) => callModule(import('./protect'), args),
test: async (...args) => callModule(import('./test'), args),
report: async (...args) => callModule(import('./report'), args),
version: async (...args) => callModule(import('./version'), args),
wizard: async (...args) => callModule(import('./protect/wizard'), args),
woof: async (...args) => callModule(import('./woof'), args),
Expand Down
13 changes: 0 additions & 13 deletions src/cli/commands/report/errors/unsupported-report-command.ts

This file was deleted.

35 changes: 0 additions & 35 deletions src/cli/commands/report/index.ts

This file was deleted.

20 changes: 1 addition & 19 deletions src/cli/commands/test/iac/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ import * as path from 'path';
const debug = Debug('snyk-test');
const SEPARATOR = '\n-------------------------------------------------------\n';

// The hardcoded `isReportCommand` argument is temporary and will be removed together with the `snyk iac report` command deprecation
export default async function(
isReportCommand: boolean,
...args: MethodArgs
): Promise<TestCommandResult> {
export default async function(...args: MethodArgs): Promise<TestCommandResult> {
const { options: originalOptions, paths } = processCommandArgs(...args);

const options = setDefaultTestOptions(originalOptions);
Expand Down Expand Up @@ -282,13 +278,6 @@ export default async function(

if (isIacShareResultsOptions(options)) {
response += formatShareResultsOutput(iacOutputMeta!) + EOL.repeat(2);
if (isReportCommand) {
response += chalk.red.bold(
'Warning:' +
EOL +
"We will be deprecating support for the 'snyk iac report' command by mid-June and 'snyk iac test --report' will become the default command for using our share results functionality.",
);
}
}

const error = new Error(response) as any;
Expand All @@ -307,13 +296,6 @@ export default async function(

if (isIacShareResultsOptions(options)) {
response += formatShareResultsOutput(iacOutputMeta!) + EOL.repeat(2);
if (isReportCommand) {
response += chalk.red.bold(
'Warning:' +
EOL +
"We will be deprecating support for the 'snyk iac report' command by mid-June and 'snyk iac test --report' will become the default command for using our share results functionality.",
);
}
}

return TestCommandResult.createHumanReadableTestCommandResult(
Expand Down
3 changes: 0 additions & 3 deletions src/cli/commands/test/iac/local-execution/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,6 @@ export enum IaCErrorCodes {
// drift errors
InvalidServiceError = 1110,

// report errors
UnsupportedReportCommandError = 1120,

// Rules bundle errors.
InvalidUserRulesBundleError = 1130,

Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default async function test(
) {
return await iacTestCommandV2.test();
} else {
return await iacTestCommand(false, ...args);
return await iacTestCommand(...args);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/cli/modes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const modes: Record<string, ModeData> = {
},
},
iac: {
allowedCommands: ['test', 'update-exclude-policy', 'describe', 'report'],
allowedCommands: ['test', 'update-exclude-policy', 'describe'],
config: (args): [] => {
args['iac'] = true;

Expand Down
1 change: 0 additions & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ export enum SupportedCliCommands {
drift = 'drift',
describe = 'describe',
'update-exclude-policy' = 'update-exclude-policy',
report = 'report',
}

export interface IacFileInDirectory {
Expand Down
9 changes: 3 additions & 6 deletions test/jest/acceptance/iac/custom-rules.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,18 @@ describe('iac test --rules', () => {
expect(exitCode).toBe(2);
});

describe.each([
['--report flag', 'test --report'],
['report command', 'report'],
])('when used with the %s', (_, testedCommand) => {
describe('when used with the --report flag', () => {
it('should resolve successfully', async () => {
const { stderr, exitCode } = await run(
`snyk iac ${testedCommand} --rules=./iac/custom-rules/custom.tar.gz ./iac/terraform/sg_open_ssh.tf`,
`snyk iac test --report --rules=./iac/custom-rules/custom.tar.gz ./iac/terraform/sg_open_ssh.tf`,
);
expect(stderr).toEqual('');
expect(exitCode).toEqual(1);
});

it('should display a message informing of the application of custom rules', async () => {
const { stdout } = await run(
`snyk iac ${testedCommand} --rules=./iac/custom-rules/custom.tar.gz ./iac/terraform/sg_open_ssh.tf`,
`snyk iac test --report --rules=./iac/custom-rules/custom.tar.gz ./iac/terraform/sg_open_ssh.tf`,
);

expect(stdout).toContain(
Expand Down
122 changes: 0 additions & 122 deletions test/jest/acceptance/iac/report.spec.ts

This file was deleted.

Loading

0 comments on commit dd7b94c

Please sign in to comment.