Skip to content

Commit d0547cd

Browse files
committed
Fix and improve Extractor options documentation formatting
1 parent eb10982 commit d0547cd

File tree

1 file changed

+47
-39
lines changed

1 file changed

+47
-39
lines changed

docs/codeql/codeql-cli/extractor-options.rst

Lines changed: 47 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,32 @@ About extractor options
1212

1313
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::
1414

15+
.. code-block:: json
16+
1517
{
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+
}
3437
}
35-
}
36-
}
37-
}
38-
}
38+
}
39+
}
40+
}
3941
4042
The extractor option names and descriptions are listed under ``extractor_options``. Each option may contain the following fields:
4143

@@ -95,25 +97,29 @@ Each option file contains a tree structure of nested maps. At the root is an ext
9597

9698
In JSON::
9799

100+
.. code-block:: json
101+
98102
{
99103
"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+
}
108112
109113
110114
In YAML::
111115

116+
.. code-block:: yaml
117+
112118
extractor:
113-
java:
114-
option1: abc
115-
group1:
116-
option2: [ 102 ]
119+
java:
120+
option1: "abc"
121+
group1:
122+
option2: [ 102 ]
117123
118124
The value for a ``string`` extractor option must be a string or a number (which will be converted to a string before further processing).
119125

@@ -125,12 +131,14 @@ Each extractor option value must match the regular expression pattern of the ext
125131

126132
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``::
127133

134+
.. code-block:: yaml
135+
128136
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 ]
134142
135143
You can specify ``--extractor-options-file`` multiple times. The extractor option assignments are processed in the following order:
136144

0 commit comments

Comments
 (0)