Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
32f3d54
First implementation of Rule 22-3-1
MichaelRFairhurst Nov 25, 2025
117afb6
update pack locks
MichaelRFairhurst Nov 25, 2025
4c3f971
Bump actions/checkout from 5 to 6
dependabot[bot] Dec 24, 2025
c29ca80
Add lifetime rule RULE-11-6-2
knewbury01 Feb 3, 2026
5830686
Merge branch 'main' into dependabot/github_actions/actions/checkout-6
MichaelRFairhurst Feb 7, 2026
0d02cef
Merge remote-tracking branch 'origin/main' into michaelrfairhurst/pre…
MichaelRFairhurst Feb 25, 2026
b72d975
Merge remote-tracking branch 'origin/main' into michaelrfairhurst/pre…
MichaelRFairhurst Feb 26, 2026
4eeadb0
Merge branch 'main' into michaelrfairhurst/preconditions-rule-22-3-1-…
MichaelRFairhurst Feb 28, 2026
3d71876
Merge branch 'main' into michaelrfairhurst/preconditions-rule-22-3-1-…
MichaelRFairhurst Mar 4, 2026
cbec99e
Merge branch 'main' into michaelrfairhurst/preconditions-rule-22-3-1-…
MichaelRFairhurst Mar 5, 2026
6fb7d61
Bump version to 2.56.0-dev
knewbury01 Mar 6, 2026
6956667
Merge branch 'main' into knewbury01/Lifetime
knewbury01 Mar 6, 2026
c38d0ee
Merge pull request #1073 from github/release-automation/bump-version-…
knewbury01 Mar 9, 2026
86123fe
Update cpp/common/src/codingstandards/cpp/standardlibrary/Assert.qll
mbaluda Mar 10, 2026
9651122
Add improvements to readofuninitializedmemory and testcase
knewbury01 Mar 10, 2026
d0f2ede
Remove unnecessary import in readofuninitializedmemory
knewbury01 Mar 10, 2026
1c610ee
Add shared query for RULE-6-8-3
knewbury01 Mar 10, 2026
a903b40
Merge branch 'main' into knewbury01/Lifetime
knewbury01 Mar 10, 2026
1704bb8
Format query
knewbury01 Mar 10, 2026
dd5ebd3
Merge branch 'knewbury01/Lifetime' of https://github.com/knewbury01/c…
knewbury01 Mar 10, 2026
ac21481
Add another missing query format
knewbury01 Mar 10, 2026
b2e8f3a
Revert shared rule to class not module since it shares with old style
knewbury01 Mar 10, 2026
1649c21
Improve tests to be more clear on whether certain cases are supported…
knewbury01 Mar 11, 2026
9e62570
Import EXP51-CPP into rule 4-1-3 as it is UB
MichaelRFairhurst Mar 14, 2026
5680bbd
Bump actions/create-github-app-token from 2 to 3
dependabot[bot] Mar 16, 2026
f5501da
Comment fix on aborts+asserts
MichaelRFairhurst Mar 17, 2026
8071ddb
Merge pull request #986 from github/michaelrfairhurst/preconditions-r…
MichaelRFairhurst Mar 17, 2026
af8a42b
Merge pull request #985 from github/dependabot/github_actions/actions…
MichaelRFairhurst Mar 17, 2026
25403fc
Merge pull request #1085 from github/dependabot/github_actions/action…
MichaelRFairhurst Mar 17, 2026
db1a631
Address review comments
knewbury01 Mar 17, 2026
3baadfb
Fix testcase formatting
knewbury01 Mar 17, 2026
242422b
Address review comments
knewbury01 Mar 18, 2026
10f562a
Merge branch 'main' into knewbury01/Lifetime
knewbury01 Mar 18, 2026
1487ba0
Merge pull request #1024 from knewbury01/knewbury01/Lifetime
MichaelRFairhurst Mar 19, 2026
f739b65
Add RULE-13-3-3
knewbury01 Mar 19, 2026
f999e10
Fix testcase labelling RULE-13-3-3
knewbury01 Mar 19, 2026
c6997fd
Address review comment
knewbury01 Mar 19, 2026
a4ca148
Apply a few other review comments
knewbury01 Mar 19, 2026
1371769
Merge branch 'main' into knewbury01/misracpp2023-declarations1
knewbury01 Mar 19, 2026
ad580d3
Merge pull request #1089 from knewbury01/knewbury01/misracpp2023-decl…
MichaelRFairhurst Mar 23, 2026
664a54a
Add query validation guidelines to copilot review instructions
mbaluda Mar 24, 2026
83cf49c
Revise QLDoc style guide and add examples
mbaluda Mar 24, 2026
26402a3
Update .github/copilot-instructions.md
mbaluda Mar 24, 2026
b65b58f
Update .github/copilot-instructions.md
mbaluda Mar 24, 2026
5364072
Update .github/copilot-instructions.md
mbaluda Mar 24, 2026
0c29859
Update .github/copilot-instructions.md
mbaluda Mar 24, 2026
fb0af07
Update CodeQL guidelines and QLDoc requirements
mbaluda Mar 25, 2026
df3074e
Merge pull request #1092 from github/mbaluda-patch-1
mbaluda Mar 25, 2026
c148d75
Merge branch 'main' into michaelrfairhurst/package-undefined-behavior…
mbaluda Mar 25, 2026
8e8feef
Update .github/workflows/validate-query-formatting.yml
mbaluda Mar 25, 2026
9d539a3
Address copilot review
mbaluda Mar 25, 2026
8ba9aff
Fix expected file
mbaluda Mar 25, 2026
e57263b
Merge branch 'michaelrfairhurst/package-undefined-behavior' into mich…
MichaelRFairhurst Mar 27, 2026
614a802
Merge remote-tracking branch 'origin/michaelrfairhurst/package-undefi…
MichaelRFairhurst Mar 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
201 changes: 201 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,204 @@ When reviewing tests, it is critical to:
- Check that the locations do not refer to files in the standard library, as these have issues in GitHub's Code Scanning UI and complicate our compiler compatibility tests.
- Consider the "test coverage" of the query, are each of its logical statements effectively exercised individually, collectively? The test should neither be overly bloated nor under specified.
- Consider the edge cases of the language itself, will the analysis work in non-trivial cases, are all relevant language concepts tested here? This doesn't need to be exhaustive, but it should be thoughfully thorough.

## Validating Query Style

The following list describes the required style guides for a query that **must** be validated during the code-review process.

A query **must** include:

- A use of the `isExcluded` predicate on the element reported as the primary location. This predicate ensures that we have a central mechanism for excluding results. This predicate may also be used on other elements relevant to the alert, but only if a suppression on that element should also cause alerts on the current element to be suppressed.
- A well formatted alert message:
- The message should be a complete standalone sentence, with punctuation and a period.
- The message should refer to this particular instance of the problem, rather than repeating the generic rule. e.g. "Call to banned function x." instead of "Do not use function x."
- Code elements should be placed in 'single quotes', unless they are formatted as links.
- Avoid value judgments such as "dubious" and "suspicious", and focus on factual statements about the problem.
- If possible, avoid constant alert messages. Either add placeholders and links (using $@), or concatenate element names to the alert message. Non-constant messages make it easier to find particular results, and links to other program elements can help provide additional context to help a developer understand the results. Examples:
- Instead of `Call to banned function.` prefer `Call to banned function foobar.`.
- Instead of `Return value from call is unused.` prefer `Return value from call to function [x] is unused.`, where `[x]` is a link to the function itself.
- Do not try to explain the solution in the message; instead that should be provided in the help for the query.

All lines in CodeQL source files and test files should be kept to a maximum of 100 characters.

All public predicates, classes, modules and files should be documented with QLDoc. All QLDoc should follow the following QLDoc style guide:

### General QLDoc requirements

1. Documentation must adhere to the [QLDoc specification](https://codeql.github.com/docs/ql-language-reference/ql-language-specification/#qldoc).
1. Documentation comments should be appropriate for users of the code.
1. Documentation for maintainers of the code must use normal comments.
1. Use `/** ... */` for documentation, even for single line comments.
- For single-line documentation, the `/**` and `*/` are written on the same line as the comment.
- For multi-line documentation, the `/**` and `*/` are written on separate lines. There is a `*` preceding each comment line, aligned on the first `*`.
1. Use code formatting (backticks) within comments for code from the source language, and also for QL code (for example, names of classes, predicates, and variables).
1. Give explanatory examples of code in the target language, enclosed in ```` ```<target language> ```` or `` ` ``.


### Language requirements

1. Use American English.
1. Use full sentences, with capital letters and periods, except for the initial sentence of the comment, which may be fragmentary as described below.
1. Use simple sentence structures and avoid complex or academic language.
1. Avoid colloquialisms and contractions.
1. Use words that are in common usage.


### Requirements for specific items

1. Public declarations must be documented.
1. Non-public declarations should be documented.
1. Declarations in query files should be documented.
1. Library files (`.qll` files) should have a documentation comment at the top of the file.
1. Query files, except for tests, must have a QLDoc query documentation comment at the top of the file.

### QLDoc for predicates

1. Refer to all predicate parameters in the predicate documentation.
1. Reference names, such as types and parameters, using backticks `` ` ``.
1. Give examples of code in the target language, enclosed in ```` ```<target language> ```` or `` ` ``.
1. Predicates that override a single predicate don't need QLDoc, as they will inherit it.

#### Predicates without result

1. Use a third-person verb phrase of the form ``Holds if `arg` has <property>.``
1. Avoid:
- `/** Whether ... */`
- `/** Relates ... */`
- Question forms:
- ``/** Is `x` a foo? */``
- ``/** Does `x` have a bar? */``

##### Example

```ql
/**
* Holds if the qualifier of this call has type `qualifierType`.
* `isExactType` indicates whether the type is exact, that is, whether
* the qualifier is guaranteed not to be a subtype of `qualifierType`.
*/
```

#### Predicates with result

1. Use a third-person verb phrase of the form `Gets (a|the) <thing>.`
1. Use "if any" if the item is usually unique but might be missing. For example
`Gets the body of this method, if any.`
1. If the predicate has more complex behaviour, for example multiple arguments are conceptually "outputs", it can be described like a predicate without a result. For example
``Holds if `result` is a child of this expression.``
1. Avoid:
- `Get a ...`
- `The ...`
- `Results in ...`
- Any use of `return`

##### Example
```ql
/**
* Gets the expression denoting the super class of this class,
* or nothing if this is an interface or a class without an `extends` clause.
*/
```

#### Deprecated predicates

The documentation for deprecated predicates should be updated to emphasize the deprecation and specify what predicate to use as an alternative.
Insert a sentence of the form `DEPRECATED: Use <other predicate> instead.` at the start of the QLDoc comment.

##### Example

```ql
/** DEPRECATED: Use `getAnExpr()` instead. */
deprecated Expr getInitializer()
```

#### Internal predicates

Some predicates are internal-only declarations that cannot be made private. The documentation for internal predicates should begin with `INTERNAL: Do not use.`

##### Example

```ql
/**
* INTERNAL: Do not use.
*/
```

#### Special predicates

Certain special predicates should be documented consistently.

- Always document `toString` as

```ql
/** Gets a textual representation of this element. */
string toString() { ... }
```

- Always document `hasLocationInfo` as

```ql
/**
* Holds if this element is at the specified location.
* The location spans column `startcolumn` of line `startline` to
* column `endcolumn` of line `endline` in file `filepath`.
* For more information, see
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
*/

predicate hasLocationInfo(string filepath, int startline, int startcolumn, int endline, int endcolumn) { ... }
```

### QLDoc for classes

1. Document classes using a noun phrase of the form `A <domain element> that <has property>.`
1. Use "that", not "which".
1. Refer to member elements in the singular.
1. Where a class denotes a generic concept with subclasses, list those subclasses.

##### Example

```ql
/**
* A delegate declaration, for example
* ```
* delegate void Logger(string text);
* ```
*/
class Delegate extends ...
```

```ql
/**
* An element that can be called.
*
* Either a method (`Method`), a constructor (`Constructor`), a destructor
* (`Destructor`), an operator (`Operator`), an accessor (`Accessor`),
* an anonymous function (`AnonymousFunctionExpr`), or a local function
* (`LocalFunction`).
*/
class Callable extends ...
```

### QLDoc for modules

Modules should be documented using a third-person verb phrase of the form `Provides <classes and predicates to do something>.`

##### Example

```ql
/** Provides logic for determining constant expressions. */
```
```ql
/** Provides classes representing the control flow graph within functions. */
```

### Special variables

When referring to `this`, you may either refer to it as `` `this` `` or `this <type>`. For example:
- ``Holds if `this` is static.``
- `Holds if this method is static.`

When referring to `result`, you may either refer to it as `` `result` `` or as `the result`. For example:
- ``Holds if `result` is a child of this expression.``
- `Holds if the result is a child of this expression.`
6 changes: 3 additions & 3 deletions .github/workflows/code-scanning-pack-gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
matrix: ${{ steps.export-code-scanning-pack-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Export Code Scanning pack matrix
id: export-code-scanning-pack-matrix
run: |
Expand All @@ -44,7 +44,7 @@ jobs:
fail-fast: false
matrix: ${{ fromJSON(needs.prepare-code-scanning-pack-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6

- name: Cache CodeQL
id: cache-codeql
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
id: checkout-external-help-files
# PRs from forks and dependabot do not have access to an appropriate token for cloning the help files repos
if: ${{ !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }}
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
ssh-key: ${{ secrets.CODEQL_CODING_STANDARDS_HELP_KEY }}
repository: "github/codeql-coding-standards-help"
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/codeql_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
- main
- next
- "rc/**"
- michaelrfairhurst/package-undefined-behavior

jobs:

Expand All @@ -26,7 +25,7 @@ jobs:
matrix: ${{ steps.export-unit-test-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Export unit test matrix
id: export-unit-test-matrix
Expand All @@ -48,7 +47,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Install Python
uses: actions/setup-python@v6
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dispatch-matrix-test-on-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Check permission
id: check-write-permission
Expand All @@ -23,7 +23,7 @@ jobs:

- name: Generate token
id: generate-token
uses: actions/create-github-app-token@v2
uses: actions/create-github-app-token@v3
with:
app-id: ${{ vars.AUTOMATION_APP_ID }}
private-key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dispatch-release-performance-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Check permission
id: check-write-permission
Expand All @@ -23,7 +23,7 @@ jobs:

- name: Generate token
id: generate-token
uses: actions/create-github-app-token@v2
uses: actions/create-github-app-token@v3
with:
app-id: ${{ vars.AUTOMATION_APP_ID }}
private-key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/extra-rule-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
- main
- "rc/**"
- next
- michaelrfairhurst/package-undefined-behavior


jobs:
Expand All @@ -24,7 +23,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Check Rules
shell: pwsh
Expand All @@ -36,7 +35,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Ensure CPP Shared Rules Have Valid Structure
shell: pwsh
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/finalize-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ jobs:
fi
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
ref: ${{ env.REF }}
fetch-depth: 0
path: release

- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
ref: ${{ env.TOOL_REF }}
path: tooling
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
- name: Generate token
if: env.HOTFIX_RELEASE == 'false'
id: generate-token
uses: actions/create-github-app-token@v2
uses: actions/create-github-app-token@v3
with:
app-id: ${{ vars.AUTOMATION_APP_ID }}
private-key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-html-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Install Python
uses: actions/setup-python@v6
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
ref: ${{ inputs.ref }}

Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
- name: Generate token
id: generate-token
uses: actions/create-github-app-token@v2
uses: actions/create-github-app-token@v3
with:
app-id: ${{ vars.AUTOMATION_APP_ID }}
private-key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/standard_library_upgrade_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix: ${{ steps.export-unit-test-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Export unit test matrix
id: export-unit-test-matrix
Expand All @@ -43,7 +43,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Setup Python 3
uses: actions/setup-python@v6
Expand Down
Loading
Loading