-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Rust: Add a README.md #17426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Rust: Add a README.md #17426
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8213bbb
Rust: Add a README.md
geoffw0 ac9afea
Rust: Add experimental warning and Bazelisk link.
geoffw0 d9a3711
Update rust/README.md
geoffw0 6b0d7bc
Rust: Remove repo warning because we're merging into main real soon n…
geoffw0 7c95bb2
Rust: Update example path.
geoffw0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Rust on CodeQL | ||
|
||
> [!WARNING] | ||
> Rust support for CodeQL is experimental. No support is offered. QL and database interfaces will change and break without notice or deprecation periods. | ||
|
||
## Development | ||
|
||
### Dependencies | ||
|
||
If you don't have the `semmle-code` repo you may need to install Bazel manually, e.g. from https://github.com/bazelbuild/bazelisk. | ||
|
||
### Building the Rust Extractor | ||
|
||
This approach uses a released `codeql` version and is simpler to use for QL development. From your `semmle-code` directory run: | ||
```bash | ||
bazel run @codeql//rust:rust-installer | ||
``` | ||
You now need to create a [per-user CodeQL configuration file](https://docs.github.com/en/code-security/codeql-cli/using-the-advanced-functionality-of-the-codeql-cli/specifying-command-options-in-a-codeql-configuration-file#using-a-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. | ||
|
||
### Building the Rust Extractor (as a sembuild target) | ||
|
||
This approach allows you to build a Rust extractor with a CLI built from source. From your `semmle-code` directory run: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Presumably one needs to be on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, but we opted to not mention that as we'll all be in |
||
```bash | ||
./build target/intree/codeql-rust | ||
``` | ||
You can now invoke it directly, for example to run some tests: | ||
```bash | ||
./target/intree/codeql-rust/codeql test run ql/rust/ql/test/PATH/TO/TEST/ | ||
``` | ||
|
||
### Building a Database | ||
|
||
TODO | ||
|
||
### Code Generation | ||
|
||
TODO |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put a warning about this being experimental and unsupported, just in case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.