Skip to content

Add code quality suite selector and use that in the code quality suites #19413

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 8 commits into from
May 2, 2025
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
4 changes: 3 additions & 1 deletion actions/ql/src/codeql-suites/actions-code-quality.qls
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
[]
- queries: .
- apply: code-quality-selectors.yml
from: codeql/suite-helpers
4 changes: 3 additions & 1 deletion cpp/ql/src/codeql-suites/cpp-code-quality.qls
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
[]
- queries: .
- apply: code-quality-selectors.yml
from: codeql/suite-helpers
1 change: 1 addition & 0 deletions csharp/ql/src/API Abuse/FormatInvalid.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @id cs/invalid-string-formatting
* @tags reliability
* maintainability
* quality
*/

import csharp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @id cs/local-not-disposed
* @tags efficiency
* maintainability
* quality
* external/cwe/cwe-404
* external/cwe/cwe-459
* external/cwe/cwe-460
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @id cs/constant-condition
* @tags maintainability
* readability
* quality
* external/cwe/cwe-835
*/

Expand Down
1 change: 1 addition & 0 deletions csharp/ql/src/Dead Code/DeadStoreOfLocal.ql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @problem.severity warning
* @id cs/useless-assignment-to-local
* @tags maintainability
* quality
* external/cwe/cwe-563
* @precision very-high
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @tags reliability
* correctness
* logic
* quality
* external/cwe/cwe-193
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags reliability
* correctness
* logic
* quality
*/

import csharp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @tags reliability
* correctness
* logic
* quality
* external/cwe/cwe-480
* external/cwe/cwe-691
*/
Expand Down
1 change: 1 addition & 0 deletions csharp/ql/src/Likely Bugs/EqualityCheckOnFloats.ql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @id cs/equality-on-floats
* @tags reliability
* correctness
* quality
*/

import csharp
Expand Down
1 change: 1 addition & 0 deletions csharp/ql/src/Likely Bugs/ReferenceEqualsOnValueTypes.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @id cs/reference-equality-on-valuetypes
* @tags reliability
* correctness
* quality
* external/cwe/cwe-595
*/

Expand Down
1 change: 1 addition & 0 deletions csharp/ql/src/Likely Bugs/SelfAssignment.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags reliability
* correctness
* logic
* quality
*/

import csharp
Expand Down
1 change: 1 addition & 0 deletions csharp/ql/src/Likely Bugs/UncheckedCastInEquals.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @id cs/unchecked-cast-in-equals
* @tags reliability
* maintainability
* quality
*/

import csharp
Expand Down
4 changes: 3 additions & 1 deletion csharp/ql/src/Performance/UseTryGetValue.ql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
* @problem.severity recommendation
* @precision high
* @id cs/inefficient-containskey
* @tags maintainability efficiency
* @tags maintainability
* efficiency
* quality
*/

import csharp
Expand Down
1 change: 1 addition & 0 deletions csharp/ql/src/Useless code/DefaultToString.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @id cs/call-to-object-tostring
* @tags reliability
* maintainability
* quality
*/

import DefaultToStringQuery
1 change: 1 addition & 0 deletions csharp/ql/src/Useless code/IntGetHashCode.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @id cs/useless-gethashcode-call
* @tags readability
* useless-code
* quality
*/

import csharp
Expand Down
18 changes: 2 additions & 16 deletions csharp/ql/src/codeql-suites/csharp-code-quality.qls
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
- queries: .
- include:
id:
- cs/index-out-of-bounds
- cs/test-for-negative-container-size
- cs/unchecked-cast-in-equals
- cs/reference-equality-on-valuetypes
- cs/self-assignment
- cs/inefficient-containskey
- cs/call-to-object-tostring
- cs/local-not-disposed
- cs/constant-condition
- cs/useless-gethashcode-call
- cs/non-short-circuit
- cs/useless-assignment-to-local
- cs/invalid-string-formatting
- cs/equality-on-floats
- apply: code-quality-selectors.yml
from: codeql/suite-helpers
1 change: 1 addition & 0 deletions go/ql/src/InconsistentCode/LengthComparisonOffByOne.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags reliability
* correctness
* logic
* quality
* external/cwe/cwe-193
* @precision high
*/
Expand Down
1 change: 1 addition & 0 deletions go/ql/src/InconsistentCode/MissingErrorCheck.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @tags reliability
* correctness
* logic
* quality
* @precision high
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* correctness
* call
* defer
* quality
*/

import go
Expand Down
1 change: 1 addition & 0 deletions go/ql/src/InconsistentCode/WrappedErrorAlwaysNil.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @tags reliability
* correctness
* logic
* quality
* @precision high
*/

Expand Down
1 change: 1 addition & 0 deletions go/ql/src/RedundantCode/NegativeLengthCheck.ql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @precision very-high
* @id go/negative-length-check
* @tags correctness
* quality
*/

import go
Expand Down
1 change: 1 addition & 0 deletions go/ql/src/RedundantCode/RedundantRecover.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @id go/redundant-recover
* @tags maintainability
* correctness
* quality
* @precision high
*/

Expand Down
10 changes: 2 additions & 8 deletions go/ql/src/codeql-suites/go-code-quality.qls
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
- queries: .
- include:
id:
- go/unhandled-writable-file-close
- go/unexpected-nil-value
- go/negative-length-check
- go/redundant-recover
- go/missing-error-check
- go/index-out-of-bounds
- apply: code-quality-selectors.yml
from: codeql/suite-helpers
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
ql/java/ql/src/Language Abuse/TypeVariableHidesType.ql
ql/java/ql/src/Likely Bugs/Arithmetic/IntMultToLong.ql
ql/java/ql/src/Likely Bugs/Collections/WriteOnlyContainer.ql
ql/java/ql/src/Likely Bugs/Comparison/IncomparableEquals.ql
Expand Down
1 change: 1 addition & 0 deletions java/ql/src/Language Abuse/TypeVariableHidesType.ql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @tags reliability
* readability
* types
* quality
*/

import java
Expand Down
1 change: 1 addition & 0 deletions java/ql/src/Likely Bugs/Arithmetic/IntMultToLong.ql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @tags reliability
* correctness
* types
* quality
* external/cwe/cwe-190
* external/cwe/cwe-192
* external/cwe/cwe-197
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @id java/unused-container
* @tags maintainability
* useless-code
* quality
* external/cwe/cwe-561
*/

Expand Down
1 change: 1 addition & 0 deletions java/ql/src/Likely Bugs/Comparison/IncomparableEquals.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @id java/equals-on-unrelated-types
* @tags reliability
* correctness
* quality
*/

import java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @id java/inconsistent-equals-and-hashcode
* @tags reliability
* correctness
* quality
* external/cwe/cwe-581
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @id java/unchecked-cast-in-equals
* @tags reliability
* correctness
* quality
*/

import java
Expand Down
1 change: 1 addition & 0 deletions java/ql/src/Likely Bugs/Comparison/RefEqBoxed.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @id java/reference-equality-of-boxed-types
* @tags reliability
* correctness
* quality
* external/cwe/cwe-595
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @id java/contradictory-type-checks
* @tags correctness
* logic
* quality
*/

import java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @precision high
* @id java/suspicious-date-format
* @tags correctness
* quality
*/

import java
Expand Down
1 change: 1 addition & 0 deletions java/ql/src/Likely Bugs/Resource Leaks/CloseReader.ql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @tags efficiency
* correctness
* resources
* quality
* external/cwe/cwe-404
* external/cwe/cwe-772
*/
Expand Down
1 change: 1 addition & 0 deletions java/ql/src/Likely Bugs/Resource Leaks/CloseWriter.ql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @tags efficiency
* correctness
* resources
* quality
* external/cwe/cwe-404
* external/cwe/cwe-772
*/
Expand Down
18 changes: 2 additions & 16 deletions java/ql/src/codeql-suites/java-code-quality.qls
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
- queries: .
- include:
id:
- java/contradictory-type-checks
- java/do-not-call-finalize
- java/equals-on-unrelated-types
- java/inconsistent-equals-and-hashcode
- java/input-resource-leak
- java/integer-multiplication-cast-to-long
- java/junit5-missing-nested-annotation
- java/output-resource-leak
- java/reference-equality-of-boxed-types
- java/string-replace-all-with-non-regex
- java/suspicious-date-format
- java/type-variable-hides-type
- java/unchecked-cast-in-equals
- java/unused-container
- apply: code-quality-selectors.yml
from: codeql/suite-helpers
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @precision high
* @tags correctness
* typescript
* quality
*/

import javascript
Expand Down
1 change: 1 addition & 0 deletions javascript/ql/src/Expressions/MissingAwait.ql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @problem.severity warning
* @id js/missing-await
* @tags correctness
* quality
* @precision high
*/

Expand Down
1 change: 1 addition & 0 deletions javascript/ql/src/LanguageFeatures/SpuriousArguments.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @tags maintainability
* correctness
* language-features
* quality
* external/cwe/cwe-685
* @precision very-high
*/
Expand Down
1 change: 1 addition & 0 deletions javascript/ql/src/RegExp/RegExpAlwaysMatches.ql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @id js/regex/always-matches
* @tags correctness
* regular-expressions
* quality
* @precision high
*/

Expand Down
9 changes: 2 additions & 7 deletions javascript/ql/src/codeql-suites/javascript-code-quality.qls
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
- queries: .
- include:
id:
- js/missing-await
- js/regex/always-matches
- js/superfluous-trailing-arguments
- js/useless-expression
- js/ineffective-parameter-type
- apply: code-quality-selectors.yml
from: codeql/suite-helpers
10 changes: 10 additions & 0 deletions misc/suite-helpers/code-quality-selectors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- description: Selectors for selecting the Code-Quality-relevant queries for a language
- include:
kind:
- problem
- path-problem
precision:
- high
- very-high
tags contain:
- quality
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ql/python/ql/src/Functions/NonCls.ql
ql/python/ql/src/Functions/NonSelf.ql
ql/python/ql/src/Functions/ReturnConsistentTupleSizes.ql
ql/python/ql/src/Functions/SignatureSpecialMethods.ql
ql/python/ql/src/Resources/FileNotAlwaysClosed.ql
ql/python/ql/src/Variables/LoopVariableCapture/LoopVariableCapture.ql
1 change: 1 addition & 0 deletions python/ql/src/Functions/NonCls.ql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @tags maintainability
* readability
* convention
* quality
* @problem.severity recommendation
* @sub-severity high
* @precision high
Expand Down
1 change: 1 addition & 0 deletions python/ql/src/Functions/NonSelf.ql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @tags maintainability
* readability
* convention
* quality
* @problem.severity recommendation
* @sub-severity high
* @precision very-high
Expand Down
Loading
Loading