Skip to content

Commit e8958c8

Browse files
committed
Merge remote-tracking branch 'upstream/main' into jsinglet/language3
# Conflicts: # c/misra/src/rules/RULE-1-2/LanguageExtensionsShouldNotBeUsed.ql # c/misra/test/rules/RULE-1-2/LanguageExtensionsShouldNotBeUsed.expected # c/misra/test/rules/RULE-1-2/test.c # cpp/common/src/codingstandards/cpp/exclusions/c/Language2.qll # cpp/common/src/codingstandards/cpp/exclusions/c/RuleMetadata.qll # rule_packages/c/Language2.json # rules.csv
2 parents fa8c05c + 4a04ff2 commit e8958c8

File tree

907 files changed

+28405
-4805
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

907 files changed

+28405
-4805
lines changed

.codeqlmanifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "provide": [ "codeql_modules/*/.codeqlmanifest.json", "cpp/.codeqlmanifest.json", "c/.codeqlmanifest.json"] }
1+
{ "provide": [ "cpp/*/src/qlpack.yml", "cpp/*/test/qlpack.yml", "c/*/src/qlpack.yml", "c/*/test/qlpack.yml", "scripts/generate_modules/queries/qlpack.yml" ] }
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Install CodeQL library pack dependencies
2+
description: |
3+
Downloads any necessary CodeQL library packs needed by packs in the repo.
4+
inputs:
5+
cli_path:
6+
description: |
7+
The path to the CodeQL CLI directory.
8+
required: false
9+
10+
mode:
11+
description: |
12+
The `--mode` option to `codeql pack install`.
13+
required: true
14+
default: verify
15+
16+
runs:
17+
using: composite
18+
steps:
19+
- name: Install CodeQL library packs
20+
shell: bash
21+
env:
22+
CODEQL_CLI: ${{ inputs.cli_path }}
23+
run: |
24+
PATH=$PATH:$CODEQL_CLI
25+
python scripts/install-packs.py --mode ${{ inputs.mode }}

.github/pull_request_template.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ _**Author:**_ Is a change note required?
3232
- [ ] Yes
3333
- [ ] No
3434

35+
🚨🚨🚨
36+
_**Reviewer:**_ Confirm that format of *shared* queries (not the .qll file, the
37+
.ql file that imports it) is valid by running them within VS Code.
38+
- [ ] Confirmed
39+
40+
3541
_**Reviewer:**_ Confirm that either a change note is not required or the change note is required and has been added.
3642
- [ ] Confirmed
3743

.github/touch

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/bump-version.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,5 @@ jobs:
2727
title: "Release Engineering: Version bump to ${{ github.event.inputs.new_version }}."
2828
body: "This PR updates codeql-coding-standards to version ${{ github.event.inputs.new_version }}."
2929
commit-message: "Version bump to ${{ github.event.inputs.new_version }}."
30-
team-reviewers: github/codeql-coding-standards
3130
delete-branch: true
3231
branch: "automation/version-bump-${{ github.event.inputs.new_version }}"

.github/workflows/code-scanning-pack-gen.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Code Scanning Query Pack Generation
22

33
on:
4+
merge_group:
45
pull_request:
56
branches:
67
- main
@@ -59,6 +60,11 @@ jobs:
5960
codeql-home: ${{ github.workspace }}/codeql_home
6061
add-to-path: false
6162

63+
- name: Install CodeQL packs
64+
uses: ./.github/actions/install-codeql-packs
65+
with:
66+
cli_path: ${{ github.workspace }}/codeql_home/codeql
67+
6268
- name: Checkout external help files
6369
continue-on-error: true
6470
id: checkout-external-help-files
@@ -82,11 +88,11 @@ jobs:
8288
run: |
8389
PATH=$PATH:$CODEQL_HOME/codeql
8490
85-
codeql query compile --search-path cpp --threads 0 cpp
86-
codeql query compile --search-path c --search-path cpp --threads 0 c
91+
codeql query compile --threads 0 cpp
92+
codeql query compile --threads 0 c
8793
8894
cd ..
89-
zip -r codeql-coding-standards/code-scanning-cpp-query-pack.zip codeql-coding-standards/c/ codeql-coding-standards/cpp/ codeql-coding-standards/.codeqlmanifest.json codeql-coding-standards/supported_codeql_configs.json codeql-coding-standards/scripts/deviations codeql-coding-standards/scripts/reports
95+
zip -r codeql-coding-standards/code-scanning-cpp-query-pack.zip codeql-coding-standards/c/ codeql-coding-standards/cpp/ codeql-coding-standards/.codeqlmanifest.json codeql-coding-standards/supported_codeql_configs.json codeql-coding-standards/scripts/configuration codeql-coding-standards/scripts/reports codeql-coding-standards/scripts/shared codeql-coding-standards/scripts/guideline_recategorization codeql-coding-standards/scripts/shared codeql-coding-standards/scripts/schemas
9096
9197
- name: Upload GHAS Query Pack
9298
uses: actions/upload-artifact@v2

.github/workflows/codeql_unit_tests.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: CodeQL Unit Testing
22

33
on:
4+
merge_group:
45
push:
56
branches:
67
- main
@@ -47,6 +48,9 @@ jobs:
4748
uses: actions/setup-python@v4
4849
with:
4950
python-version: "3.9"
51+
52+
- name: Install Python dependencies
53+
run: pip install -r scripts/requirements.txt
5054

5155
- name: Cache CodeQL
5256
id: cache-codeql
@@ -66,11 +70,15 @@ jobs:
6670
codeql-home: ${{ github.workspace }}/codeql_home
6771
add-to-path: false
6872

73+
- name: Install CodeQL packs
74+
uses: ./.github/actions/install-codeql-packs
75+
with:
76+
cli_path: ${{ github.workspace }}/codeql_home/codeql
77+
6978
- name: Pre-Compile Queries
7079
id: pre-compile-queries
7180
run: |
72-
${{ github.workspace }}/codeql_home/codeql/codeql query compile --search-path cpp --threads 0 cpp
73-
${{ github.workspace }}/codeql_home/codeql/codeql query compile --search-path c --search-path cpp --threads 0 c
81+
${{ github.workspace }}/codeql_home/codeql/codeql query compile --threads 0 ${{ matrix.language }}
7482
7583
7684
- name: Run test suites
@@ -122,18 +130,11 @@ jobs:
122130
os.makedirs(os.path.dirname(test_report_path), exist_ok=True)
123131
test_report_file = open(test_report_path, 'w')
124132
files_to_close.append(test_report_file)
125-
if "${{ matrix.language }}".casefold() == "c".casefold():
126-
# c tests require cpp -- but we don't want c things on the cpp
127-
# path in case of design errors.
128-
cpp_language_root = Path(workspace, 'cpp')
129-
procs.append(subprocess.Popen([codeql_bin, "test", "run", "--failing-exitcode=122", f"--slice={slice}/{num_slices}", "--ram=2048", "--format=json", f'--search-path={cpp_language_root}', f'--search-path={language_root}', *test_roots], stdout=test_report_file, stderr=subprocess.PIPE))
130-
else:
131-
procs.append(subprocess.Popen([codeql_bin, "test", "run", "--failing-exitcode=122", f"--slice={slice}/{num_slices}", "--ram=2048", "--format=json", f'--search-path={language_root}', f'--search-path={language_root}', *test_roots], stdout=test_report_file, stderr=subprocess.PIPE))
133+
procs.append(subprocess.Popen([codeql_bin, "test", "run", "--failing-exitcode=122", f"--slice={slice}/{num_slices}", "--ram=2048", "--format=json", *test_roots], stdout=test_report_file, stderr=subprocess.PIPE))
132134
133135
for p in procs:
134-
p.wait()
136+
_, err = p.communicate()
135137
if p.returncode != 0:
136-
_, err = p.communicate()
137138
if p.returncode == 122:
138139
# Failed because a test case failed, so just print the regular output.
139140
# This will allow us to proceed to validate-test-results, which will fail if

.github/workflows/create-draft-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
inputs:
66
release_version_tag:
77
description: |
8-
The tag for the new draft release, e.g. v0.5.1.
8+
The tag for the new draft release, e.g. 0.5.1 - do not include the `v`.
99
required: true
1010
codeql_analysis_threads:
1111
description: |
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: 🤖 Run Matrix Check
2+
3+
on:
4+
pull_request_target:
5+
types: [synchronize,opened]
6+
branches:
7+
- "**"
8+
workflow_dispatch:
9+
10+
jobs:
11+
dispatch-matrix-check:
12+
runs-on: ubuntu-latest
13+
steps:
14+
15+
- name: Test Variables
16+
shell: pwsh
17+
run: |
18+
Write-Host "Running as: ${{github.actor}}"
19+
20+
- name: Dispatch Matrix Testing Job
21+
if: ${{ contains(fromJSON('["jsinglet", "mbaluda", "lcartey", "rvermeulen", "ravikprasad", "jeongsoolee09", "hohn", "knewbury01", "kraiouchkine"]'), github.actor) }}
22+
uses: peter-evans/repository-dispatch@v2
23+
with:
24+
token: ${{ secrets.RELEASE_ENGINEERING_TOKEN }}
25+
repository: github/codeql-coding-standards-release-engineering
26+
event-type: matrix-test
27+
client-payload: '{"pr": "${{ github.event.number }}"}'
28+
29+
30+
- uses: actions/github-script@v6
31+
if: ${{ contains(fromJSON('["jsinglet", "mbaluda", "lcartey", "rvermeulen", "ravikprasad", "jeongsoolee09", "hohn", "knewbury01", "kraiouchkine"]'), github.actor) }}
32+
with:
33+
script: |
34+
github.rest.issues.createComment({
35+
issue_number: context.issue.number,
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
body: '🤖 Beep Boop! Matrix Testing for this PR has been initiated. Please check back later for results. <br><br> :bulb: If you do not hear back from me please check my status! **I will report even if this PR does not contain files eligible for matrix testing.**'
39+
})
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: 🏁 Run Release Performance Check
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
branches:
7+
- main
8+
- "rc/**"
9+
- next
10+
11+
jobs:
12+
dispatch-matrix-check:
13+
runs-on: ubuntu-latest
14+
steps:
15+
16+
- name: Test Variables
17+
shell: pwsh
18+
run: |
19+
Write-Host "Running as: ${{github.actor}}"
20+
21+
$actor = "${{github.actor}}"
22+
23+
$acl = @("jsinglet","mbaluda", "lcartey", "rvermeulen", "ravikprasad", "jeongsoolee09", "hohn", "knewbury01", "kraiouchkine")
24+
25+
if(-not ($actor -in $acl)){
26+
throw "Refusing to run workflow for user not in acl."
27+
}
28+
29+
- name: Dispatch Performance Testing Job
30+
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/test-performance') }}
31+
uses: peter-evans/repository-dispatch@v2
32+
with:
33+
token: ${{ secrets.RELEASE_ENGINEERING_TOKEN }}
34+
repository: github/codeql-coding-standards-release-engineering
35+
event-type: performance-test
36+
client-payload: '{"pr": "${{ github.event.issue.number }}"}'
37+
38+
39+
- uses: actions/github-script@v6
40+
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/test-performance') }}
41+
with:
42+
script: |
43+
github.rest.issues.createComment({
44+
issue_number: context.issue.number,
45+
owner: context.repo.owner,
46+
repo: context.repo.repo,
47+
body: '🏁 Beep Boop! Performance testing for this PR has been initiated. Please check back later for results. Note that the query package generation step must complete before testing will start so it might be a minute. <br><br> :bulb: If you do not hear back from me please check my status! **I will report even if I fail!**'
48+
})

0 commit comments

Comments
 (0)