Save time by adding your frequently used command options and custom CodeQL packs to a CodeQL configuration file.
Create and save a config file under your home (Linux and macOS) or user profile (Windows) directory in the .config/codeql/ subdirectory. For example, $HOME/.config/codeql/config.
In the config file, specify the options you want to apply to your CodeQL commands. The syntax for specifying options is as follows:
<command> <subcommand> <option> <value>
To apply the same options to more than one command, you can:
<subcommand>, which will specify the option for every relevant <subcommand><command> and <subcommand>, which will specify the option globally for every relevant <command> and <subcommand>Note
config files only accept spaces, not =, between option flags and values.config value defined for that option.<command>, <subcommand>, or globally, use one line per option.To output all analysis results generated by codeql database analyze as CSV format, you would specify:
database analyze --format csv
Here, you have to specify the command and subcommand to prevent any of the low-level commands that are executed during database analyze being passed the same --format option.
To define the RAM (4096 MB) and number of threads (4) to use when running CodeQL commands, specify the following, on separate lines:
--ram 4096
--threads 4
To globally specify a directory for CodeQL to scan for CodeQL packs (which is not a sibling of the installation directory), use:
--search-path <path-to-directory>