@@ -124,17 +124,10 @@ predicate sinkModel(string row) { any(SinkModelCsv s).row(row) }
124124/** Holds if `row` is a summary model. */
125125predicate summaryModel ( string row ) { any ( SummaryModelCsv s ) .row ( row ) }
126126
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-
134127/** Holds if a source model exists for the given parameters. */
135128predicate sourceModel (
136129 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
138131) {
139132 exists ( string row |
140133 sourceModel ( row ) and
@@ -146,14 +139,15 @@ predicate sourceModel(
146139 row .splitAt ( ";" , 4 ) = signature and
147140 row .splitAt ( ";" , 5 ) = ext and
148141 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"
150144 )
151145}
152146
153147/** Holds if a sink model exists for the given parameters. */
154148predicate sinkModel (
155149 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
157151) {
158152 exists ( string row |
159153 sinkModel ( row ) and
@@ -165,22 +159,23 @@ predicate sinkModel(
165159 row .splitAt ( ";" , 4 ) = signature and
166160 row .splitAt ( ";" , 5 ) = ext and
167161 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"
169164 )
170165}
171166
172167/** Holds if a summary model exists for the given parameters. */
173168predicate summaryModel (
174169 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
176171) {
177- summaryModel ( namespace , type , subtypes , name , signature , ext , input , output , kind , generated , _)
172+ summaryModel ( namespace , type , subtypes , name , signature , ext , input , output , kind , provenance , _)
178173}
179174
180175/** Holds if a summary model `row` exists for the given parameters. */
181176predicate summaryModel (
182177 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
184179) {
185180 summaryModel ( row ) and
186181 row .splitAt ( ";" , 0 ) = namespace and
@@ -192,7 +187,8 @@ predicate summaryModel(
192187 row .splitAt ( ";" , 5 ) = ext and
193188 row .splitAt ( ";" , 6 ) = input and
194189 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"
196192}
197193
198194/** Holds if `package` have CSV framework coverage. */
@@ -241,25 +237,25 @@ predicate modelCoverage(string package, int pkgs, string kind, string part, int
241237 part = "source" and
242238 n =
243239 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 |
245241 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 )
247243 )
248244 or
249245 part = "sink" and
250246 n =
251247 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 |
253249 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 )
255251 )
256252 or
257253 part = "summary" and
258254 n =
259255 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 |
261257 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 )
263259 )
264260 )
265261}
@@ -298,9 +294,8 @@ module CsvValidation {
298294 }
299295
300296 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
304299 not kind = [ "taint" , "value" ] and
305300 result = "Invalid kind \"" + kind + "\" in summary model."
306301 )
0 commit comments