Skip to content

Commit f8bdb41

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 885b3de commit f8bdb41

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
@@ -252,14 +252,14 @@ module Make<InlineExpectationsTestSig Impl> {
252252
Impl::ExpectationComment comment, string tag, string value, string knownFailure
253253
) {
254254
exists(TColumn column, string tags |
255-
getAnExpectation(comment, column, _, tags, value) and
255+
hasExpectation(comment, column, _, tags, value) and
256256
tag = tags.splitAt(",") and
257257
knownFailure = getColumnString(column) and
258258
not TestImpl::tagIsIgnored(tag)
259259
)
260260
} or
261261
TInvalidExpectation(Impl::ExpectationComment comment, string expectation) {
262-
getAnExpectation(comment, _, expectation, _, _) and
262+
hasExpectation(comment, _, expectation, _, _) and
263263
not expectation.regexpMatch(expectationPattern())
264264
}
265265

@@ -480,7 +480,7 @@ module Make<InlineExpectationsTestSig Impl> {
480480
*/
481481
predicate hasExpectationWithValue(string tag, string value) {
482482
exists(string tags |
483-
getAnExpectation(_, _, _, tags, value) and
483+
hasExpectation(_, _, _, tags, value) and
484484
tag = tags.splitAt(",")
485485
)
486486
}
@@ -575,7 +575,7 @@ private module ExpectationParser<InlineExpectationsTestSig Impl> {
575575
* The `--learn` postprocessing needs to see *every* parsed expectation on a comment - including
576576
* ones the running test ignores - so it can preserve them when rewriting.
577577
*/
578-
predicate getAnExpectation(
578+
predicate hasExpectation(
579579
Impl::ExpectationComment comment, TColumn column, string expectation, string tags, string value
580580
) {
581581
exists(string content |
@@ -1132,7 +1132,7 @@ module TestPostProcessing {
11321132
invalid.getLocation() = comment.getLocation()
11331133
) and
11341134
not exists(string tags |
1135-
getAnExpectation(comment, _, _, tags, _) and
1135+
hasExpectation(comment, _, _, tags, _) and
11361136
not TestInput::tagIsIgnored(tags.splitAt(",")) and
11371137
TestInput::tagIsIgnored(tags.splitAt(","))
11381138
)
@@ -1152,7 +1152,7 @@ module TestPostProcessing {
11521152
TestImpl2::ExpectationComment comment, string column, string text
11531153
) {
11541154
exists(TColumn col, string tags |
1155-
getAnExpectation(comment, col, text, tags, _) and
1155+
hasExpectation(comment, col, text, tags, _) and
11561156
column = getColumnString(col) and
11571157
forall(string tag | tag = tags.splitAt(",") | TestInput::tagIsIgnored(tag))
11581158
)
@@ -1180,7 +1180,7 @@ module TestPostProcessing {
11801180
result = comment.getContents().regexpCapture("\\s*\\$ (?:[^/]|/[^/])*//(.*)", 1).trim()
11811181
or
11821182
// A plain comment with no expectation of its own: its whole content is the note.
1183-
not getAnExpectation(comment, _, _, _, _) and
1183+
not hasExpectation(comment, _, _, _, _) and
11841184
not exists(Test::InvalidTestExpectation invalid |
11851185
invalid.getLocation() = comment.getLocation()
11861186
) and

0 commit comments

Comments
 (0)