Skip to content

Add basic single translation unit query suites #60

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
4 changes: 1 addition & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,11 @@
"type": "pickString",
"options": [
"Allocations",
"Banned",
"BannedFunctions",
"BannedLibraries",
"BannedSyntax",
"BannedTypes",
"Classes",
"Classes",
"Classes",
"Comments",
"Contracts1",
"Concurrency",
Expand Down
3 changes: 3 additions & 0 deletions change_notes/2022-08-17-add-single-translation-unit-suites.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Added the `autosar-single-translation-unit.qls` and `cert-single-translation-unit.qls` query suites for C++.
- These include a subset of queries which are suitable for running over databases including only a single translation unit.
- The initial version includes rules from the "Banned*" C++ packages. Future updates will add additional queries into this suite as they are identified as suitable.
2 changes: 1 addition & 1 deletion cpp/autosar/src/codeql-suites/autosar-advisory.qls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- description: AUTOSAR C++14 Guidelines 19-11 (Advisory)
- description: AUTOSAR C++14 Guidelines 20-11 (Advisory)
- qlpack: autosar-cpp-coding-standards
- include:
kind:
Expand Down
2 changes: 1 addition & 1 deletion cpp/autosar/src/codeql-suites/autosar-audit.qls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- description: AUTOSAR C++14 Guidelines 19-11 (Audit)
- description: AUTOSAR C++14 Guidelines 20-11 (Audit)
- qlpack: autosar-cpp-coding-standards
- include:
kind:
Expand Down
2 changes: 1 addition & 1 deletion cpp/autosar/src/codeql-suites/autosar-default.qls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- description: AUTOSAR C++14 Guidelines 19-11 (Default)
- description: AUTOSAR C++14 Guidelines 20-11 (Default)
- qlpack: autosar-cpp-coding-standards
- include:
kind:
Expand Down
2 changes: 1 addition & 1 deletion cpp/autosar/src/codeql-suites/autosar-required.qls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- description: AUTOSAR C++14 Guidelines 19-11 (Required)
- description: AUTOSAR C++14 Guidelines 20-11 (Required)
- qlpack: autosar-cpp-coding-standards
- include:
kind:
Expand Down
12 changes: 12 additions & 0 deletions cpp/autosar/src/codeql-suites/autosar-single-translation-unit.qls
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- description: AUTOSAR C++14 Guidelines 20-11 (Single Translation Unit)
- qlpack: autosar-cpp-coding-standards
- include:
kind:
- problem
- path-problem
tags contain:
- scope/single-translation-unit
- exclude:
tags contain:
- external/autosar/audit
- external/autosar/default-disabled
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A0-4-2/TypeLongDoubleUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @tags external/autosar/id/a0-4-2
* correctness
* readability
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A11-3-1/FriendDeclarationsUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags external/autosar/id/a11-3-1
* correctness
* security
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* @tags external/autosar/id/a17-0-1
* correctness
* maintainability
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @tags external/autosar/id/a18-0-1
* correctness
* readability
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A18-0-3/LocaleFunctionsUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* @problem.severity warning
* @tags external/autosar/id/a18-0-3
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A18-0-3/LocaleMacrosUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @problem.severity warning
* @tags external/autosar/id/a18-0-3
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A18-0-3/LocaleTypeLConvUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @problem.severity warning
* @tags external/autosar/id/a18-0-3
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A18-1-1/CStyleArraysUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @problem.severity error
* @tags external/autosar/id/a18-1-1
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @problem.severity warning
* @tags external/autosar/id/a18-1-2
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A18-1-3/AutoPtrTypeUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @problem.severity warning
* @tags external/autosar/id/a18-1-3
* maintainability
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @problem.severity error
* @tags external/autosar/id/a18-5-1
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A18-9-1/BindUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @problem.severity error
* @tags external/autosar/id/a18-9-1
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A2-11-1/VolatileKeywordUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @problem.severity error
* @tags external/autosar/id/a2-11-1
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/design
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A2-13-3/TypeWcharTUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags external/autosar/id/a2-13-3
* correctness
* readability
* scope/single-translation-unit
* external/autosar/allocated-target/architecture
* external/autosar/allocated-target/design
* external/autosar/allocated-target/implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @problem.severity error
* @tags external/autosar/id/a26-5-1
* security
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @problem.severity error
* @tags external/autosar/id/a5-16-1
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A5-2-1/DynamicCastShouldNotBeUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @problem.severity error
* @tags external/autosar/id/a5-2-1
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/advisory
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A5-2-2/TraditionalCStyleCastsUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @problem.severity error
* @tags external/autosar/id/a5-2-2
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A5-2-4/ReinterpretCastUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags external/autosar/id/a5-2-4
* correctness
* security
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A6-6-1/GotoStatementUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags external/autosar/id/a6-6-1
* correctness
* security
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A7-1-4/RegisterKeywordUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @problem.severity error
* @tags external/autosar/id/a7-1-4
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A7-1-6/TypedefSpecifierUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @problem.severity error
* @tags external/autosar/id/a7-1-6
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A7-4-1/AsmDeclarationUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @problem.severity error
* @tags external/autosar/id/a7-4-1
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags external/autosar/id/a8-4-1
* correctness
* security
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/A9-5-1/UnionsUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @problem.severity error
* @tags external/autosar/id/a9-5-1
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @problem.severity error
* @tags external/autosar/id/m17-0-5
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags external/autosar/id/m18-0-3
* correctness
* security
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags external/autosar/id/m18-0-4
* correctness
* security
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags external/autosar/id/m18-0-5
* security
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/M18-2-1/MacroOffsetofUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @problem.severity error
* @tags external/autosar/id/m18-2-1
* security
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/M18-7-1/CsignalFunctionsUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags external/autosar/id/m18-7-1
* maintainability
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/M18-7-1/CsignalTypesUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags external/autosar/id/m18-7-1
* maintainability
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/M19-3-1/ErrnoUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* @tags external/autosar/id/m19-3-1
* correctness
* maintainability
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/M27-0-1/CstdioFunctionsUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @tags external/autosar/id/m27-0-1
* maintainability
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/M27-0-1/CstdioMacrosUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @tags external/autosar/id/m27-0-1
* maintainability
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/M27-0-1/CstdioTypesUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @tags external/autosar/id/m27-0-1
* maintainability
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/M5-18-1/CommaOperatorUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @problem.severity error
* @tags external/autosar/id/m5-18-1
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
1 change: 1 addition & 0 deletions cpp/autosar/src/rules/M7-3-4/UsingDirectivesUsed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @problem.severity error
* @tags external/autosar/id/m7-3-4
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @problem.severity error
* @tags external/autosar/id/m7-3-6
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags external/autosar/id/m7-4-1
* readability
* maintainability
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/audit
* external/autosar/enforcement/non-automated
Expand Down
11 changes: 11 additions & 0 deletions cpp/cert/src/codeql-suites/cert-single-translation-unit.qls
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- description: CERT C++ 2016 (Single Translation Unit)
- qlpack: cert-cpp-coding-standards
- include:
kind:
- problem
- path-problem
tags contain:
- scope/single-translation-unit
- exclude:
tags contain:
- external/cert/default-disabled
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags external/cert/id/dcl50-cpp
* correctness
* security
* scope/single-translation-unit
* external/cert/obligation/rule
*/

Expand Down
Loading