Skip to content

Upgrade github/codeql dependency to 2.10.5 #226

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
merged 21 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

2 changes: 1 addition & 1 deletion c/cert/src/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
2 changes: 1 addition & 1 deletion c/cert/src/qlpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ suites: codeql-suites
license: MIT
dependencies:
codeql/common-c-coding-standards: '*'
codeql/cpp-all: 0.2.3
codeql/cpp-all: 0.3.5
2 changes: 1 addition & 1 deletion c/cert/test/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
2 changes: 1 addition & 1 deletion c/common/src/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
2 changes: 1 addition & 1 deletion c/common/src/qlpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ version: 2.15.0-dev
license: MIT
dependencies:
codeql/common-cpp-coding-standards: '*'
codeql/cpp-all: 0.2.3
codeql/cpp-all: 0.3.5
2 changes: 1 addition & 1 deletion c/common/test/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
2 changes: 1 addition & 1 deletion c/misra/src/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
2 changes: 1 addition & 1 deletion c/misra/src/qlpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ suites: codeql-suites
license: MIT
dependencies:
codeql/common-c-coding-standards: '*'
codeql/cpp-all: 0.2.3
codeql/cpp-all: 0.3.5
16 changes: 5 additions & 11 deletions c/misra/src/rules/RULE-8-4/CompatibleDeclarationObjectDefined.ql
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,10 @@ where
not isExcluded(decl1, Declarations4Package::compatibleDeclarationObjectDefinedQuery()) and
decl1.isDefinition() and
decl1.getDeclaration() instanceof ExternalIdentifiers and
(
//no declaration matches exactly
not exists(VariableDeclarationEntry decl2 |
not decl2.isDefinition() and decl2.getDeclaration() = decl1.getDeclaration()
) and
//and none is close enough
not exists(VariableDeclarationEntry decl2 |
not decl2.isDefinition() and
decl1.getVariable().getQualifiedName() = decl2.getVariable().getQualifiedName() and
typesCompatible(decl1.getType(), decl2.getType())
)
// no declaration matches
not exists(VariableDeclarationEntry decl2 |
not decl2.isDefinition() and
decl1.getDeclaration() = decl2.getDeclaration() and
typesCompatible(decl1.getType(), decl2.getType())
)
select decl1, "No separate compatible declaration found for this definition."
2 changes: 1 addition & 1 deletion c/misra/test/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
6 changes: 3 additions & 3 deletions c/misra/test/rules/RULE-8-4/object1.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
extern int i;
i = 0; // COMPLIANT
int i = 0; // COMPLIANT

extern int i1 = 0; // NON_COMPLIANT

int i2 = 0; // NON_COMPLIANT

extern int i3; // NON_COMPLIANT
extern int i3;

extern int i4; // COMPLIANT
extern int i4;
2 changes: 1 addition & 1 deletion c/misra/test/rules/RULE-8-4/object2.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
short i3 = 0; // NON_COMPLIANT

signed int i4 = 0; // COMPLIANT
signed int i4 = 0; // COMPLIANT
Empty file removed c/misra/test/rules/RULE-8-4/test.c
Empty file.
3 changes: 3 additions & 0 deletions change_notes/2022-03-08-update-to-CodeQL-2.10.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- `RULE-8-4` - `CompatibleDeclarationObjectDefined.ql`
- Update rule implementation based on changes in the CodeQL libraries.
- Updated the CodeQL version to `2.10.5`.
6 changes: 6 additions & 0 deletions change_notes/2022-06-28-detect-static-namespace-members.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- `A2-10-4` - `IdentifierNameOfStaticFunctionReusedInNamespace.ql`:
- Reuse of an identifier name of a static function in a namespace is now detected.
- `A2-10-4` - `IdentifierNameOfStaticNonMemberObjectReusedInNamespace.ql`:
- Reuse of an identifier name of a static non-member object in a namespace is now detected.
- `A2-10-5` - `IdentifierNameOfStaticNonMemberObjectWithExternalOrInternalLinkageIsReused.ql`:
- Reuse of an identifier name of a static non-member object with internal linkage in a namespace is now detected.
1 change: 0 additions & 1 deletion codeql_modules/codeql
Submodule codeql deleted from 28fe7a
2 changes: 1 addition & 1 deletion cpp/autosar/src/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
2 changes: 1 addition & 1 deletion cpp/autosar/src/qlpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ suites: codeql-suites
license: MIT
dependencies:
codeql/common-cpp-coding-standards: '*'
codeql/cpp-all: 0.2.3
codeql/cpp-all: 0.3.5
2 changes: 1 addition & 1 deletion cpp/autosar/test/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
| test1a.cpp:13:13:13:14 | f1 | Static function $@ reuses identifier of $@ | test1a.cpp:13:13:13:14 | f1 | f1 | test1b.cpp:6:13:6:14 | f1 | f1 |
| test1b.cpp:6:13:6:14 | f1 | Static function $@ reuses identifier of $@ | test1b.cpp:6:13:6:14 | f1 | f1 | test1a.cpp:13:13:13:14 | f1 | f1 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
| test1a.cpp:2:12:2:13 | v1 | Non-member static object $@ reuses identifier name of non-member static object $@ | test1a.cpp:2:12:2:13 | v1 | v1 | test1b.cpp:2:12:2:13 | v1 | v1 |
| test1b.cpp:2:12:2:13 | v1 | Non-member static object $@ reuses identifier name of non-member static object $@ | test1b.cpp:2:12:2:13 | v1 | v1 | test1a.cpp:2:12:2:13 | v1 | v1 |
5 changes: 2 additions & 3 deletions cpp/autosar/test/rules/A2-10-4/test1b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ static int v1 = 3; // NON_COMPLIANT
} // namespace ns1

namespace ns3 {
static void f1() {} // NON_COMPLIANT - Not accepted by Clang linker and
// therefore not alerted upon.
static void f1() {} // NON_COMPLIANT - Not accepted by Clang linker
void f2() {} // COMPLIANT - Not accepted by Clang linker
} // namespace ns3
} // namespace ns3
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
| test1a.cpp:6:12:6:13 | g3 | Identifier name of non-member object $@ reuses the identifier name of non-member object $@. | test1a.cpp:6:12:6:13 | g3 | g3 | test1b.cpp:7:12:7:13 | g3 | g3 |
| test1a.cpp:17:43:17:43 | number_two | Identifier name of non-member object $@ reuses the identifier name of non-member object $@. | test1a.cpp:17:43:17:43 | number_two | number_two | test1b.cpp:12:43:12:43 | number_two | number_two |
| test1b.cpp:7:12:7:13 | g3 | Identifier name of non-member object $@ reuses the identifier name of non-member object $@. | test1b.cpp:7:12:7:13 | g3 | g3 | test1a.cpp:6:12:6:13 | g3 | g3 |
| test1b.cpp:12:43:12:43 | number_two | Identifier name of non-member object $@ reuses the identifier name of non-member object $@. | test1b.cpp:12:43:12:43 | number_two | number_two | test1a.cpp:17:43:17:43 | number_two | number_two |
| test1a.cpp:2:12:2:13 | g1 | Identifier name of non-member object $@ reuses the identifier name of non-member object $@. | test1a.cpp:2:12:2:13 | g1 | g1 | test1b.cpp:2:12:2:13 | g1 | g1 |
| test1a.cpp:6:12:6:13 | g3 | Identifier name of non-member object $@ reuses the identifier name of non-member object $@. | test1a.cpp:6:12:6:13 | g3 | g3 | test1b.cpp:6:12:6:13 | g3 | g3 |
| test1a.cpp:17:43:17:43 | number_two | Identifier name of non-member object $@ reuses the identifier name of non-member object $@. | test1a.cpp:17:43:17:43 | number_two | number_two | test1b.cpp:11:43:11:43 | number_two | number_two |
| test1b.cpp:2:12:2:13 | g1 | Identifier name of non-member object $@ reuses the identifier name of non-member object $@. | test1b.cpp:2:12:2:13 | g1 | g1 | test1a.cpp:2:12:2:13 | g1 | g1 |
| test1b.cpp:6:12:6:13 | g3 | Identifier name of non-member object $@ reuses the identifier name of non-member object $@. | test1b.cpp:6:12:6:13 | g3 | g3 | test1a.cpp:6:12:6:13 | g3 | g3 |
| test1b.cpp:11:43:11:43 | number_two | Identifier name of non-member object $@ reuses the identifier name of non-member object $@. | test1b.cpp:11:43:11:43 | number_two | number_two | test1a.cpp:17:43:17:43 | number_two | number_two |
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
| test1a.cpp:7:13:7:14 | f1 | Identifier name of static function $@ reuses identifier name of static function $@ | test1a.cpp:7:13:7:14 | f1 | f1 | test1b.cpp:10:13:10:14 | f1 | f1 |
| test1b.cpp:10:13:10:14 | f1 | Identifier name of static function $@ reuses identifier name of static function $@ | test1b.cpp:10:13:10:14 | f1 | f1 | test1a.cpp:7:13:7:14 | f1 | f1 |
| test1a.cpp:7:13:7:14 | f1 | Identifier name of static function $@ reuses identifier name of static function $@ | test1a.cpp:7:13:7:14 | f1 | f1 | test1b.cpp:9:13:9:14 | f1 | f1 |
| test1b.cpp:9:13:9:14 | f1 | Identifier name of static function $@ reuses identifier name of static function $@ | test1b.cpp:9:13:9:14 | f1 | f1 | test1a.cpp:7:13:7:14 | f1 | f1 |
2 changes: 1 addition & 1 deletion cpp/autosar/test/rules/A2-10-5/test1a.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
namespace n1 {
static int g1 = 0;
static int g1 = 0; // NON_COMPLIANT
}

static int g2; // COMPLIANT
Expand Down
3 changes: 1 addition & 2 deletions cpp/autosar/test/rules/A2-10-5/test1b.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
namespace n1 {
static int g1 = 1; // NON_COMPLIANT[FALSE_NEGATIVE], considered the same as
// n1::g1 in test1a.cpp.
static int g1 = 1; // NON_COMPLIANT
}

namespace n2 {
Expand Down
2 changes: 1 addition & 1 deletion cpp/cert/src/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
2 changes: 1 addition & 1 deletion cpp/cert/src/qlpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ description: CERT C++ 2016
suites: codeql-suites
license: MIT
dependencies:
codeql/cpp-all: 0.2.3
codeql/cpp-all: 0.3.5
codeql/common-cpp-coding-standards: '*'
2 changes: 1 addition & 1 deletion cpp/cert/test/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
2 changes: 1 addition & 1 deletion cpp/common/src/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
6 changes: 3 additions & 3 deletions cpp/common/src/codingstandards/cpp/Config.qll
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ import codingstandards.cpp.exclusions.RuleMetadata
import codingstandards.cpp.deviations.Deviations

/** A `coding-standards.xml` configuration file (usually generated from an YAML configuration file). */
class CodingStandardsFile extends XMLFile {
class CodingStandardsFile extends XmlFile {
CodingStandardsFile() {
this.getBaseName() = "coding-standards.xml" and
// Must be within the users source code.
exists(this.getRelativePath())
}
}

class CodingStandardsConfigSection extends XMLElement {
class CodingStandardsConfigSection extends XmlElement {
CodingStandardsConfigSection() { getParent() instanceof CodingStandardsConfig }
}

/** A "Coding Standards" configuration file */
class CodingStandardsConfig extends XMLElement {
class CodingStandardsConfig extends XmlElement {
CodingStandardsConfig() {
any(CodingStandardsFile csf).getARootElement() = this and
this.getName() = "codingstandards"
Expand Down
10 changes: 5 additions & 5 deletions cpp/common/src/codingstandards/cpp/deviations/Deviations.qll
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ predicate applyDeviationsAtQueryLevel() {
}

/** An element which tells the analysis whether to report deviated results. */
class CodingStandardsReportDeviatedAlerts extends XMLElement {
class CodingStandardsReportDeviatedAlerts extends XmlElement {
CodingStandardsReportDeviatedAlerts() {
getParent() instanceof CodingStandardsConfig and
hasName("report-deviated-alerts")
Expand All @@ -35,7 +35,7 @@ class DeviationPermits extends CodingStandardsConfigSection {
}

/** A deviation permit record, that is specified by a permit identifier */
class DeviationPermit extends XMLElement {
class DeviationPermit extends XmlElement {
DeviationPermit() {
getParent() instanceof DeviationPermits and
hasName("deviation-permits-entry")
Expand Down Expand Up @@ -118,7 +118,7 @@ class DeviationPermit extends XMLElement {
}

/** A deviation record, that is a specified rule or query */
class DeviationRecord extends XMLElement {
class DeviationRecord extends XmlElement {
DeviationRecord() {
getParent() instanceof DeviationRecords and
hasName("deviations-entry")
Expand All @@ -134,13 +134,13 @@ class DeviationRecord extends XMLElement {

private string getRawPermitId() { result = getAChild("permit-id").getTextValue() }

private XMLElement getRawRaisedBy() { result = getAChild("raised-by") }
private XmlElement getRawRaisedBy() { result = getAChild("raised-by") }

private string getRawRaisedByName() { result = getRawRaisedBy().getAChild("name").getTextValue() }

private string getRawRaisedByDate() { result = getRawRaisedBy().getAChild("date").getTextValue() }

private XMLElement getRawApprovedBy() { result = getAChild("approved-by") }
private XmlElement getRawApprovedBy() { result = getAChild("approved-by") }

private string getRawApprovedByName() {
result = getRawApprovedBy().getAChild("name").getTextValue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GuidelineRecategorizations extends CodingStandardsConfigSection {
GuidelineRecategorizations() { hasName("guideline-recategorizations") }
}

class GuidelineRecategorization extends XMLElement {
class GuidelineRecategorization extends XmlElement {
GuidelineRecategorization() {
getParent() instanceof GuidelineRecategorizations and
hasName("guideline-recategorizations-entry")
Expand Down
2 changes: 1 addition & 1 deletion cpp/common/src/qlpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ name: codeql/common-cpp-coding-standards
version: 2.15.0-dev
license: MIT
dependencies:
codeql/cpp-all: 0.2.3
codeql/cpp-all: 0.3.5
2 changes: 1 addition & 1 deletion cpp/common/test/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
2 changes: 1 addition & 1 deletion cpp/misra/src/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
2 changes: 1 addition & 1 deletion cpp/misra/src/qlpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ suites: codeql-suites
license: MIT
dependencies:
codeql/common-cpp-coding-standards: '*'
codeql/cpp-all: 0.2.3
codeql/cpp-all: 0.3.5
2 changes: 1 addition & 1 deletion cpp/misra/test/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
2 changes: 1 addition & 1 deletion cpp/report/src/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
2 changes: 1 addition & 1 deletion cpp/report/src/qlpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ name: codeql/report-cpp-coding-standards
version: 2.15.0-dev
license: MIT
dependencies:
codeql/cpp-all: 0.2.3
codeql/cpp-all: 0.3.5
2 changes: 1 addition & 1 deletion scripts/generate_modules/queries/codeql-pack.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
dependencies:
codeql/cpp-all:
version: 0.2.3
version: 0.3.5
compiled: false
lockVersion: 1.0.0
2 changes: 1 addition & 1 deletion scripts/generate_modules/queries/qlpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ name: codeql/standard-library-extraction-cpp-coding-standards
version: 0.0.0
license: MIT
dependencies:
codeql/cpp-all: 0.2.3
codeql/cpp-all: 0.3.5
8 changes: 4 additions & 4 deletions supported_codeql_configs.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"supported_environment": [
{
"codeql_cli": "2.9.4",
"codeql_standard_library": "codeql-cli/v2.9.4",
"codeql_cli_bundle": "codeql-bundle-20220615"
"codeql_cli": "2.10.5",
"codeql_standard_library": "codeql-cli/v2.10.5",
"codeql_cli_bundle": "codeql-bundle-20220908"
}
],
"supported_language" : [
Expand All @@ -14,4 +14,4 @@
"language" : "c"
}
]
}
}