Merge pull request #19763 from owen-mc/go/quality-tags

Go: Update tags for high precision quality queries
This commit is contained in:
Owen Mansel-Chan
2025-06-19 11:32:31 +01:00
committed by GitHub
25 changed files with 120 additions and 37 deletions

View File

@@ -1,6 +1,22 @@
ql/go/ql/src/InconsistentCode/ConstantLengthComparison.ql
ql/go/ql/src/InconsistentCode/InconsistentLoopOrientation.ql
ql/go/ql/src/InconsistentCode/LengthComparisonOffByOne.ql
ql/go/ql/src/InconsistentCode/MissingErrorCheck.ql
ql/go/ql/src/InconsistentCode/MistypedExponentiation.ql
ql/go/ql/src/InconsistentCode/UnhandledCloseWritableHandle.ql
ql/go/ql/src/InconsistentCode/WhitespaceContradictsPrecedence.ql
ql/go/ql/src/InconsistentCode/WrappedErrorAlwaysNil.ql
ql/go/ql/src/RedundantCode/CompareIdenticalValues.ql
ql/go/ql/src/RedundantCode/DeadStoreOfField.ql
ql/go/ql/src/RedundantCode/DeadStoreOfLocal.ql
ql/go/ql/src/RedundantCode/DuplicateBranches.ql
ql/go/ql/src/RedundantCode/DuplicateCondition.ql
ql/go/ql/src/RedundantCode/DuplicateSwitchCase.ql
ql/go/ql/src/RedundantCode/ExprHasNoEffect.ql
ql/go/ql/src/RedundantCode/ImpossibleInterfaceNilCheck.ql
ql/go/ql/src/RedundantCode/NegativeLengthCheck.ql
ql/go/ql/src/RedundantCode/RedundantExpr.ql
ql/go/ql/src/RedundantCode/RedundantRecover.ql
ql/go/ql/src/RedundantCode/SelfAssignment.ql
ql/go/ql/src/RedundantCode/ShiftOutOfRange.ql
ql/go/ql/src/RedundantCode/UnreachableStatement.ql

View File

@@ -1,6 +1,22 @@
ql/go/ql/src/InconsistentCode/ConstantLengthComparison.ql
ql/go/ql/src/InconsistentCode/InconsistentLoopOrientation.ql
ql/go/ql/src/InconsistentCode/LengthComparisonOffByOne.ql
ql/go/ql/src/InconsistentCode/MissingErrorCheck.ql
ql/go/ql/src/InconsistentCode/MistypedExponentiation.ql
ql/go/ql/src/InconsistentCode/UnhandledCloseWritableHandle.ql
ql/go/ql/src/InconsistentCode/WhitespaceContradictsPrecedence.ql
ql/go/ql/src/InconsistentCode/WrappedErrorAlwaysNil.ql
ql/go/ql/src/RedundantCode/CompareIdenticalValues.ql
ql/go/ql/src/RedundantCode/DeadStoreOfField.ql
ql/go/ql/src/RedundantCode/DeadStoreOfLocal.ql
ql/go/ql/src/RedundantCode/DuplicateBranches.ql
ql/go/ql/src/RedundantCode/DuplicateCondition.ql
ql/go/ql/src/RedundantCode/DuplicateSwitchCase.ql
ql/go/ql/src/RedundantCode/ExprHasNoEffect.ql
ql/go/ql/src/RedundantCode/ImpossibleInterfaceNilCheck.ql
ql/go/ql/src/RedundantCode/NegativeLengthCheck.ql
ql/go/ql/src/RedundantCode/RedundantExpr.ql
ql/go/ql/src/RedundantCode/RedundantRecover.ql
ql/go/ql/src/RedundantCode/SelfAssignment.ql
ql/go/ql/src/RedundantCode/ShiftOutOfRange.ql
ql/go/ql/src/RedundantCode/UnreachableStatement.ql

View File

@@ -5,7 +5,10 @@
* @kind problem
* @problem.severity warning
* @id go/constant-length-comparison
* @tags correctness
* @tags quality
* reliability
* correctness
* external/cwe/cwe-129
* @precision high
*/

View File

@@ -8,7 +8,9 @@
* @kind problem
* @problem.severity error
* @id go/inconsistent-loop-direction
* @tags correctness
* @tags quality
* reliability
* correctness
* external/cwe/cwe-835
* @precision very-high
*/

View File

@@ -5,10 +5,9 @@
* @kind problem
* @problem.severity error
* @id go/index-out-of-bounds
* @tags reliability
* @tags quality
* reliability
* correctness
* logic
* quality
* external/cwe/cwe-193
* @precision high
*/

View File

@@ -5,10 +5,10 @@
* @kind problem
* @problem.severity warning
* @id go/missing-error-check
* @tags reliability
* correctness
* logic
* quality
* @tags quality
* reliability
* error-handling
* external/cwe/cwe-252
* @precision high
*/

View File

@@ -4,7 +4,10 @@
* @kind problem
* @problem.severity warning
* @id go/mistyped-exponentiation
* @tags correctness
* @tags quality
* reliability
* correctness
* external/cwe/cwe-480
* @precision high
*/

View File

@@ -7,11 +7,10 @@
* @problem.severity warning
* @precision high
* @id go/unhandled-writable-file-close
* @tags maintainability
* correctness
* call
* defer
* quality
* @tags quality
* reliability
* error-handling
* external/cwe/cwe-252
*/
import go

View File

@@ -1,11 +1,12 @@
/**
* @name Whitespace contradicts operator precedence
* @description Nested expressions where the formatting contradicts the grouping enforced by operator precedence
* are difficult to read and may even indicate a bug.
* are difficult to read and may indicate a bug.
* @kind problem
* @problem.severity warning
* @id go/whitespace-contradicts-precedence
* @tags maintainability
* @tags quality
* reliability
* correctness
* external/cwe/cwe-783
* @precision very-high

View File

@@ -4,10 +4,9 @@
* @kind problem
* @problem.severity warning
* @id go/unexpected-nil-value
* @tags reliability
* correctness
* logic
* quality
* @tags quality
* reliability
* error-handling
* @precision high
*/

View File

@@ -5,7 +5,9 @@
* @kind problem
* @problem.severity warning
* @id go/comparison-of-identical-expressions
* @tags correctness
* @tags quality
* reliability
* correctness
* external/cwe/cwe-570
* external/cwe/cwe-571
* @precision very-high

View File

@@ -4,7 +4,9 @@
* @kind problem
* @problem.severity warning
* @id go/useless-assignment-to-field
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* external/cwe/cwe-563
* @precision very-high
*/

View File

@@ -5,7 +5,9 @@
* @kind problem
* @problem.severity warning
* @id go/useless-assignment-to-local
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* external/cwe/cwe-563
* @precision very-high
*/

View File

@@ -6,7 +6,8 @@
* @problem.severity warning
* @precision very-high
* @id go/duplicate-branches
* @tags maintainability
* @tags quality
* reliability
* correctness
* external/cwe/cwe-561
*/

View File

@@ -5,7 +5,8 @@
* @kind problem
* @problem.severity error
* @id go/duplicate-condition
* @tags maintainability
* @tags quality
* reliability
* correctness
* external/cwe/cwe-561
* @precision very-high

View File

@@ -5,7 +5,8 @@
* @kind problem
* @problem.severity error
* @id go/duplicate-switch-case
* @tags maintainability
* @tags quality
* reliability
* correctness
* external/cwe/cwe-561
* @precision very-high

View File

@@ -5,7 +5,8 @@
* @kind problem
* @problem.severity warning
* @id go/useless-expression
* @tags maintainability
* @tags quality
* reliability
* correctness
* external/cwe/cwe-480
* external/cwe/cwe-561

View File

@@ -4,7 +4,10 @@
* @kind problem
* @problem.severity warning
* @id go/impossible-interface-nil-check
* @tags correctness
* @tags quality
* reliability
* correctness
* external/cwe/cwe-570
* @precision high
*/

View File

@@ -8,8 +8,10 @@
* @problem.severity warning
* @precision very-high
* @id go/negative-length-check
* @tags correctness
* quality
* @tags quality
* reliability
* correctness
* external/cwe/cwe-571
*/
import go

View File

@@ -6,7 +6,9 @@
* @kind problem
* @problem.severity warning
* @id go/redundant-operation
* @tags correctness
* @tags quality
* reliability
* correctness
* external/cwe/cwe-480
* external/cwe/cwe-561
* @precision very-high

View File

@@ -6,9 +6,10 @@
* @kind problem
* @problem.severity warning
* @id go/redundant-recover
* @tags maintainability
* @tags quality
* reliability
* correctness
* quality
* external/cwe/cwe-248
* @precision high
*/

View File

@@ -4,7 +4,9 @@
* @kind problem
* @problem.severity warning
* @id go/redundant-assignment
* @tags correctness
* @tags quality
* reliability
* correctness
* external/cwe/cwe-480
* external/cwe/cwe-561
* @precision high

View File

@@ -6,7 +6,9 @@
* @problem.severity warning
* @id go/shift-out-of-range
* @precision very-high
* @tags correctness
* @tags quality
* reliability
* correctness
* external/cwe/cwe-197
*/

View File

@@ -5,7 +5,8 @@
* @kind problem
* @problem.severity warning
* @id go/unreachable-statement
* @tags maintainability
* @tags quality
* reliability
* correctness
* external/cwe/cwe-561
* @precision very-high

View File

@@ -0,0 +1,22 @@
---
category: queryMetadata
---
* The tag `quality` has been added to multiple Go quality queries for consistency. They have all been given a tag for one of the two top-level categories `reliability` or `maintainability`, and a tag for a sub-category. See [Query file metadata and alert message style guide](https://github.com/github/codeql/blob/main/docs/query-metadata-style-guide.md#quality-query-sub-category-tags) for more information about these categories.
* The tag `external/cwe/cwe-129` has been added to `go/constant-length-comparison`.
* The tag `external/cwe/cwe-193` has been added to `go/index-out-of-bounds`.
* The tag `external/cwe/cwe-197` has been added to `go/shift-out-of-range`.
* The tag `external/cwe/cwe-248` has been added to `go/redundant-recover`.
* The tag `external/cwe/cwe-252` has been added to `go/missing-error-check` and `go/unhandled-writable-file-close`.
* The tag `external/cwe/cwe-480` has been added to `go/mistyped-exponentiation`.
* The tag `external/cwe/cwe-570` has been added to `go/impossible-interface-nil-check` and `go/comparison-of-identical-expressions`.
* The tag `external/cwe/cwe-571` has been added to `go/negative-length-check` and `go/comparison-of-identical-expressions`.
* The tag `external/cwe/cwe-783` has been added to `go/whitespace-contradicts-precedence`.
* The tag `external/cwe/cwe-835` has been added to `go/inconsistent-loop-direction`.
* The tag `error-handling` has been added to `go/missing-error-check`, `go/unhandled-writable-file-close`, and `go/unexpected-nil-value`.
* The tag `useless-code` has been added to `go/useless-assignment-to-field`, `go/useless-assignment-to-local`, `go/useless-expression`, and `go/unreachable-statement`.
* The tag `logic` has been removed from `go/index-out-of-bounds` and `go/unexpected-nil-value`.
* The tags `call` and `defer` have been removed from `go/unhandled-writable-file-close`.
* The tags `correctness` and `quality` have been reordered in `go/missing-error-check` and `go/unhandled-writable-file-close`.
* The tag `maintainability` has been changed to `reliability` for `go/unhandled-writable-file-close`.
* The tag order has been standardized to have `quality` first, followed by the top-level category (`reliability` or `maintainability`), then sub-category tags, and finally CWE tags.
* The description text has been updated in `go/whitespace-contradicts-precedence` to change "may even indicate" to "may indicate".