Skip to content

Conversation

geoffw0
Copy link
Contributor

@geoffw0 geoffw0 commented Sep 30, 2025

Add "Basic query for Rust code" doc page, similar to the one we have for most other languages.

@geoffw0 geoffw0 added the no-change-note-required This PR does not need a change note label Sep 30, 2025
@Copilot Copilot AI review requested due to automatic review settings September 30, 2025 14:36
@geoffw0 geoffw0 added ready-for-doc-review This PR requires and is ready for review from the GitHub docs team. Rust Pull requests that update Rust code labels Sep 30, 2025
@github-actions github-actions bot added documentation and removed Rust Pull requests that update Rust code labels Sep 30, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a "Basic query for Rust code" documentation page to help users learn how to write and run simple CodeQL queries for Rust. The documentation follows the established pattern used for other supported languages and provides a tutorial for creating a query that identifies redundant if expressions.

  • Adds comprehensive tutorial documentation for writing basic Rust CodeQL queries
  • Updates the language guide index to include the new documentation page
  • Uses consistent formatting and structure with existing language guide documentation

Reviewed Changes

Copilot reviewed 2 out of 5 changed files in this pull request and generated 1 comment.

File Description
docs/codeql/codeql-language-guides/codeql-for-rust.rst Updates the table of contents to include the new basic query tutorial
docs/codeql/codeql-language-guides/basic-query-for-rust-code.rst Adds complete tutorial documentation for writing basic Rust CodeQL queries

| | | ``.getStmtList()``: gets the list of things in the block. |
| | | ``.getNumberOfStmtOrExpr() = 0``: requires that there are no statements or expressions in the block. |
+----------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
| ``select ifExpr, "This 'if' expression is redundant."`` | Defines what to report for each match. | Reports the resulting ``if`` expression with a string that explains the problem. |
Copy link
Preview

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message refers to 'if' expression, but line 36 uses 'if' statement. The terminology should be consistent - use 'if' expression in both places since Rust treats if as an expression.

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, though it's line 36 that should be updated - they're if "expressions" in Rust.

Updated the doc.

I'll need to re-create the screenshots as well, but lets wait and see if any other changes are suggested first...

subatoi
subatoi previously approved these changes Oct 1, 2025
Copy link
Contributor

@subatoi subatoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine words-wise, as far as I can tell looking at the rST

I'm not sure why the Sphinx build is failing... ideally we'd get it working, which would make reviewing more complete, but if that's not possible I think this is OK

@geoffw0
Copy link
Contributor Author

geoffw0 commented Oct 1, 2025

I think I've fixed it now.

I'll update the graphics next...

@geoffw0
Copy link
Contributor Author

geoffw0 commented Oct 1, 2025

Done. Ready for another look.

Copy link
Contributor

@subatoi subatoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing that! I took a look in a browser and all looks good

@geoffw0 geoffw0 merged commit f96a42c into github:main Oct 1, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation no-change-note-required This PR does not need a change note ready-for-doc-review This PR requires and is ready for review from the GitHub docs team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants