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
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
@@ -8,6 +8,7 @@
* @id cs/invalid-string-formatting
* @tags reliability
* maintainability
* quality
*/

import csharp
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
* @id cs/constant-condition
* @tags maintainability
* readability
* quality
* external/cwe/cwe-835
*/

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

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

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

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

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

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

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

import csharp
1 change: 1 addition & 0 deletions csharp/ql/src/Useless code/DefaultToString.ql
Original file line number Diff line number Diff line change
@@ -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
@@ -8,6 +8,7 @@
* @id cs/useless-gethashcode-call
* @tags readability
* useless-code
* quality
*/

import csharp
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
@@ -8,6 +8,7 @@
* @tags reliability
* correctness
* logic
* quality
* external/cwe/cwe-193
* @precision high
*/
1 change: 1 addition & 0 deletions go/ql/src/InconsistentCode/MissingErrorCheck.ql
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
* @tags reliability
* correctness
* logic
* quality
* @precision high
*/

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

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

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

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

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
1 change: 1 addition & 0 deletions java/ql/src/Language Abuse/TypeVariableHidesType.ql
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
* @tags reliability
* readability
* types
* quality
*/

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

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

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

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

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

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

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

import java
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
@@ -9,6 +9,7 @@
* @tags efficiency
* correctness
* resources
* quality
* external/cwe/cwe-404
* external/cwe/cwe-772
*/
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
@@ -9,6 +9,7 @@
* @tags efficiency
* correctness
* resources
* quality
* external/cwe/cwe-404
* external/cwe/cwe-772
*/
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
@@ -7,6 +7,7 @@
* @precision high
* @tags correctness
* typescript
* quality
*/

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

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

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
@@ -5,6 +5,7 @@
* @tags maintainability
* readability
* convention
* quality
* @problem.severity recommendation
* @sub-severity high
* @precision high
1 change: 1 addition & 0 deletions python/ql/src/Functions/NonSelf.ql
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
* @tags maintainability
* readability
* convention
* quality
* @problem.severity recommendation
* @sub-severity high
* @precision very-high
Loading
Oops, something went wrong.
Loading
Oops, something went wrong.