Skip to content

Commit 84d6162

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 3125234 commit 84d6162

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
@@ -284,14 +284,14 @@ module Make<InlineExpectationsTestSig Impl> {
284284
Impl::ExpectationComment comment, string tag, string value, string knownFailure
285285
) {
286286
exists(TColumn column, string tags |
287-
getAnExpectation(comment, column, _, tags, value) and
287+
hasExpectation(comment, column, _, tags, value) and
288288
tag = tags.splitAt(",") and
289289
knownFailure = getColumnString(column) and
290290
not TestImpl::tagIsIgnored(tag)
291291
)
292292
} or
293293
TInvalidExpectation(Impl::ExpectationComment comment, string expectation) {
294-
getAnExpectation(comment, _, expectation, _, _) and
294+
hasExpectation(comment, _, expectation, _, _) and
295295
not expectation.regexpMatch(expectationPattern())
296296
}
297297

@@ -512,7 +512,7 @@ module Make<InlineExpectationsTestSig Impl> {
512512
*/
513513
predicate hasExpectationWithValue(string tag, string value) {
514514
exists(string tags |
515-
getAnExpectation(_, _, _, tags, value) and
515+
hasExpectation(_, _, _, tags, value) and
516516
tag = tags.splitAt(",")
517517
)
518518
}
@@ -607,7 +607,7 @@ private module ExpectationParser<InlineExpectationsTestSig Impl> {
607607
* The `--learn` postprocessing needs to see *every* parsed expectation on a comment - including
608608
* ones the running test ignores - so it can preserve them when rewriting.
609609
*/
610-
predicate getAnExpectation(
610+
predicate hasExpectation(
611611
Impl::ExpectationComment comment, TColumn column, string expectation, string tags, string value
612612
) {
613613
exists(string content |
@@ -1150,7 +1150,7 @@ module TestPostProcessing {
11501150
invalid.getLocation() = comment.getLocation()
11511151
) and
11521152
not exists(string tags |
1153-
getAnExpectation(comment, _, _, tags, _) and
1153+
hasExpectation(comment, _, _, tags, _) and
11541154
not TestInput::tagIsIgnored(tags.splitAt(",")) and
11551155
TestInput::tagIsIgnored(tags.splitAt(","))
11561156
)
@@ -1170,7 +1170,7 @@ module TestPostProcessing {
11701170
TestImpl2::ExpectationComment comment, string column, string text
11711171
) {
11721172
exists(TColumn col, string tags |
1173-
getAnExpectation(comment, col, text, tags, _) and
1173+
hasExpectation(comment, col, text, tags, _) and
11741174
column = getColumnString(col) and
11751175
forall(string tag | tag = tags.splitAt(",") | TestInput::tagIsIgnored(tag))
11761176
)
@@ -1198,7 +1198,7 @@ module TestPostProcessing {
11981198
result = comment.getContents().regexpCapture("\\s*\\$ (?:[^/]|/[^/])*//(.*)", 1).trim()
11991199
or
12001200
// A plain comment with no expectation of its own: its whole content is the note.
1201-
not getAnExpectation(comment, _, _, _, _) and
1201+
not hasExpectation(comment, _, _, _, _) and
12021202
not exists(Test::InvalidTestExpectation invalid |
12031203
invalid.getLocation() = comment.getLocation()
12041204
) and

0 commit comments

Comments
 (0)