Skip to content

Commit 2034b00

Browse files
committed
C#: Remove deprecated ModelCsv classes.
1 parent 0f038ee commit 2034b00

File tree

1 file changed

+4
-145
lines changed

1 file changed

+4
-145
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/ExternalFlow.qll

Lines changed: 4 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -91,121 +91,14 @@ private import internal.FlowSummaryImpl::Public
9191
private import internal.FlowSummaryImpl::Private::External
9292
private import internal.FlowSummaryImplSpecific
9393

94-
/**
95-
* DEPRECATED: Define source models as data extensions instead.
96-
*
97-
* A unit class for adding additional source model rows.
98-
*
99-
* Extend this class to add additional source definitions.
100-
*/
101-
deprecated class SourceModelCsv = SourceModelCsvInternal;
102-
103-
private class SourceModelCsvInternal extends Unit {
104-
/** Holds if `row` specifies a source definition. */
105-
abstract predicate row(string row);
106-
}
107-
108-
/**
109-
* DEPRECATED: Define sink models as data extensions instead.
110-
*
111-
* A unit class for adding additional sink model rows.
112-
*
113-
* Extend this class to add additional sink definitions.
114-
*/
115-
deprecated class SinkModelCsv = SinkModelCsvInternal;
116-
117-
private class SinkModelCsvInternal extends Unit {
118-
/** Holds if `row` specifies a sink definition. */
119-
abstract predicate row(string row);
120-
}
121-
122-
/**
123-
* DEPRECATED: Define summary models as data extensions instead.
124-
*
125-
* A unit class for adding additional summary model rows.
126-
*
127-
* Extend this class to add additional flow summary definitions.
128-
*/
129-
deprecated class SummaryModelCsv = SummaryModelCsvInternal;
130-
131-
private class SummaryModelCsvInternal extends Unit {
132-
/** Holds if `row` specifies a summary definition. */
133-
abstract predicate row(string row);
134-
}
135-
136-
private predicate sourceModelInternal(string row) { any(SourceModelCsvInternal s).row(row) }
137-
138-
private predicate summaryModelInternal(string row) { any(SummaryModelCsvInternal s).row(row) }
139-
140-
private predicate sinkModelInternal(string row) { any(SinkModelCsvInternal s).row(row) }
141-
14294
/** Holds if a source model exists for the given parameters. */
143-
predicate sourceModel(
144-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
145-
string output, string kind, string provenance
146-
) {
147-
exists(string row |
148-
sourceModelInternal(row) and
149-
row.splitAt(";", 0) = namespace and
150-
row.splitAt(";", 1) = type and
151-
row.splitAt(";", 2) = subtypes.toString() and
152-
subtypes = [true, false] and
153-
row.splitAt(";", 3) = name and
154-
row.splitAt(";", 4) = signature and
155-
row.splitAt(";", 5) = ext and
156-
row.splitAt(";", 6) = output and
157-
row.splitAt(";", 7) = kind and
158-
row.splitAt(";", 8) = provenance
159-
)
160-
or
161-
Extensions::sourceModel(namespace, type, subtypes, name, signature, ext, output, kind, provenance)
162-
}
95+
predicate sourceModel = Extensions::sourceModel/9;
16396

16497
/** Holds if a sink model exists for the given parameters. */
165-
predicate sinkModel(
166-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
167-
string input, string kind, string provenance
168-
) {
169-
exists(string row |
170-
sinkModelInternal(row) and
171-
row.splitAt(";", 0) = namespace and
172-
row.splitAt(";", 1) = type and
173-
row.splitAt(";", 2) = subtypes.toString() and
174-
subtypes = [true, false] and
175-
row.splitAt(";", 3) = name and
176-
row.splitAt(";", 4) = signature and
177-
row.splitAt(";", 5) = ext and
178-
row.splitAt(";", 6) = input and
179-
row.splitAt(";", 7) = kind and
180-
row.splitAt(";", 8) = provenance
181-
)
182-
or
183-
Extensions::sinkModel(namespace, type, subtypes, name, signature, ext, input, kind, provenance)
184-
}
98+
predicate sinkModel = Extensions::sinkModel/9;
18599

186100
/** Holds if a summary model exists for the given parameters. */
187-
predicate summaryModel(
188-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
189-
string input, string output, string kind, string provenance
190-
) {
191-
exists(string row |
192-
summaryModelInternal(row) and
193-
row.splitAt(";", 0) = namespace and
194-
row.splitAt(";", 1) = type and
195-
row.splitAt(";", 2) = subtypes.toString() and
196-
subtypes = [true, false] and
197-
row.splitAt(";", 3) = name and
198-
row.splitAt(";", 4) = signature and
199-
row.splitAt(";", 5) = ext and
200-
row.splitAt(";", 6) = input and
201-
row.splitAt(";", 7) = output and
202-
row.splitAt(";", 8) = kind and
203-
row.splitAt(";", 9) = provenance
204-
)
205-
or
206-
Extensions::summaryModel(namespace, type, subtypes, name, signature, ext, input, output, kind,
207-
provenance)
208-
}
101+
predicate summaryModel = Extensions::summaryModel/10;
209102

210103
/** Holds if a model exists indicating there is no flow for the given parameters. */
211104
predicate neutralModel = Extensions::neutralModel/5;
@@ -316,40 +209,6 @@ module ModelValidation {
316209
)
317210
}
318211

319-
private string getInvalidModelSubtype() {
320-
exists(string pred, string row |
321-
sourceModelInternal(row) and pred = "source"
322-
or
323-
sinkModelInternal(row) and pred = "sink"
324-
or
325-
summaryModelInternal(row) and pred = "summary"
326-
|
327-
exists(string b |
328-
b = row.splitAt(";", 2) and
329-
not b = ["true", "false"] and
330-
result = "Invalid boolean \"" + b + "\" in " + pred + " model."
331-
)
332-
)
333-
}
334-
335-
private string getInvalidModelColumnCount() {
336-
exists(string pred, string row, int expect |
337-
sourceModelInternal(row) and expect = 9 and pred = "source"
338-
or
339-
sinkModelInternal(row) and expect = 9 and pred = "sink"
340-
or
341-
summaryModelInternal(row) and expect = 10 and pred = "summary"
342-
|
343-
exists(int cols |
344-
cols = 1 + max(int n | exists(row.splitAt(";", n))) and
345-
cols != expect and
346-
result =
347-
"Wrong number of columns in " + pred + " model row, expected " + expect + ", got " + cols +
348-
" in " + row + "."
349-
)
350-
)
351-
}
352-
353212
private string getInvalidModelSignature() {
354213
exists(
355214
string pred, string namespace, string type, string name, string signature, string ext,
@@ -391,7 +250,7 @@ module ModelValidation {
391250
msg =
392251
[
393252
getInvalidModelSignature(), getInvalidModelInput(), getInvalidModelOutput(),
394-
getInvalidModelSubtype(), getInvalidModelColumnCount(), getInvalidModelKind()
253+
getInvalidModelKind()
395254
]
396255
}
397256
}

0 commit comments

Comments
 (0)