From b1aee5d9dfd77d1648919e0223e6602bc9e4bfc1 Mon Sep 17 00:00:00 2001 From: Ilianna Papastefanou Date: Mon, 30 May 2022 17:56:23 +0300 Subject: [PATCH] fix: remove warning message from iac --report This commits removes the warning message we used to display when running `snyk iac test --report`, with custom rules (local or remote ones). We now support custom rules when sharing results to the platform, so we remove this message. CFG-1868 --- .../test/iac/local-execution/rules/rules.ts | 13 ++-------- src/lib/formatters/iac-output/index.ts | 1 - src/lib/formatters/iac-output/v2/index.ts | 1 - .../formatters/iac-output/v2/user-messages.ts | 7 ------ test/jest/acceptance/iac/custom-rules.spec.ts | 25 ------------------- 5 files changed, 2 insertions(+), 45 deletions(-) diff --git a/src/cli/commands/test/iac/local-execution/rules/rules.ts b/src/cli/commands/test/iac/local-execution/rules/rules.ts index 5d1741937d..ece5017f20 100644 --- a/src/cli/commands/test/iac/local-execution/rules/rules.ts +++ b/src/cli/commands/test/iac/local-execution/rules/rules.ts @@ -18,10 +18,7 @@ import { initLocalCache, pull } from '../measurable-methods'; import { config as userConfig } from '../../../../../../lib/user-config'; import { CustomError } from '../../../../../../lib/errors'; import { getErrorStringCode } from '../error-utils'; -import { - customRulesMessage, - customRulesReportMessage, -} from '../../../../../../lib/formatters/iac-output'; +import { customRulesMessage } from '../../../../../../lib/formatters/iac-output'; import { OciRegistry, RemoteOciRegistry } from './oci-registry'; import { isValidUrl } from '../url-utils'; @@ -50,13 +47,7 @@ export async function initRules( (isOCIRegistryURLProvided || customRulesPath) && !(options.sarif || options.json) ) { - let userMessage = `${customRulesMessage}${EOL}`; - - if (options.report) { - userMessage += `${customRulesReportMessage}${EOL}`; - } - - console.log(userMessage); + console.log(`${customRulesMessage}${EOL}`); } if (isOCIRegistryURLProvided && customRulesPath) { diff --git a/src/lib/formatters/iac-output/index.ts b/src/lib/formatters/iac-output/index.ts index bc8a7414ba..596e8c35b8 100644 --- a/src/lib/formatters/iac-output/index.ts +++ b/src/lib/formatters/iac-output/index.ts @@ -15,7 +15,6 @@ export { spinnerMessage, spinnerSuccessMessage, customRulesMessage, - customRulesReportMessage, shouldLogUserMessages, formatShareResultsOutput, failuresTipOutput, diff --git a/src/lib/formatters/iac-output/v2/index.ts b/src/lib/formatters/iac-output/v2/index.ts index 2f95cc30d8..3170dcd917 100644 --- a/src/lib/formatters/iac-output/v2/index.ts +++ b/src/lib/formatters/iac-output/v2/index.ts @@ -6,7 +6,6 @@ export { spinnerSuccessMessage, shouldLogUserMessages, customRulesMessage, - customRulesReportMessage, } from './user-messages'; export { formatShareResultsOutput } from './share-results'; export { diff --git a/src/lib/formatters/iac-output/v2/user-messages.ts b/src/lib/formatters/iac-output/v2/user-messages.ts index 2b73450671..ec6d0ed51e 100644 --- a/src/lib/formatters/iac-output/v2/user-messages.ts +++ b/src/lib/formatters/iac-output/v2/user-messages.ts @@ -25,13 +25,6 @@ export const customRulesMessage = colors.info( 'Using custom rules to generate misconfigurations.', ); -/** - * Message for using custom rules. - */ -export const customRulesReportMessage = colors.info( - "Please note that your custom rules will not be sent to the Snyk platform, and will not be available on the project's page.", -); - /** * @returns whether or not to include user messages in the output. */ diff --git a/test/jest/acceptance/iac/custom-rules.spec.ts b/test/jest/acceptance/iac/custom-rules.spec.ts index acf32154d2..cd3483107e 100644 --- a/test/jest/acceptance/iac/custom-rules.spec.ts +++ b/test/jest/acceptance/iac/custom-rules.spec.ts @@ -85,30 +85,5 @@ describe('iac test --rules', () => { 'Using custom rules to generate misconfigurations.', ); }); - - it('should display a warning message for custom rules not being available on the platform', async () => { - const { stdout } = await run( - `snyk iac ${testedCommand} --rules=./iac/custom-rules/custom.tar.gz ./iac/terraform/sg_open_ssh.tf`, - ); - - expect(stdout).toContain( - "Please note that your custom rules will not be sent to the Snyk platform, and will not be available on the project's page.", - ); - }); - - describe.each(['--json', '--sarif'])( - 'when the %s flag is provided', - (testedFormatFlag) => { - it('should not display the warning message for the custom rules not being available on the platform', async () => { - const { stdout } = await run( - `snyk iac ${testedCommand} --rules=./iac/custom-rules/custom.tar.gz ./iac/terraform/sg_open_ssh.tf ${testedFormatFlag}`, - ); - - expect(stdout).not.toContain( - "Please note that your custom rules will not be sent to the Snyk platform, and will not be available on the project's page.", - ); - }); - }, - ); }); });