Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
GitHub Docs

database index-files

[Plumbing] Index standalone files with a given CodeQL extractor.

Who can use this feature?

CodeQL is available for the following repository types:

Note

This content describes the most recent release of the CodeQL CLI. For more information about this release, seehttps://github.com/github/codeql-cli-binaries/releases.

To see details of the options available for this command in an earlier release, run the command with the--help option in your terminal.

Synopsis

Shell
codeql database index-files --language=<lang> [--threads=<num>] [--ram=<MB>] [--extractor-option=<extractor-option-name=value>] <options>... -- <database>

Description

[Plumbing] Index standalone files with a given CodeQL extractor.

This command selects a set of files under the specified workingdirectory, and applies the given extractor to them. By default, allfiles are selected. Typical invocations will specify options to restrictthe set of included files.

The--include,--exclude, and--prune options all take globpatterns, which can use the following wildcard characters:

  • A single "?" matches any character other than a forward/backwardslash;
  • A single "*" matches any number of characters other than aforward/backward slash;
  • The pattern "**" matches zero or more complete directorycomponents.

Options

Primary Options

<database>

[Mandatory] Path to the CodeQL database under construction. This musthave been prepared for extraction withcodeql database init.

-l, --language=<lang>

[Mandatory] The extractor that should be used to index matching files.

-j, --threads=<num>

Ask the extractor to use this many threads. This option is passed to theextractor as a suggestion. If the CODEQL_THREADS environment variable isset, the environment variable value takes precedence over this option.

You can pass 0 to use one thread per core on the machine, or -N toleaveN cores unused (except still use at least one thread).

-M, --ram=<MB>

Ask the extractor to use this much memory. This option is passed to theextractor as a suggestion. If the CODEQL_RAM environment variable isset, the environment variable value takes precedence over this option.

--working-dir=<dir>

[Advanced] The directory in which the specified command should beexecuted. If this argument is not provided, the command is executed inthe value of--source-root passed tocodeql database create, if one exists. If no--source-root argument is provided, the command is executed in thecurrent working directory.

Options to control extractor behavior

-O, --extractor-option=<extractor-option-name=value>

Set options for CodeQL extractors.extractor-option-name should be ofthe form extractor_name.group1.group2.option_name orgroup1.group2.option_name. Ifextractor_option_name starts with anextractor name, the indicated extractor must declare the optiongroup1.group2.option_name. Otherwise, any extractor that declares theoption group1.group2.option_name will have the option set.value canbe any string that does not contain a newline.

You can use this command-line option repeatedly to set multipleextractor options. If you provide multiple values for the same extractoroption, the behavior depends on the type that the extractor optionexpects. String options will use the last value provided. Array optionswill use all the values provided, in order. Extractor options specifiedusing this command-line option are processed after extractor optionsgiven via--extractor-options-file.

When passed tocodeql database init orcodeql database begin-tracing, the options will only beapplied to the indirect tracing environment. If your workflow also makescalls tocodeql database trace-command then the options also need to be passed there if desired.

Seehttps://codeql.github.com/docs/codeql-cli/extractor-options formore information on CodeQL extractor options, including how to list theoptions declared by each extractor.

--extractor-options-file=<extractor-options-bundle-file>

Specify extractor option bundle files. An extractor option bundle fileis a JSON file (extension.json) or YAML file (extension.yaml or.yml) that sets extractor options. The file must have the top-levelmap key 'extractor' and, under it, extractor names as second-level mapkeys. Further levels of maps represent nested extractor groups, andstring and array options are map entries with string and array values.

Extractor option bundle files are read in the order they are specified.If different extractor option bundle files specify the same extractoroption, the behavior depends on the type that the extractor optionexpects. String options will use the last value provided. Array optionswill use all the values provided, in order. Extractor options specifiedusing this command-line option are processed before extractor optionsgiven via--extractor-option.

When passed tocodeql database init orcodeql database begin-tracing, the options will only beapplied to the indirect tracing environment. If your workflow also makescalls tocodeql database trace-command then the options also need to be passed there if desired.

Seehttps://codeql.github.com/docs/codeql-cli/extractor-options formore information on CodeQL extractor options, including how to list theoptions declared by each extractor.

Options for limiting the set of indexed files

--include-extension=<.ext>

Include all files in the search directory tree that have the givenextension. Typically, you should include the dot before the extension.For example, passing--include-extension .xml will include all fileswith the ".xml" extension. This option is incompatible with negated--include options.

--include=<glob>

Include all files and directories in the search directory tree thatmatch the given glob, using each file and directory's relative pathfrom the search directory. If the glob begins with a! character, thematching files and directories would instead be excluded.

--include options are processed in order, with later optionsoverriding earlier ones. For example,--include ** --include !sub/*.ts --include sub/main.* would includesub/main.ts (because it is included bysub/main.*), excludesub/index.ts (because it is excluded by!sub/*.ts), and includesub/test.js (because it is included by** without being subsequentlyexcluded.)

--also-match=<glob>

Require all results to also match the given glob, using each file anddirectory's relative path from the search directory. This option hasthe same structure and the same interpretation as--include butspecifies a separate sequence of globs that are applied in conjunctionwith--include.

--exclude=<glob>

Exclude all files and directories that match the given glob, using eachfile and directory's relative path from the search directory. Thisoption overrides all include options. This option is incompatible withnegated--include options.

--prune=<glob>

Exclude all files and directories that match the given glob, using eachfile and directory's relative path from the search directory. Thisoption overrides all include options. This option is incompatible withnegated--include options.

--size-limit=<bytes>

Exclude all files whose size exceeds the given limit. The size limit isin bytes, or in kibibytes (KiB) with the "k" suffix, in mebibytes(MiB) with the "m" suffix, and in gibibytes (GiB) with the "g"suffix. This option overrides all include options.

--total-size-limit=<bytes>

Make the command exit with an error if the combined size of all resolvedfiles would exceed the given limit. The size limit is in bytes, or inkibibytes (KiB) with the "k" suffix, in mebibytes (MiB) with the "m"suffix, and in gibibytes (GiB) with the "g" suffix.

--[no-]follow-symlinks

Follow any symbolic links to their targets.

--[no-]find-any

Find at most one match (as opposed to all matches).

Available sincev2.11.3.

Common options

-h, --help

Show this help text.

-J=<opt>

[Advanced] Give option to the JVM running the command.

(Beware that options containing spaces will not be handled correctly.)

-v, --verbose

Incrementally increase the number of progress messages printed.

-q, --quiet

Incrementally decrease the number of progress messages printed.

--verbosity=<level>

[Advanced] Explicitly set the verbosity level to one of errors,warnings, progress, progress+, progress++, progress+++. Overrides-vand-q.

--logdir=<dir>

[Advanced] Write detailed logs to one or more files in the givendirectory, with generated names that include timestamps and the name ofthe running subcommand.

(To write a log file with a name you have full control over, insteadgive--log-to-stderr and redirect stderr as desired.)

--common-caches=<dir>

[Advanced] Controls the location of cached data on disk that willpersist between several runs of the CLI, such as downloaded QL packs andcompiled query plans. If not set explicitly, this defaults to adirectory named.codeql in the user's home directory; it will becreated if it doesn't already exist.

Available sincev2.15.2.


[8]ページ先頭

©2009-2025 Movatter.jp