You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/language/learn-ql/writing-queries/introduction-to-queries.rst
+1-19Lines changed: 1 addition & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,19 +10,9 @@ CodeQL includes queries to find the most relevant and interesting problems for e
10
10
11
11
- **Alert queries**: queries that highlight issues in specific locations in your code.
12
12
- **Path queries**: queries that describe the flow of information between a source and a sink in your code.
13
-
- **Metric queries**: queries that compute statistics for your code.
14
13
15
14
You can add custom queries to `custom query packs <https://lgtm.com/help/lgtm/about-queries#what-are-query-packs>`__ to analyze your projects in `LGTM <https://lgtm.com>`__, use them to analyze a database with the `CodeQL CLI <https://help.semmle.com/codeql/codeql-cli.html>`__, or you can contribute to the standard CodeQL queries in our `open source repository on GitHub <https://github.com/github/codeql>`__.
16
15
17
-
.. pull-quote::
18
-
19
-
Note
20
-
21
-
Only the results generated by alert and path queries are displayed on LGTM.
22
-
You can display the results generated by metric queries by running them against your project in the `query console on LGTM <https://lgtm.com/query>`__ or with the CodeQL `extension for VS Code <https://help.semmle.com/codeql/codeql-for-vscode.html>`__.
23
-
You can explore the paths generated by path queries `directly in LGTM <https://lgtm.com/help/lgtm/exploring-data-flow-paths>`__ and in the `Results view <https://help.semmle.com/codeql/codeql-for-vscode/procedures/exploring-paths.html>`__ in VS Code.
24
-
25
-
26
16
This topic is a basic introduction to query files. You can find more information on writing queries for specific programming languages `here <https://help.semmle.com/QL/learn-ql/>`__, and detailed technical information about QL in the `QL language reference <https://help.semmle.com/QL/ql-handbook/index.html>`__.
27
17
For more information on how to format your code when contributing queries to the GitHub repository, see the `CodeQL style guide <https://github.com/github/codeql/blob/master/docs/ql-style-guide.md>`__.
28
18
@@ -45,7 +35,7 @@ Basic query structure
45
35
where /* ... logical formula ... */
46
36
select /* ... expressions ... */
47
37
48
-
The following sections describe the information that is typically included in a query file for alerts and metrics. Path queries are discussed in more detail in :doc:`Creating path queries <path-queries>`.
38
+
The following sections describe the information that is typically included in a query file for alerts. Path queries are discussed in more detail in :doc:`Creating path queries <path-queries>`.
49
39
50
40
Query metadata
51
41
==============
@@ -65,7 +55,6 @@ Query metadata is used to identify your custom queries when they are added to th
65
55
66
56
- Alert query metadata must contain ``@kind problem``.
67
57
- Path query metadata must contain ``@kind path-problem``.
68
-
- Metric query metadata must contain ``@kind metric``.
69
58
70
59
When you define the ``@kind`` property of a custom query you must also ensure that the rest of your query has the correct structure in order to be valid, as described below.
71
60
@@ -121,13 +110,6 @@ You can modify the alert message defined in the final column of the ``select`` s
121
110
122
111
Select clauses for path queries (``@kind path-problem``) are crafted to display both an alert and the source and sink of an associated path graph. For more information, see :doc:`Creating path queries <path-queries>`.
123
112
124
-
Select clauses for metric queries (``@kind metric``) consist of two 'columns', with the following structure::
125
-
126
-
select element, metric
127
-
128
-
- ``element``: a code element that is identified by the query, which defines where the alert is displayed.
129
-
- ``metric``: the result of the metric that the query computes.
0 commit comments