Skip to content

Commit

Permalink
scrooge-generator: make ThriftParser strict on reserved keywords
Browse files Browse the repository at this point in the history
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
joybestourous authored and jenkins committed Jan 20, 2022

Verified

This commit was signed with the committer’s verified signature.
archseer Blaž Hrastnik
1 parent 1f5d738 commit 3376785
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -7,6 +7,13 @@ Note that ``PHAB_ID=#`` and ``RB_ID=#`` correspond to associated messages in com
Unreleased
----------

Breaking API Changes
~~~~~~~~~~~~~~~~~~~~
* scrooge-generator: the `c.t.scrooge.frontend.ThriftParser` now always throws exceptions
rather than warnings when a fieldname matches a reserved keyword. See
`c.t.scrooge.frontend.ThriftKeywords` for the full list of disallowed
keywords. ``PHAB_ID=D814995``

22.1.0
------

Original file line number Diff line number Diff line change
@@ -109,7 +109,7 @@ class ThriftParser(
lazy val simpleIDRegex: Regex = "[A-Za-z_][A-Za-z0-9_]*".r
lazy val simpleID: Parser[SimpleID] = positioned(simpleIDRegex ^^ { x =>
if (ThriftKeywords.contains(x))
failOrWarn(new KeywordException(x))
throw new KeywordException(x)

SimpleID(x)
})

0 comments on commit 3376785

Please sign in to comment.