Scan source code with Snyk Code using the CLI

Snyk Code enables you to test the source code of your repositories using the Snyk CLI.

When testing your repository code via the CLI, you can:

When you test a folder, all its sub-folders and files are also tested. You can test a single file in the current folder, or a single file in another folder by specifying the absolute path to the file.

You can also test files with a relative path reference by prefixing the path with $PWD, for example, snyk code test $PWD/path/to/file. This works with bash.

To exclude certain directories or files from the Snyk Code CLI test, you can use the following means:

Testing a repository from its root folder

To test the current repository folder, in the terminal, enter the following:

snyk code test

No additional options are required for using the