[!WARNING] Rust support for CodeQL is experimental. No support is offered. QL and database interfaces will change and break without notice or deprecation periods.
If you don't have the semmle-code
repo you may need to install Bazel manually, e.g. from https://github.com/bazelbuild/bazelisk.
This approach uses a released codeql
version and is simpler to use for QL development. From anywhere under your semmle-code
or codeql
directory you can run:
bazel run @codeql//rust:install
You can use shorter versions of the above command:
bazel run //rust:install # if under the `codeql` checkout
bazel run rust:install # if at the root of the `codeql` checkout
bazel run :install # if at the `rust` directory of the `codeql` checkout
You now need to create a per-user CodeQL configuration file and specify the option:
--search-path PATH/TO/semmle-code/ql
(wherever the codeql
checkout is on your system)
You can now use the Rust extractor e.g. to run Rust tests from the command line or in VSCode.
This approach allows you to build a Rust extractor with a CLI built from source. From your semmle-code
directory run:
./build target/intree/codeql-rust
You can now invoke it directly, for example to run some tests:
./target/intree/codeql-rust/codeql test run ql/rust/ql/test/PATH/TO/TEST/
TODO
If you make changes to either
ast-generator/
, orschema/*.py
you'll need to regenerate code. You can do so running
bazel run @codeql//rust/codegen
Sometimes, especially if resolving conflicts on generated files, you might need to run
bazel run @codeql//rust/codegen -- --force
for code generation to succeed.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。