Skip to content

Commit 7208604

Browse files
authored
Merge pull request #19097 from jcogs33/jcogs33/metatdata-previous-id
Docs: add guidance for `previous-id` metadata
2 parents 29b7acf + bea8ce3 commit 7208604

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docs/codeql/writing-codeql-queries/metadata-for-codeql-queries.rst

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ The following properties are supported by all query files:
3030
+-----------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
3131
| ``@id`` | ``<text>`` | A sequence of words composed of lowercase letters or digits, delimited by ``/`` or ``-``, identifying and classifying the query. Each query must have a **unique** ID. To ensure this, it may be helpful to use a fixed structure for each ID. For example, the standard CodeQL queries have the following format: ``<language>/<brief-description>``. |
3232
+-----------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
33+
| ``@previous-id`` | ``<text>`` | Indicates that query results were previously reported on a different query. The previous id should be a sequence of words composed of lowercase letters or digits, delimited by ``/`` or ``-``, identifying and classifying the previous query. |
34+
+-----------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
3335
| ``@kind`` | | ``problem`` | Identifies the query is an alert (``@kind problem``) or a path (``@kind path-problem``). For more information on these query types, see ":doc:`About CodeQL queries <about-codeql-queries>`." |
3436
| | | ``path-problem`` | |
3537
+-----------------------+---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

docs/query-metadata-style-guide.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ Note, `@id` properties should be consistent for queries that highlight the same
9393
* `@id java/tainted-format-string`
9494
* `@id cpp/tainted-format-string`
9595

96+
#### Query previous ID `@previous-id`
97+
98+
Queries with alerts that used to be reported on a different query should also have an `@previous-id` property to refer back to the query where the alerts were originally reported. For example, if alerts from `java/query-one` are now reported on `java/query-two`, then the metadata for `java/query-two` should contain: `@previous-id java/query-one`.
99+
96100

97101
### Query type `@kind`
98102

@@ -113,7 +117,7 @@ Alert queries (`@kind problem` or `path-problem`) support two further properties
113117
* `medium`
114118
* `high`
115119
* `very-high`
116-
* `@problem.severity`–defines the likelihood that an alert, either security-related or not, causes an actual problem such as incorrect program behavior:
120+
* `@problem.severity`–defines the likelihood that an alert, either security-related or not, causes an actual problem such as incorrect program behavior:
117121
* `error`–an issue that is likely to cause incorrect program behavior, for example a crash or vulnerability.
118122
* `warning`–an issue that indicates a potential problem in the code, or makes the code fragile if another (unrelated) part of code is changed.
119123
* `recommendation`–an issue where the code behaves correctly, but it could be improved.

0 commit comments

Comments
 (0)