@@ -124,17 +124,10 @@ predicate sinkModel(string row) { any(SinkModelCsv s).row(row) }
124
124
/** Holds if `row` is a summary model. */
125
125
predicate summaryModel ( string row ) { any ( SummaryModelCsv s ) .row ( row ) }
126
126
127
- bindingset [ input]
128
- private predicate getKind ( string input , string kind , boolean generated ) {
129
- input .splitAt ( ":" , 0 ) = "generated" and kind = input .splitAt ( ":" , 1 ) and generated = true
130
- or
131
- not input .matches ( "%:%" ) and kind = input and generated = false
132
- }
133
-
134
127
/** Holds if a source model exists for the given parameters. */
135
128
predicate sourceModel (
136
129
string namespace , string type , boolean subtypes , string name , string signature , string ext ,
137
- string output , string kind , boolean generated
130
+ string output , string kind , string provenance
138
131
) {
139
132
exists ( string row |
140
133
sourceModel ( row ) and
@@ -146,14 +139,15 @@ predicate sourceModel(
146
139
row .splitAt ( ";" , 4 ) = signature and
147
140
row .splitAt ( ";" , 5 ) = ext and
148
141
row .splitAt ( ";" , 6 ) = output and
149
- exists ( string k | row .splitAt ( ";" , 7 ) = k and getKind ( k , kind , generated ) )
142
+ row .splitAt ( ";" , 7 ) = kind and
143
+ provenance = "manual"
150
144
)
151
145
}
152
146
153
147
/** Holds if a sink model exists for the given parameters. */
154
148
predicate sinkModel (
155
149
string namespace , string type , boolean subtypes , string name , string signature , string ext ,
156
- string input , string kind , boolean generated
150
+ string input , string kind , string provenance
157
151
) {
158
152
exists ( string row |
159
153
sinkModel ( row ) and
@@ -165,22 +159,23 @@ predicate sinkModel(
165
159
row .splitAt ( ";" , 4 ) = signature and
166
160
row .splitAt ( ";" , 5 ) = ext and
167
161
row .splitAt ( ";" , 6 ) = input and
168
- exists ( string k | row .splitAt ( ";" , 7 ) = k and getKind ( k , kind , generated ) )
162
+ row .splitAt ( ";" , 7 ) = kind and
163
+ provenance = "manual"
169
164
)
170
165
}
171
166
172
167
/** Holds if a summary model exists for the given parameters. */
173
168
predicate summaryModel (
174
169
string namespace , string type , boolean subtypes , string name , string signature , string ext ,
175
- string input , string output , string kind , boolean generated
170
+ string input , string output , string kind , string provenance
176
171
) {
177
- summaryModel ( namespace , type , subtypes , name , signature , ext , input , output , kind , generated , _)
172
+ summaryModel ( namespace , type , subtypes , name , signature , ext , input , output , kind , provenance , _)
178
173
}
179
174
180
175
/** Holds if a summary model `row` exists for the given parameters. */
181
176
predicate summaryModel (
182
177
string namespace , string type , boolean subtypes , string name , string signature , string ext ,
183
- string input , string output , string kind , boolean generated , string row
178
+ string input , string output , string kind , string provenance , string row
184
179
) {
185
180
summaryModel ( row ) and
186
181
row .splitAt ( ";" , 0 ) = namespace and
@@ -192,7 +187,8 @@ predicate summaryModel(
192
187
row .splitAt ( ";" , 5 ) = ext and
193
188
row .splitAt ( ";" , 6 ) = input and
194
189
row .splitAt ( ";" , 7 ) = output and
195
- exists ( string k | row .splitAt ( ";" , 8 ) = k and getKind ( k , kind , generated ) )
190
+ row .splitAt ( ";" , 8 ) = kind and
191
+ provenance = "manual"
196
192
}
197
193
198
194
/** Holds if `package` have CSV framework coverage. */
@@ -241,25 +237,25 @@ predicate modelCoverage(string package, int pkgs, string kind, string part, int
241
237
part = "source" and
242
238
n =
243
239
strictcount ( string subpkg , string type , boolean subtypes , string name , string signature ,
244
- string ext , string output , boolean generated |
240
+ string ext , string output , string provenance |
245
241
canonicalPackageHasASubpackage ( package , subpkg ) and
246
- sourceModel ( subpkg , type , subtypes , name , signature , ext , output , kind , generated )
242
+ sourceModel ( subpkg , type , subtypes , name , signature , ext , output , kind , provenance )
247
243
)
248
244
or
249
245
part = "sink" and
250
246
n =
251
247
strictcount ( string subpkg , string type , boolean subtypes , string name , string signature ,
252
- string ext , string input , boolean generated |
248
+ string ext , string input , string provenance |
253
249
canonicalPackageHasASubpackage ( package , subpkg ) and
254
- sinkModel ( subpkg , type , subtypes , name , signature , ext , input , kind , generated )
250
+ sinkModel ( subpkg , type , subtypes , name , signature , ext , input , kind , provenance )
255
251
)
256
252
or
257
253
part = "summary" and
258
254
n =
259
255
strictcount ( string subpkg , string type , boolean subtypes , string name , string signature ,
260
- string ext , string input , string output , boolean generated |
256
+ string ext , string input , string output , string provenance |
261
257
canonicalPackageHasASubpackage ( package , subpkg ) and
262
- summaryModel ( subpkg , type , subtypes , name , signature , ext , input , output , kind , generated )
258
+ summaryModel ( subpkg , type , subtypes , name , signature , ext , input , output , kind , provenance )
263
259
)
264
260
)
265
261
}
@@ -298,9 +294,8 @@ module CsvValidation {
298
294
}
299
295
300
296
private string getInvalidModelKind ( ) {
301
- exists ( string row , string k , string kind | summaryModel ( row ) |
302
- k = row .splitAt ( ";" , 8 ) and
303
- getKind ( k , kind , _) and
297
+ exists ( string row , string kind | summaryModel ( row ) |
298
+ kind = row .splitAt ( ";" , 8 ) and
304
299
not kind = [ "taint" , "value" ] and
305
300
result = "Invalid kind \"" + kind + "\" in summary model."
306
301
)
0 commit comments