@@ -204,27 +204,58 @@ private predicate summaryModel(
204
204
)
205
205
}
206
206
207
+ private predicate relevantPackage ( string package ) {
208
+ sourceModel ( package , _, _, _, _, _, _, _) or
209
+ sinkModel ( package , _, _, _, _, _, _, _) or
210
+ summaryModel ( package , _, _, _, _, _, _, _, _)
211
+ }
212
+
213
+ private predicate packageLink ( string shortpkg , string longpkg ) {
214
+ relevantPackage ( shortpkg ) and
215
+ relevantPackage ( longpkg ) and
216
+ longpkg .prefix ( longpkg .indexOf ( "." ) ) = shortpkg
217
+ }
218
+
219
+ private predicate canonicalPackage ( string package ) {
220
+ relevantPackage ( package ) and not packageLink ( _, package )
221
+ }
222
+
223
+ private predicate canonicalPkgLink ( string package , string subpkg ) {
224
+ canonicalPackage ( package ) and
225
+ ( subpkg = package or packageLink ( package , subpkg ) )
226
+ }
227
+
207
228
/**
208
229
* Holds if CSV framework coverage of `package` is `n` api endpoints of the
209
230
* kind `(kind, part)`.
210
231
*/
211
- predicate modelCoverage ( string package , string kind , string part , int n ) {
212
- part = "source" and
213
- n =
214
- strictcount ( string type , boolean subtypes , string name , string signature , string ext ,
215
- string output | sourceModel ( package , type , subtypes , name , signature , ext , output , kind ) )
216
- or
217
- part = "sink" and
218
- n =
219
- strictcount ( string type , boolean subtypes , string name , string signature , string ext ,
220
- string input | sinkModel ( package , type , subtypes , name , signature , ext , input , kind ) )
221
- or
222
- part = "summary" and
223
- n =
224
- strictcount ( string type , boolean subtypes , string name , string signature , string ext ,
225
- string input , string output |
226
- summaryModel ( package , type , subtypes , name , signature , ext , input , output , kind )
227
- )
232
+ predicate modelCoverage ( string package , int pkgs , string kind , string part , int n ) {
233
+ pkgs = strictcount ( string subpkg | canonicalPkgLink ( package , subpkg ) ) and
234
+ (
235
+ part = "source" and
236
+ n =
237
+ strictcount ( string subpkg , string type , boolean subtypes , string name , string signature ,
238
+ string ext , string output |
239
+ canonicalPkgLink ( package , subpkg ) and
240
+ sourceModel ( subpkg , type , subtypes , name , signature , ext , output , kind )
241
+ )
242
+ or
243
+ part = "sink" and
244
+ n =
245
+ strictcount ( string subpkg , string type , boolean subtypes , string name , string signature ,
246
+ string ext , string input |
247
+ canonicalPkgLink ( package , subpkg ) and
248
+ sinkModel ( subpkg , type , subtypes , name , signature , ext , input , kind )
249
+ )
250
+ or
251
+ part = "summary" and
252
+ n =
253
+ strictcount ( string subpkg , string type , boolean subtypes , string name , string signature ,
254
+ string ext , string input , string output |
255
+ canonicalPkgLink ( package , subpkg ) and
256
+ summaryModel ( subpkg , type , subtypes , name , signature , ext , input , output , kind )
257
+ )
258
+ )
228
259
}
229
260
230
261
/** Provides a query predicate to check the CSV data for validation errors. */
0 commit comments