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
+51-43Lines changed: 51 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -10,32 +10,34 @@ setting extractor configuration options through the CodeQL CLI.
10
10
About extractor options
11
11
-----------------------
12
12
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::
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
+
15
+
.. code-block:: json
14
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
@@ -93,27 +95,31 @@ You can also set extractor options through a file. The CodeQL CLI subcommands th
93
95
94
96
Each option file contains a tree structure of nested maps. At the root is an extractor map key, and beneath it are map keys that correspond to extractor names. Starting at the third level, there are extractor options and option groups.
95
97
96
-
In JSON::
98
+
In JSON:
99
+
100
+
.. code-block:: json
97
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
-
In YAML::
114
+
In YAML:
115
+
116
+
.. code-block:: yaml
111
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
@@ -123,14 +129,16 @@ The value for an option group (of type ``object``) must be a map, which may cont
123
129
124
130
Each extractor option value must match the regular expression pattern of the extractor option (if it exists), and it must not contain newline characters.
125
131
126
-
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``::
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``:
133
+
134
+
.. code-block:: yaml
127
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