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/codeql/codeql-cli/extractor-options.rst
+47-39Lines changed: 47 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -12,30 +12,32 @@ About extractor options
12
12
13
13
Each extractor defines its own set of configuration options. To find out which options are available for a particular extractor, you can run ``codeql resolve languages`` or ``codeql resolve extractor`` with the ``--format=betterjson`` option. The ``betterjson`` output format provides the root paths of extractors and additional information. The output of ``codeql resolve extractor --format=betterjson`` will often be formatted like the following example::
14
14
15
+
.. code-block:: json
16
+
15
17
{
16
-
"extractor_root" : "/home/user/codeql/java",
17
-
"extractor_options" : {
18
-
"option1" : {
19
-
"title" : "Java extractor option 1",
20
-
"description" : "An example string option for the Java extractor.",
21
-
"type" : "string",
22
-
"pattern" : "[a-z]+"
23
-
},
24
-
"group1" : {
25
-
"title" : "Java extractor group 1",
26
-
"description" : "An example option group for the Java extractor.",
27
-
"type" : "object",
28
-
"properties" : {
29
-
"option2" : {
30
-
"title" : "Java extractor option 2",
31
-
"description" : "An example array option for the Java extractor",
32
-
"type" : "array",
33
-
"pattern" : "[1-9][0-9]*"
18
+
"extractor_root" : "/home/user/codeql/java",
19
+
"extractor_options" : {
20
+
"option1" : {
21
+
"title" : "Java extractor option 1",
22
+
"description" : "An example string option for the Java extractor.",
23
+
"type" : "string",
24
+
"pattern" : "[a-z]+"
25
+
},
26
+
"group1" : {
27
+
"title" : "Java extractor group 1",
28
+
"description" : "An example option group for the Java extractor.",
29
+
"type" : "object",
30
+
"properties" : {
31
+
"option2" : {
32
+
"title" : "Java extractor option 2",
33
+
"description" : "An example array option for the Java extractor",
34
+
"type" : "array",
35
+
"pattern" : "[1-9][0-9]*"
36
+
}
34
37
}
35
-
}
36
-
}
37
-
}
38
-
}
38
+
}
39
+
}
40
+
}
39
41
40
42
The extractor option names and descriptions are listed under ``extractor_options``. Each option may contain the following fields:
41
43
@@ -95,25 +97,29 @@ Each option file contains a tree structure of nested maps. At the root is an ext
95
97
96
98
In JSON::
97
99
100
+
.. code-block:: json
101
+
98
102
{
99
103
"extractor" : {
100
-
“java”: {
101
-
"option1" : “abc”,
102
-
"group1" : {
103
-
"option2" : [ 102 ]
104
-
}
105
-
}
106
-
}
107
-
}
104
+
"java": {
105
+
"option1" : "abc",
106
+
"group1" : {
107
+
"option2" : [ 102 ]
108
+
}
109
+
}
110
+
}
111
+
}
108
112
109
113
110
114
In YAML::
111
115
116
+
.. code-block:: yaml
117
+
112
118
extractor:
113
-
java:
114
-
option1: “abc”
115
-
group1:
116
-
option2: [ 102 ]
119
+
java:
120
+
option1: "abc"
121
+
group1:
122
+
option2: [ 102 ]
117
123
118
124
The value for a ``string`` extractor option must be a string or a number (which will be converted to a string before further processing).
119
125
@@ -125,12 +131,14 @@ Each extractor option value must match the regular expression pattern of the ext
125
131
126
132
Assigning an extractor option that does not exist is an error. You can make the CodeQL CLI ignore unknown extractor options by using a special ``__allow_unknown_properties`` Boolean field. For example, the following option file asks the CodeQL CLI to ignore all unknown extractor options and option groups under ``group1``::
127
133
134
+
.. code-block:: yaml
135
+
128
136
extractor:
129
-
java:
130
-
option1: “abc”
131
-
group1:
132
-
__allow_unknown_properties: true
133
-
option2: [ 102 ]
137
+
java:
138
+
option1: "abc"
139
+
group1:
140
+
__allow_unknown_properties: true
141
+
option2: [ 102 ]
134
142
135
143
You can specify ``--extractor-options-file`` multiple times. The extractor option assignments are processed in the following order:
0 commit comments