Skip to content

Commit 3376785

Browse files
joybestourousjenkins
authored andcommitted
scrooge-generator: make ThriftParser strict on reserved keywords
Problem: We want to align internal thrift with OSS standards. Solution: To ensure no new usages of reserved keywords arise, we'll change the ThriftParser from optionally failing or warning a user that they've used a keyword to always failing. JIRA Issues: CSL-11611 Differential Revision: https://phabricator.twitter.biz/D814995
1 parent 1f5d738 commit 3376785

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ Note that ``PHAB_ID=#`` and ``RB_ID=#`` correspond to associated messages in com
77
Unreleased
88
----------
99

10+
Breaking API Changes
11+
~~~~~~~~~~~~~~~~~~~~
12+
* scrooge-generator: the `c.t.scrooge.frontend.ThriftParser` now always throws exceptions
13+
rather than warnings when a fieldname matches a reserved keyword. See
14+
`c.t.scrooge.frontend.ThriftKeywords` for the full list of disallowed
15+
keywords. ``PHAB_ID=D814995``
16+
1017
22.1.0
1118
------
1219

scrooge-generator/src/main/scala/com/twitter/scrooge/frontend/ThriftParser.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class ThriftParser(
109109
lazy val simpleIDRegex: Regex = "[A-Za-z_][A-Za-z0-9_]*".r
110110
lazy val simpleID: Parser[SimpleID] = positioned(simpleIDRegex ^^ { x =>
111111
if (ThriftKeywords.contains(x))
112-
failOrWarn(new KeywordException(x))
112+
throw new KeywordException(x)
113113

114114
SimpleID(x)
115115
})

0 commit comments

Comments
 (0)