Skip to content

Commit 8ec0db6

Browse files
d10cCopilot
andcommitted
Rename getAnExpectation to hasExpectation
`getAnExpectation` is a relation that holds between an expectation comment and the parsed parts it carries, not a function returning a single value, so the `get` prefix is misleading and trips the CodeQL predicate-naming style check. Rename it to `hasExpectation`, matching the `has`-prefixed convention for such predicates (and the sibling `hasExpectationWithValue`). Pure rename with no behavior change; reformatted with `codeql query format`. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1adfa307-c48e-43f5-94e3-8286e4a8c083
1 parent 2373613 commit 8ec0db6

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎shared/util/codeql/util/test/InlineExpectationsTest.qll‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,14 @@ module Make<InlineExpectationsTestSig Impl> {
281281
Impl::ExpectationComment comment, string tag, string value, string knownFailure
282282
) {
283283
exists(TColumn column, string tags |
284-
getAnExpectation(comment, column, _, tags, value) and
284+
hasExpectation(comment, column, _, tags, value) and
285285
tag = tags.splitAt(",") and
286286
knownFailure = getColumnString(column) and
287287
not TestImpl::tagIsIgnored(tag)
288288
)
289289
} or
290290
TInvalidExpectation(Impl::ExpectationComment comment, string expectation) {
291-
getAnExpectation(comment, _, expectation, _, _) and
291+
hasExpectation(comment, _, expectation, _, _) and
292292
not expectation.regexpMatch(expectationPattern())
293293
}
294294

@@ -509,7 +509,7 @@ module Make<InlineExpectationsTestSig Impl> {
509509
*/
510510
predicate hasExpectationWithValue(string tag, string value) {
511511
exists(string tags |
512-
getAnExpectation(_, _, _, tags, value) and
512+
hasExpectation(_, _, _, tags, value) and
513513
tag = tags.splitAt(",")
514514
)
515515
}
@@ -604,7 +604,7 @@ private module ExpectationParser<InlineExpectationsTestSig Impl> {
604604
* The `--learn` postprocessing needs to see *every* parsed expectation on a comment - including
605605
* ones the running test ignores - so it can preserve them when rewriting.
606606
*/
607-
predicate getAnExpectation(
607+
predicate hasExpectation(
608608
Impl::ExpectationComment comment, TColumn column, string expectation, string tags, string value
609609
) {
610610
exists(string content |
@@ -1146,7 +1146,7 @@ module TestPostProcessing {
11461146
invalid.getLocation() = comment.getLocation()
11471147
) and
11481148
not exists(string tags |
1149-
getAnExpectation(comment, _, _, tags, _) and
1149+
hasExpectation(comment, _, _, tags, _) and
11501150
not TestInput::tagIsIgnored(tags.splitAt(",")) and
11511151
TestInput::tagIsIgnored(tags.splitAt(","))
11521152
)
@@ -1166,7 +1166,7 @@ module TestPostProcessing {
11661166
TestImpl2::ExpectationComment comment, string column, string text
11671167
) {
11681168
exists(TColumn col, string tags |
1169-
getAnExpectation(comment, col, text, tags, _) and
1169+
hasExpectation(comment, col, text, tags, _) and
11701170
column = getColumnString(col) and
11711171
forall(string tag | tag = tags.splitAt(",") | TestInput::tagIsIgnored(tag))
11721172
)
@@ -1194,7 +1194,7 @@ module TestPostProcessing {
11941194
result = comment.getContents().regexpCapture("\\s*\\$ (?:[^/]|/[^/])*//(.*)", 1).trim()
11951195
or
11961196
// A plain comment with no expectation of its own: its whole content is the note.
1197-
not getAnExpectation(comment, _, _, _, _) and
1197+
not hasExpectation(comment, _, _, _, _) and
11981198
not exists(Test::InvalidTestExpectation invalid |
11991199
invalid.getLocation() = comment.getLocation()
12001200
) and

0 commit comments

Comments
 (0)