Skip to content

Commit 669fee3

Browse files
authored
Merge branch 'main' into knewbury01/Preprocessor6
2 parents 9af039a + 28bf545 commit 669fee3

File tree

52 files changed

+200
-71
lines changed

Some content is hidden

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

52 files changed

+200
-71
lines changed

.github/touch

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: ⚙️ Validate Rules CSV
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- "rc/**"
8+
- next
9+
pull_request:
10+
branches:
11+
- main
12+
- "rc/**"
13+
- next
14+
15+
16+
jobs:
17+
validate-rules-csv:
18+
name: Validate Rules CSV
19+
runs-on: ubuntu-22.04
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
24+
- name: Check Rules
25+
shell: pwsh
26+
run: scripts/util/Get-DuplicateRules.ps1 -Language 'all' -CIMode
27+
28+

.vscode/tasks.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
"type": "pickString",
186186
"options": [
187187
"Allocations",
188+
"Banned",
188189
"BannedFunctions",
189190
"BannedLibraries",
190191
"BannedSyntax",

c/cert/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: cert-c-coding-standards
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
suites: codeql-suites
44
libraryPathDependencies: common-c-coding-standards

c/cert/test/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: cert-c-coding-standards-tests
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
libraryPathDependencies: cert-c-coding-standards
44
extractor: cpp

c/common/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
name: common-c-coding-standards
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
libraryPathDependencies: common-cpp-coding-standards

c/common/test/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: common-c-coding-standards-tests
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
libraryPathDependencies: common-c-coding-standards
44
extractor: cpp

c/common/test/rules/constlikereturnvalue/ConstLikeReturnValue.expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
problems
2-
| test.c:8:8:8:12 | c_str | The object returned by the function getenv should not be modified. | test.c:15:16:15:21 | call to getenv | call to getenv | test.c:8:8:8:12 | c_str | c_str |
3-
| test.c:64:5:64:9 | conv4 | The object returned by the function localeconv should not be modified. | test.c:61:11:61:20 | call to localeconv | call to localeconv | test.c:64:5:64:9 | conv4 | conv4 |
4-
| test.c:73:5:73:8 | conv | The object returned by the function localeconv should not be modified. | test.c:69:25:69:34 | call to localeconv | call to localeconv | test.c:73:5:73:8 | conv | conv |
2+
| test.c:8:8:8:12 | c_str | test.c:15:16:15:21 | call to getenv | test.c:8:8:8:12 | c_str | The object returned by the function getenv should not be modified. |
3+
| test.c:64:5:64:9 | conv4 | test.c:61:11:61:20 | call to localeconv | test.c:64:5:64:9 | conv4 | The object returned by the function localeconv should not be modified. |
4+
| test.c:73:5:73:8 | conv | test.c:69:25:69:34 | call to localeconv | test.c:73:5:73:8 | conv | The object returned by the function localeconv should not be modified. |
55
edges
66
| test.c:5:18:5:22 | c_str | test.c:8:8:8:12 | c_str |
77
| test.c:15:16:15:21 | call to getenv | test.c:21:9:21:12 | env1 |

c/misra/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: misra-c-coding-standards
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
suites: codeql-suites
44
libraryPathDependencies: common-c-coding-standards

c/misra/src/rules/RULE-4-10/PrecautionIncludeGuardsNotProvided.ql renamed to c/misra/src/rules/DIR-4-10/PrecautionIncludeGuardsNotProvided.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* @id c/misra/precaution-include-guards-not-provided
3-
* @name RULE-4-10: Precautions shall be taken in order to prevent the contents of a header file being included more than once
3+
* @name DIR-4-10: Precautions shall be taken in order to prevent the contents of a header file being included more than once
44
* @description Using anything other than a standard include guard form can make code confusing and
55
* can lead to multiple or conflicting definitions.
66
* @kind problem
77
* @precision very-high
88
* @problem.severity warning
9-
* @tags external/misra/id/rule-4-10
9+
* @tags external/misra/id/dir-4-10
1010
* correctness
1111
* maintainability
1212
* readability

c/misra/src/rules/RULE-4-12/StdLibDynamicMemoryAllocationUsed.ql renamed to c/misra/src/rules/DIR-4-12/StdLibDynamicMemoryAllocationUsed.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/**
22
* @id c/misra/std-lib-dynamic-memory-allocation-used
3-
* @name RULE-4-12: Dynamic memory allocation shall not be used
3+
* @name DIR-4-12: Dynamic memory allocation shall not be used
44
* @description Using dynamic memory allocation and deallocation can result to undefined behavior.
55
* This query is for the Standard Library Implementation. Any implementation outside it
66
* will require a separate query under the same directive.
77
* @kind problem
88
* @precision very-high
99
* @problem.severity error
10-
* @tags external/misra/id/rule-4-12
10+
* @tags external/misra/id/dir-4-12
1111
* security
1212
* correctness
1313
* maintainability

c/misra/src/rules/RULE-4-4/SectionsOfCodeShallNotBeCommentedOut.ql renamed to c/misra/src/rules/DIR-4-4/SectionsOfCodeShallNotBeCommentedOut.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
22
* @id c/misra/sections-of-code-shall-not-be-commented-out
3-
* @name RULE-4-4: Sections of code should not be commented out
3+
* @name DIR-4-4: Sections of code should not be commented out
44
* @description Commented out code may become out of date leading to developer confusion.
55
* @kind problem
66
* @precision high
77
* @problem.severity warning
8-
* @tags external/misra/id/rule-4-4
8+
* @tags external/misra/id/dir-4-4
99
* maintainability
1010
* readability
1111
* correctness

c/misra/src/rules/RULE-4-8/ObjectWithNoPointerDereferenceShouldBeOpaque.ql renamed to c/misra/src/rules/DIR-4-8/ObjectWithNoPointerDereferenceShouldBeOpaque.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/**
22
* @id c/misra/object-with-no-pointer-dereference-should-be-opaque
3-
* @name RULE-4-8: The implementation of an object shall be hidden if a pointer to its structure or union is never dereferenced within a translation unit
3+
* @name DIR-4-8: The implementation of an object shall be hidden if a pointer to its structure or union is never dereferenced within a translation unit
44
* @description If a pointer to a structure or union is never dereferenced within a translation
55
* unit, then the implementation of the object should be hidden to prevent
66
* unintentional changes.
77
* @kind problem
88
* @precision very-high
99
* @problem.severity error
10-
* @tags external/misra/id/rule-4-8
10+
* @tags external/misra/id/dir-4-8
1111
* readability
1212
* maintainability
1313
* external/misra/obligation/advisory

c/misra/test/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: misra-c-coding-standards-tests
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
libraryPathDependencies: misra-c-coding-standards
44
extractor: cpp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rules/DIR-4-12/StdLibDynamicMemoryAllocationUsed.ql
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rules/DIR-4-8/ObjectWithNoPointerDereferenceShouldBeOpaque.ql

c/misra/test/rules/RULE-4-10/NonUniqueIncludeGuards.testref

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

c/misra/test/rules/RULE-4-12/StdLibDynamicMemoryAllocationUsed.qlref

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

c/misra/test/rules/RULE-4-8/ObjectWithNoPointerDereferenceShouldBeOpaque.qlref

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

cpp/autosar/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: autosar-cpp-coding-standards
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
suites: codeql-suites
44
libraryPathDependencies: common-cpp-coding-standards

cpp/autosar/test/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: autosar-cpp-coding-standards-tests
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
libraryPathDependencies: autosar-cpp-coding-standards
44
extractor: cpp

cpp/cert/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: cert-cpp-coding-standards
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
suites: codeql-suites
44
libraryPathDependencies: common-cpp-coding-standards

cpp/cert/test/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: cert-cpp-coding-standards-tests
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
libraryPathDependencies: cert-cpp-coding-standards
44
extractor: cpp

cpp/common/src/codingstandards/cpp/exclusions/c/Banned.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ predicate isBannedQueryMetadata(Query query, string queryId, string ruleId) {
159159
queryId =
160160
// `@id` for the `stdLibDynamicMemoryAllocationUsed` query
161161
"c/misra/std-lib-dynamic-memory-allocation-used" and
162-
ruleId = "RULE-4-12"
162+
ruleId = "DIR-4-12"
163163
or
164164
query =
165165
// `Query` instance for the `octalConstantsUsed` query

cpp/common/src/codingstandards/cpp/exclusions/c/Pointers1.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ predicate isPointers1QueryMetadata(Query query, string queryId, string ruleId) {
149149
queryId =
150150
// `@id` for the `objectWithNoPointerDereferenceShouldBeOpaque` query
151151
"c/misra/object-with-no-pointer-dereference-should-be-opaque" and
152-
ruleId = "RULE-4-8"
152+
ruleId = "DIR-4-8"
153153
or
154154
query =
155155
// `Query` instance for the `pointerShouldPointToConstTypeWhenPossible` query

cpp/common/src/codingstandards/cpp/exclusions/c/Preprocessor2.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ predicate isPreprocessor2QueryMetadata(Query query, string queryId, string ruleI
4040
queryId =
4141
// `@id` for the `precautionIncludeGuardsNotProvided` query
4242
"c/misra/precaution-include-guards-not-provided" and
43-
ruleId = "RULE-4-10"
43+
ruleId = "DIR-4-10"
4444
}
4545

4646
module Preprocessor2Package {

cpp/common/src/codingstandards/cpp/exclusions/c/Syntax.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ predicate isSyntaxQueryMetadata(Query query, string queryId, string ruleId) {
4343
queryId =
4444
// `@id` for the `sectionsOfCodeShallNotBeCommentedOut` query
4545
"c/misra/sections-of-code-shall-not-be-commented-out" and
46-
ruleId = "RULE-4-4"
46+
ruleId = "DIR-4-4"
4747
or
4848
query =
4949
// `Query` instance for the `identifiersInTheSameNameSpaceUnambiguous` query

cpp/common/src/codingstandards/cpp/rules/constlikereturnvalue/ConstLikeReturnValue.qll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,13 @@ class DFConf extends DataFlow::Configuration {
5252
}
5353

5454
query predicate problems(
55-
Element e, string message, DataFlow::PathNode source, string sourcetext, DataFlow::PathNode sink,
56-
string sinktext
55+
Element e, DataFlow::PathNode source, DataFlow::PathNode sink, string message
5756
) {
5857
not isExcluded(e, getQuery()) and
5958
// the modified object comes from a call to one of the ENV functions
6059
any(DFConf d).hasFlowPath(source, sink) and
6160
e = sink.getNode().asExpr() and
6261
message =
6362
"The object returned by the function " +
64-
source.getNode().asExpr().(FunctionCall).getTarget().getName() + " should not be modified." and
65-
sourcetext = source.toString() and
66-
sinktext = sink.toString()
63+
source.getNode().asExpr().(FunctionCall).getTarget().getName() + " should not be modified."
6764
}

cpp/common/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
name: common-cpp-coding-standards
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
libraryPathDependencies: codeql-cpp

cpp/common/test/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: common-cpp-coding-standards-tests
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
libraryPathDependencies: common-cpp-coding-standards
44
extractor: cpp

cpp/misra/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
name: misra-cpp-coding-standards
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
libraryPathDependencies: common-cpp-coding-standards

cpp/misra/test/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: misra-cpp-coding-standards-tests
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
libraryPathDependencies: misra-cpp-coding-standards
44
extractor: cpp

cpp/report/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
name: report-cpp-coding-standards
2-
version: 2.11.0-dev
2+
version: 2.12.0-dev
33
libraryPathDependencies: codeql-cpp

docs/development_handbook.md

Lines changed: 2 additions & 1 deletion

docs/user_manual.md

Lines changed: 31 additions & 12 deletions

0 commit comments

Comments
 (0)