Skip to content

Latest commit

 

History

History
64 lines (49 loc) · 2.29 KB

File metadata and controls

64 lines (49 loc) · 2.29 KB
description Reference for the codeql query compile command

Command Resource for codeql query compile

The codeql query compile command is used to compile CodeQL queries to check for syntax and semantic errors.

Primary use of codeql query compile

The following is an example use of the command for compiling a query:

# Just check that the QL is valid and print any errors
# Do not actually optimize and store a query plan.
# This can be much faster than a full compilation.
# Use default options for `--format` and `--warnings` arguments.
codeql query compile \
    --check-only \
    --format=text \
    --warnings=show \
    -- languages/<language>/<pack-basename>/src/<QueryBasename>/<QueryBasename>.ql

Alternative uses of codeql query compile

The codeql query compile command can also supports many options:

# Just check that the QL is valid and print any errors.
# Use the `json` output format and hide/suppress warning-level compilation messages.
# Don't check embedded query metadata in QLDoc comments for validity.
codeql query compile \
    --check-only \
    --format=json \
    --no-metadata-verification \
    --warnings=hide \
    -- languages/<language>/<pack-basename>/src/<QueryBasename>/<QueryBasename>.ql
# Perform full compilation of the query, even though using `--check-only` would be much faster.
# Use the `json` output format and treat warning-level compilation messages as errors.
codeql query compile \
    --format=json \
    --warnings=error \
    -- languages/<language>/<pack-basename>/src/<QueryBasename>/<QueryBasename>.ql

Help for codeql query compile

Run codeql query compile -h for more information. Run codeql query compile -h -vv for much more information.

Commands commonly run BEFORE codeql query compile

Commands commonly run AFTER codeql query compile