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

fix: remove warning message for custom rules from iac --report #3287

Merged
merged 1 commit into from
Jun 6, 2022
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
13 changes: 2 additions & 11 deletions src/cli/commands/test/iac/local-execution/rules/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion src/lib/formatters/iac-output/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export {
spinnerMessage,
spinnerSuccessMessage,
customRulesMessage,
customRulesReportMessage,
shouldLogUserMessages,
formatShareResultsOutput,
failuresTipOutput,
Expand Down
1 change: 0 additions & 1 deletion src/lib/formatters/iac-output/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export {
spinnerSuccessMessage,
shouldLogUserMessages,
customRulesMessage,
customRulesReportMessage,
} from './user-messages';
export { formatShareResultsOutput } from './share-results';
export {
Expand Down
7 changes: 0 additions & 7 deletions src/lib/formatters/iac-output/v2/user-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
25 changes: 0 additions & 25 deletions test/jest/acceptance/iac/custom-rules.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
);
});
},
);
});
});