1
1
/*** Standard fragments ***/
2
2
3
- /** Files and folders * */
3
+ /*- Files and folders - */
4
4
5
- @location = @location_default;
6
-
7
- locations_default(unique int id: @location_default,
8
- int file: @file ref,
9
- int beginLine: int ref,
10
- int beginColumn: int ref,
11
- int endLine: int ref,
12
- int endColumn: int ref
13
- );
14
-
15
- @sourceline = @locatable;
16
-
17
- numlines(int element_id: @sourceline ref,
18
- int num_lines: int ref,
19
- int num_code: int ref,
20
- int num_comment: int ref
21
- );
5
+ /**
6
+ * The location of an element.
7
+ * The location spans column `startcolumn` of line `startline` to
8
+ * column `endcolumn` of line `endline` in file `file`.
9
+ * For more information, see
10
+ * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
11
+ */
12
+ locations_default(
13
+ unique int id: @location_default,
14
+ int file: @file ref,
15
+ int beginLine: int ref,
16
+ int beginColumn: int ref,
17
+ int endLine: int ref,
18
+ int endColumn: int ref
19
+ );
22
20
23
- files(unique int id: @file,
24
- varchar(900) name: string ref);
21
+ files(
22
+ unique int id: @file,
23
+ string name: string ref
24
+ );
25
25
26
- folders(unique int id: @folder,
27
- varchar(900) name: string ref);
26
+ folders(
27
+ unique int id: @folder,
28
+ string name: string ref
29
+ );
28
30
31
+ @container = @file | @folder
29
32
30
- @container = @folder | @file ;
33
+ containerparent(
34
+ int parent: @container ref,
35
+ unique int child: @container ref
36
+ );
31
37
38
+ /*- Lines of code -*/
32
39
33
- containerparent(int parent: @container ref,
34
- unique int child: @container ref);
40
+ numlines(
41
+ int element_id: @sourceline ref,
42
+ int num_lines: int ref,
43
+ int num_code: int ref,
44
+ int num_comment: int ref
45
+ );
35
46
36
- /** Duplicate code * */
47
+ /*- Duplicate code - */
37
48
38
49
duplicateCode(
39
50
unique int id : @duplication,
40
- varchar(900) relativePath : string ref,
41
- int equivClass : int ref);
51
+ string relativePath : string ref,
52
+ int equivClass : int ref
53
+ );
42
54
43
55
similarCode(
44
56
unique int id : @similarity,
45
- varchar(900) relativePath : string ref,
46
- int equivClass : int ref);
57
+ string relativePath : string ref,
58
+ int equivClass : int ref
59
+ );
47
60
48
- @duplication_or_similarity = @duplication | @similarity;
61
+ @duplication_or_similarity = @duplication | @similarity
49
62
50
63
tokens(
51
64
int id : @duplication_or_similarity ref,
52
65
int offset : int ref,
53
66
int beginLine : int ref,
54
67
int beginColumn : int ref,
55
68
int endLine : int ref,
56
- int endColumn : int ref);
69
+ int endColumn : int ref
70
+ );
57
71
58
- /** External data * */
72
+ /*- External data - */
59
73
74
+ /**
75
+ * External data, loaded from CSV files during snapshot creation. See
76
+ * [Tutorial: Incorporating external data](https://help.semmle.com/wiki/display/SD/Tutorial%3A+Incorporating+external+data)
77
+ * for more information.
78
+ */
60
79
externalData(
61
80
int id : @externalDataElement,
62
- varchar(900) path : string ref,
81
+ string path : string ref,
63
82
int column: int ref,
64
- varchar(900) value : string ref
83
+ string value : string ref
65
84
);
66
85
86
+ /*- Snapshot date -*/
87
+
67
88
snapshotDate(unique date snapshotDate : date ref);
68
89
69
- sourceLocationPrefix(varchar(900) prefix : string ref);
90
+ /*- Source location prefix -*/
70
91
71
- /** Version control data **/
92
+ /**
93
+ * The source location of the snapshot.
94
+ */
95
+ sourceLocationPrefix(string prefix : string ref);
96
+
97
+ /*- Version control data -*/
72
98
73
99
svnentries(
74
- int id : @svnentry,
75
- varchar(500) revision : string ref,
76
- varchar(500) author : string ref,
100
+ unique int id : @svnentry,
101
+ string revision : string ref,
102
+ string author : string ref,
77
103
date revisionDate : date ref,
78
104
int changeSize : int ref
79
- );
105
+ )
80
106
81
107
svnaffectedfiles(
82
108
int id : @svnentry ref,
83
109
int file : @file ref,
84
- varchar(500) action : string ref
85
- );
110
+ string action : string ref
111
+ )
86
112
87
113
svnentrymsg(
88
- int id : @svnentry ref,
89
- varchar(500) message : string ref
90
- );
114
+ unique int id : @svnentry ref,
115
+ string message : string ref
116
+ )
91
117
92
118
svnchurn(
93
119
int commit : @svnentry ref,
94
120
int file : @file ref,
95
121
int addedLines : int ref,
96
122
int deletedLines : int ref
97
- );
123
+ )
98
124
125
+ /*- JavaScript-specific part -*/
99
126
100
- /*** JavaScript-specific part ***/
127
+ @location = @location_default
128
+
129
+ @sourceline = @locatable;
101
130
102
131
filetype(
103
132
int file: @file ref,
@@ -1046,14 +1075,50 @@ jsdoc_has_new_parameter (int fn: @jsdoc_function_type_expr ref);
1046
1075
1047
1076
jsdoc_errors (unique int id: @jsdoc_error, int tag: @jsdoc_tag ref, varchar(900) message: string ref, varchar(900) tostring: string ref);
1048
1077
1049
- // YAML
1078
+ @dataflownode = @expr | @function_decl_stmt | @class_decl_stmt | @namespace_declaration | @enum_declaration | @property;
1079
+
1080
+ @optionalchainable = @call_expr | @propaccess;
1081
+
1082
+ isOptionalChaining(int id: @optionalchainable ref);
1083
+
1084
+ /**
1085
+ * The time taken for the extraction of a file.
1086
+ * This table contains non-deterministic content.
1087
+ *
1088
+ * The sum of the `time` column for each (`file`, `timerKind`) pair
1089
+ * is the total time taken for extraction of `file`. The `extractionPhase`
1090
+ * column provides a granular view of the extraction time of the file.
1091
+ */
1092
+ extraction_time(
1093
+ int file : @file ref,
1094
+ // see `com.semmle.js.extractor.ExtractionMetrics.ExtractionPhase`.
1095
+ int extractionPhase: int ref,
1096
+ // 0 for the elapsed CPU time in nanoseconds, 1 for the elapsed wallclock time in nanoseconds
1097
+ int timerKind: int ref,
1098
+ float time: float ref
1099
+ )
1100
+
1101
+ /**
1102
+ * Non-timing related data for the extraction of a single file.
1103
+ * This table contains non-deterministic content.
1104
+ */
1105
+ extraction_data(
1106
+ int file : @file ref,
1107
+ // the absolute path to the cache file
1108
+ varchar(900) cacheFile: string ref,
1109
+ boolean fromCache: boolean ref,
1110
+ int length: int ref
1111
+ )
1112
+
1113
+ /*- YAML -*/
1114
+
1050
1115
#keyset[parent, idx]
1051
1116
yaml (unique int id: @yaml_node,
1052
1117
int kind: int ref,
1053
1118
int parent: @yaml_node_parent ref,
1054
1119
int idx: int ref,
1055
- varchar(900) tag: string ref,
1056
- varchar(900) tostring: string ref);
1120
+ string tag: string ref,
1121
+ string tostring: string ref);
1057
1122
1058
1123
case @yaml_node.kind of
1059
1124
0 = @yaml_scalar_node
@@ -1067,41 +1132,41 @@ case @yaml_node.kind of
1067
1132
@yaml_node_parent = @yaml_collection_node | @file;
1068
1133
1069
1134
yaml_anchors (unique int node: @yaml_node ref,
1070
- varchar(900) anchor: string ref);
1135
+ string anchor: string ref);
1071
1136
1072
1137
yaml_aliases (unique int alias: @yaml_alias_node ref,
1073
- varchar(900) target: string ref);
1138
+ string target: string ref);
1074
1139
1075
1140
yaml_scalars (unique int scalar: @yaml_scalar_node ref,
1076
1141
int style: int ref,
1077
- varchar(900) value: string ref);
1142
+ string value: string ref);
1078
1143
1079
1144
yaml_errors (unique int id: @yaml_error,
1080
- varchar(900) message: string ref);
1145
+ string message: string ref);
1081
1146
1082
1147
yaml_locations(unique int locatable: @yaml_locatable ref,
1083
1148
int location: @location_default ref);
1084
1149
1085
1150
@yaml_locatable = @yaml_node | @yaml_error;
1086
1151
1087
- /* XML Files */
1152
+ /*- XML Files - */
1088
1153
1089
1154
xmlEncoding(
1090
1155
unique int id: @file ref,
1091
- varchar(900) encoding: string ref
1156
+ string encoding: string ref
1092
1157
);
1093
1158
1094
1159
xmlDTDs(
1095
1160
unique int id: @xmldtd,
1096
- varchar(900) root: string ref,
1097
- varchar(900) publicId: string ref,
1098
- varchar(900) systemId: string ref,
1161
+ string root: string ref,
1162
+ string publicId: string ref,
1163
+ string systemId: string ref,
1099
1164
int fileid: @file ref
1100
1165
);
1101
1166
1102
1167
xmlElements(
1103
1168
unique int id: @xmlelement,
1104
- varchar(900) name: string ref,
1169
+ string name: string ref,
1105
1170
int parentid: @xmlparent ref,
1106
1171
int idx: int ref,
1107
1172
int fileid: @file ref
@@ -1110,16 +1175,16 @@ xmlElements(
1110
1175
xmlAttrs(
1111
1176
unique int id: @xmlattribute,
1112
1177
int elementid: @xmlelement ref,
1113
- varchar(900) name: string ref,
1114
- varchar(3600) value: string ref,
1178
+ string name: string ref,
1179
+ string value: string ref,
1115
1180
int idx: int ref,
1116
1181
int fileid: @file ref
1117
1182
);
1118
1183
1119
1184
xmlNs(
1120
1185
int id: @xmlnamespace,
1121
- varchar(900) prefixName: string ref,
1122
- varchar(900) URI: string ref,
1186
+ string prefixName: string ref,
1187
+ string URI: string ref,
1123
1188
int fileid: @file ref
1124
1189
);
1125
1190
@@ -1131,14 +1196,14 @@ xmlHasNs(
1131
1196
1132
1197
xmlComments(
1133
1198
unique int id: @xmlcomment,
1134
- varchar(3600) text: string ref,
1199
+ string text: string ref,
1135
1200
int parentid: @xmlparent ref,
1136
1201
int fileid: @file ref
1137
1202
);
1138
1203
1139
1204
xmlChars(
1140
1205
unique int id: @xmlcharacters,
1141
- varchar(3600) text: string ref,
1206
+ string text: string ref,
1142
1207
int parentid: @xmlparent ref,
1143
1208
int idx: int ref,
1144
1209
int isCDATA: int ref,
@@ -1155,15 +1220,7 @@ xmllocations(
1155
1220
1156
1221
@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace;
1157
1222
1158
- @dataflownode = @expr | @function_decl_stmt | @class_decl_stmt | @namespace_declaration | @enum_declaration | @property;
1159
-
1160
- @optionalchainable = @call_expr | @propaccess;
1161
-
1162
- isOptionalChaining(int id: @optionalchainable ref);
1163
-
1164
- /*
1165
- * configuration files with key value pairs
1166
- */
1223
+ /*- Configuration files with key value pairs -*/
1167
1224
1168
1225
configs(
1169
1226
unique int id: @config
@@ -1187,32 +1244,3 @@ configLocations(
1187
1244
);
1188
1245
1189
1246
@configLocatable = @config | @configName | @configValue;
1190
-
1191
- /**
1192
- * The time taken for the extraction of a file.
1193
- * This table contains non-deterministic content.
1194
- *
1195
- * The sum of the `time` column for each (`file`, `timerKind`) pair
1196
- * is the total time taken for extraction of `file`. The `extractionPhase`
1197
- * column provides a granular view of the extraction time of the file.
1198
- */
1199
- extraction_time(
1200
- int file : @file ref,
1201
- // see `com.semmle.js.extractor.ExtractionMetrics.ExtractionPhase`.
1202
- int extractionPhase: int ref,
1203
- // 0 for the elapsed CPU time in nanoseconds, 1 for the elapsed wallclock time in nanoseconds
1204
- int timerKind: int ref,
1205
- float time: float ref
1206
- )
1207
-
1208
- /**
1209
- * Non-timing related data for the extraction of a single file.
1210
- * This table contains non-deterministic content.
1211
- */
1212
- extraction_data(
1213
- int file : @file ref,
1214
- // the absolute path to the cache file
1215
- varchar(900) cacheFile: string ref,
1216
- boolean fromCache: boolean ref,
1217
- int length: int ref
1218
- )
0 commit comments