Skip to content

Commit 1ffb216

Browse files
committed
Catch keeps-building and old-behavior narration in comments
"keeps building old schemas" slipped through after the precision pass narrowed the keep-building phrase to one word order. Flag keep(s) building next to schemas in either order, and old or previous behavior. Self-tests pin both, plus "used to build the type" as purpose, not history.
1 parent 078507b commit 1ffb216

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎src/test/kotlin/graphql/kickstart/tools/CommentConventionsTest.kt‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ class CommentConventionsTest {
4545
assertEquals(listOf("history", "history"), rules("// converted, as it did before this check"))
4646
assertEquals(listOf("history"), rules("// to keep those schemas building"))
4747
assertEquals(listOf("history"), rules("// so those schemas keep building"))
48+
assertEquals(listOf("history"), rules("// keeps building old schemas"))
49+
assertEquals(listOf("history"), rules("// so schemas keep building"))
50+
assertEquals(listOf("history"), rules("// the old behavior was to throw here"))
51+
assertEquals(listOf("history"), rules("// restores the previous behaviour"))
4852
assertEquals(listOf("history"), rules("// this check is no longer needed"))
4953
assertEquals(listOf("version"), rules("/** @since 15.0 */"))
5054
assertEquals(listOf("version"), rules("// since 1.2.0 the parser"))
@@ -56,6 +60,7 @@ class CommentConventionsTest {
5660
listOf(
5761
"// returns the list unchanged",
5862
"// the previously resolved type wins",
63+
"// the cache used to build the type in the scanner",
5964
"// no longer than 80 characters",
6065
"// the result is now cached for the next call",
6166
"// so the loop keeps working on an empty map",
@@ -111,6 +116,9 @@ internal object CommentLint {
111116
"""\b(?:as|like|than) before\b""",
112117
"""\bkeeps? (?:those|these|such|existing|old) (?:\w+ )?(?:building|working)\b""",
113118
"""\b(?:those|these|such|existing|old) schemas? (?:still|keeps?) (?:builds?|building|works?|working)\b""",
119+
"""\bkeeps? building (?:\w+ )?schemas?\b""",
120+
"""\bschemas? keeps? building\b""",
121+
"""\b(?:old|previous) behaviou?r\b""",
114122
)
115123

116124
private val rules = listOf(

0 commit comments

Comments
 (0)