Skip to content

Commit e6996ea

Browse files
committed
Add model validation for constructor summary models
1 parent 219ea28 commit e6996ea

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,23 @@ module ModelValidation {
239239
)
240240
}
241241

242+
string getIncorrectConstructorSummaryOutput() {
243+
exists(string namespace, string type, string name, string output |
244+
summaryModel(namespace, type, _, name, _, _, _, output, _, _, _) and
245+
type = name and
246+
output.matches("ReturnValue%") and
247+
result =
248+
"Constructor model for " + namespace + "." + type +
249+
" should use `Argument[this]` in the output, not `ReturnValue`."
250+
)
251+
}
252+
242253
/** Holds if some row in a MaD flow model appears to contain typos. */
243254
query predicate invalidModelRow(string msg) {
244255
msg =
245256
[
246257
getInvalidModelSignature(), getInvalidModelInput(), getInvalidModelOutput(),
247-
KindVal::getInvalidModelKind()
258+
getIncorrectConstructorSummaryOutput(), KindVal::getInvalidModelKind()
248259
]
249260
}
250261
}

0 commit comments

Comments
 (0)