Skip to content

Commit 2225a2d

Browse files
authored
Merge pull request #19763 from owen-mc/go/quality-tags
Go: Update tags for high precision quality queries
2 parents bea855a + ebd9176 commit 2225a2d

25 files changed

+120
-37
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
1+
ql/go/ql/src/InconsistentCode/ConstantLengthComparison.ql
2+
ql/go/ql/src/InconsistentCode/InconsistentLoopOrientation.ql
13
ql/go/ql/src/InconsistentCode/LengthComparisonOffByOne.ql
24
ql/go/ql/src/InconsistentCode/MissingErrorCheck.ql
5+
ql/go/ql/src/InconsistentCode/MistypedExponentiation.ql
36
ql/go/ql/src/InconsistentCode/UnhandledCloseWritableHandle.ql
7+
ql/go/ql/src/InconsistentCode/WhitespaceContradictsPrecedence.ql
48
ql/go/ql/src/InconsistentCode/WrappedErrorAlwaysNil.ql
9+
ql/go/ql/src/RedundantCode/CompareIdenticalValues.ql
10+
ql/go/ql/src/RedundantCode/DeadStoreOfField.ql
11+
ql/go/ql/src/RedundantCode/DeadStoreOfLocal.ql
12+
ql/go/ql/src/RedundantCode/DuplicateBranches.ql
13+
ql/go/ql/src/RedundantCode/DuplicateCondition.ql
14+
ql/go/ql/src/RedundantCode/DuplicateSwitchCase.ql
15+
ql/go/ql/src/RedundantCode/ExprHasNoEffect.ql
16+
ql/go/ql/src/RedundantCode/ImpossibleInterfaceNilCheck.ql
517
ql/go/ql/src/RedundantCode/NegativeLengthCheck.ql
18+
ql/go/ql/src/RedundantCode/RedundantExpr.ql
619
ql/go/ql/src/RedundantCode/RedundantRecover.ql
20+
ql/go/ql/src/RedundantCode/SelfAssignment.ql
21+
ql/go/ql/src/RedundantCode/ShiftOutOfRange.ql
22+
ql/go/ql/src/RedundantCode/UnreachableStatement.ql
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
1+
ql/go/ql/src/InconsistentCode/ConstantLengthComparison.ql
2+
ql/go/ql/src/InconsistentCode/InconsistentLoopOrientation.ql
13
ql/go/ql/src/InconsistentCode/LengthComparisonOffByOne.ql
24
ql/go/ql/src/InconsistentCode/MissingErrorCheck.ql
5+
ql/go/ql/src/InconsistentCode/MistypedExponentiation.ql
36
ql/go/ql/src/InconsistentCode/UnhandledCloseWritableHandle.ql
7+
ql/go/ql/src/InconsistentCode/WhitespaceContradictsPrecedence.ql
48
ql/go/ql/src/InconsistentCode/WrappedErrorAlwaysNil.ql
9+
ql/go/ql/src/RedundantCode/CompareIdenticalValues.ql
10+
ql/go/ql/src/RedundantCode/DeadStoreOfField.ql
11+
ql/go/ql/src/RedundantCode/DeadStoreOfLocal.ql
12+
ql/go/ql/src/RedundantCode/DuplicateBranches.ql
13+
ql/go/ql/src/RedundantCode/DuplicateCondition.ql
14+
ql/go/ql/src/RedundantCode/DuplicateSwitchCase.ql
15+
ql/go/ql/src/RedundantCode/ExprHasNoEffect.ql
16+
ql/go/ql/src/RedundantCode/ImpossibleInterfaceNilCheck.ql
517
ql/go/ql/src/RedundantCode/NegativeLengthCheck.ql
18+
ql/go/ql/src/RedundantCode/RedundantExpr.ql
619
ql/go/ql/src/RedundantCode/RedundantRecover.ql
20+
ql/go/ql/src/RedundantCode/SelfAssignment.ql
21+
ql/go/ql/src/RedundantCode/ShiftOutOfRange.ql
22+
ql/go/ql/src/RedundantCode/UnreachableStatement.ql

go/ql/src/InconsistentCode/ConstantLengthComparison.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
* @kind problem
66
* @problem.severity warning
77
* @id go/constant-length-comparison
8-
* @tags correctness
8+
* @tags quality
9+
* reliability
10+
* correctness
11+
* external/cwe/cwe-129
912
* @precision high
1013
*/
1114

go/ql/src/InconsistentCode/InconsistentLoopOrientation.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
* @kind problem
99
* @problem.severity error
1010
* @id go/inconsistent-loop-direction
11-
* @tags correctness
11+
* @tags quality
12+
* reliability
13+
* correctness
1214
* external/cwe/cwe-835
1315
* @precision very-high
1416
*/

go/ql/src/InconsistentCode/LengthComparisonOffByOne.ql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
* @kind problem
66
* @problem.severity error
77
* @id go/index-out-of-bounds
8-
* @tags reliability
8+
* @tags quality
9+
* reliability
910
* correctness
10-
* logic
11-
* quality
1211
* external/cwe/cwe-193
1312
* @precision high
1413
*/

go/ql/src/InconsistentCode/MissingErrorCheck.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
* @kind problem
66
* @problem.severity warning
77
* @id go/missing-error-check
8-
* @tags reliability
9-
* correctness
10-
* logic
11-
* quality
8+
* @tags quality
9+
* reliability
10+
* error-handling
11+
* external/cwe/cwe-252
1212
* @precision high
1313
*/
1414

go/ql/src/InconsistentCode/MistypedExponentiation.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
* @kind problem
55
* @problem.severity warning
66
* @id go/mistyped-exponentiation
7-
* @tags correctness
7+
* @tags quality
8+
* reliability
9+
* correctness
10+
* external/cwe/cwe-480
811
* @precision high
912
*/
1013

go/ql/src/InconsistentCode/UnhandledCloseWritableHandle.ql

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
* @problem.severity warning
88
* @precision high
99
* @id go/unhandled-writable-file-close
10-
* @tags maintainability
11-
* correctness
12-
* call
13-
* defer
14-
* quality
10+
* @tags quality
11+
* reliability
12+
* error-handling
13+
* external/cwe/cwe-252
1514
*/
1615

1716
import go

go/ql/src/InconsistentCode/WhitespaceContradictsPrecedence.ql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/**
22
* @name Whitespace contradicts operator precedence
33
* @description Nested expressions where the formatting contradicts the grouping enforced by operator precedence
4-
* are difficult to read and may even indicate a bug.
4+
* are difficult to read and may indicate a bug.
55
* @kind problem
66
* @problem.severity warning
77
* @id go/whitespace-contradicts-precedence
8-
* @tags maintainability
8+
* @tags quality
9+
* reliability
910
* correctness
1011
* external/cwe/cwe-783
1112
* @precision very-high

go/ql/src/InconsistentCode/WrappedErrorAlwaysNil.ql

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
* @kind problem
55
* @problem.severity warning
66
* @id go/unexpected-nil-value
7-
* @tags reliability
8-
* correctness
9-
* logic
10-
* quality
7+
* @tags quality
8+
* reliability
9+
* error-handling
1110
* @precision high
1211
*/
1312

go/ql/src/RedundantCode/CompareIdenticalValues.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
* @kind problem
66
* @problem.severity warning
77
* @id go/comparison-of-identical-expressions
8-
* @tags correctness
8+
* @tags quality
9+
* reliability
10+
* correctness
911
* external/cwe/cwe-570
1012
* external/cwe/cwe-571
1113
* @precision very-high

go/ql/src/RedundantCode/DeadStoreOfField.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
* @kind problem
55
* @problem.severity warning
66
* @id go/useless-assignment-to-field
7-
* @tags maintainability
7+
* @tags quality
8+
* maintainability
9+
* useless-code
810
* external/cwe/cwe-563
911
* @precision very-high
1012
*/

go/ql/src/RedundantCode/DeadStoreOfLocal.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
* @kind problem
66
* @problem.severity warning
77
* @id go/useless-assignment-to-local
8-
* @tags maintainability
8+
* @tags quality
9+
* maintainability
10+
* useless-code
911
* external/cwe/cwe-563
1012
* @precision very-high
1113
*/

go/ql/src/RedundantCode/DuplicateBranches.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
* @problem.severity warning
77
* @precision very-high
88
* @id go/duplicate-branches
9-
* @tags maintainability
9+
* @tags quality
10+
* reliability
1011
* correctness
1112
* external/cwe/cwe-561
1213
*/

go/ql/src/RedundantCode/DuplicateCondition.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
* @kind problem
66
* @problem.severity error
77
* @id go/duplicate-condition
8-
* @tags maintainability
8+
* @tags quality
9+
* reliability
910
* correctness
1011
* external/cwe/cwe-561
1112
* @precision very-high

go/ql/src/RedundantCode/DuplicateSwitchCase.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
* @kind problem
66
* @problem.severity error
77
* @id go/duplicate-switch-case
8-
* @tags maintainability
8+
* @tags quality
9+
* reliability
910
* correctness
1011
* external/cwe/cwe-561
1112
* @precision very-high

go/ql/src/RedundantCode/ExprHasNoEffect.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
* @kind problem
66
* @problem.severity warning
77
* @id go/useless-expression
8-
* @tags maintainability
8+
* @tags quality
9+
* reliability
910
* correctness
1011
* external/cwe/cwe-480
1112
* external/cwe/cwe-561

go/ql/src/RedundantCode/ImpossibleInterfaceNilCheck.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
* @kind problem
55
* @problem.severity warning
66
* @id go/impossible-interface-nil-check
7-
* @tags correctness
7+
* @tags quality
8+
* reliability
9+
* correctness
10+
* external/cwe/cwe-570
811
* @precision high
912
*/
1013

go/ql/src/RedundantCode/NegativeLengthCheck.ql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
* @problem.severity warning
99
* @precision very-high
1010
* @id go/negative-length-check
11-
* @tags correctness
12-
* quality
11+
* @tags quality
12+
* reliability
13+
* correctness
14+
* external/cwe/cwe-571
1315
*/
1416

1517
import go

go/ql/src/RedundantCode/RedundantExpr.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
* @kind problem
77
* @problem.severity warning
88
* @id go/redundant-operation
9-
* @tags correctness
9+
* @tags quality
10+
* reliability
11+
* correctness
1012
* external/cwe/cwe-480
1113
* external/cwe/cwe-561
1214
* @precision very-high

go/ql/src/RedundantCode/RedundantRecover.ql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
* @kind problem
77
* @problem.severity warning
88
* @id go/redundant-recover
9-
* @tags maintainability
9+
* @tags quality
10+
* reliability
1011
* correctness
11-
* quality
12+
* external/cwe/cwe-248
1213
* @precision high
1314
*/
1415

go/ql/src/RedundantCode/SelfAssignment.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
* @kind problem
55
* @problem.severity warning
66
* @id go/redundant-assignment
7-
* @tags correctness
7+
* @tags quality
8+
* reliability
9+
* correctness
810
* external/cwe/cwe-480
911
* external/cwe/cwe-561
1012
* @precision high

go/ql/src/RedundantCode/ShiftOutOfRange.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
* @problem.severity warning
77
* @id go/shift-out-of-range
88
* @precision very-high
9-
* @tags correctness
9+
* @tags quality
10+
* reliability
11+
* correctness
1012
* external/cwe/cwe-197
1113
*/
1214

go/ql/src/RedundantCode/UnreachableStatement.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
* @kind problem
66
* @problem.severity warning
77
* @id go/unreachable-statement
8-
* @tags maintainability
8+
* @tags quality
9+
* reliability
910
* correctness
1011
* external/cwe/cwe-561
1112
* @precision very-high
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
category: queryMetadata
3+
---
4+
* 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.
5+
* The tag `external/cwe/cwe-129` has been added to `go/constant-length-comparison`.
6+
* The tag `external/cwe/cwe-193` has been added to `go/index-out-of-bounds`.
7+
* The tag `external/cwe/cwe-197` has been added to `go/shift-out-of-range`.
8+
* The tag `external/cwe/cwe-248` has been added to `go/redundant-recover`.
9+
* The tag `external/cwe/cwe-252` has been added to `go/missing-error-check` and `go/unhandled-writable-file-close`.
10+
* The tag `external/cwe/cwe-480` has been added to `go/mistyped-exponentiation`.
11+
* The tag `external/cwe/cwe-570` has been added to `go/impossible-interface-nil-check` and `go/comparison-of-identical-expressions`.
12+
* The tag `external/cwe/cwe-571` has been added to `go/negative-length-check` and `go/comparison-of-identical-expressions`.
13+
* The tag `external/cwe/cwe-783` has been added to `go/whitespace-contradicts-precedence`.
14+
* The tag `external/cwe/cwe-835` has been added to `go/inconsistent-loop-direction`.
15+
* The tag `error-handling` has been added to `go/missing-error-check`, `go/unhandled-writable-file-close`, and `go/unexpected-nil-value`.
16+
* 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`.
17+
* The tag `logic` has been removed from `go/index-out-of-bounds` and `go/unexpected-nil-value`.
18+
* The tags `call` and `defer` have been removed from `go/unhandled-writable-file-close`.
19+
* The tags `correctness` and `quality` have been reordered in `go/missing-error-check` and `go/unhandled-writable-file-close`.
20+
* The tag `maintainability` has been changed to `reliability` for `go/unhandled-writable-file-close`.
21+
* 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.
22+
* The description text has been updated in `go/whitespace-contradicts-precedence` to change "may even indicate" to "may indicate".

0 commit comments

Comments
 (0)