linter: Add rule to lint against use of typing.Text and promote str.

This commit is the last in a series of commits which migrated our
entire codebase to use str instead of typing.Text.

Fixes: #9203.
This commit is contained in:
Aditya Bansal
2018-05-14 05:16:08 +05:30
committed by Tim Abbott
parent addfde7374
commit 64678b459c

View File

@@ -515,6 +515,19 @@ def build_custom_checkers(by_lang):
'bad_lines': ['desc = models.TextField() # type: Optional[Text]',
'stream = models.ForeignKey(Stream, on_delete=CASCADE) # type: Optional[Stream]'],
},
{'pattern': '[\s([]Text([^\s\w]|$)',
'exclude': set([
# We are likely to want to keep these dirs Python 2+3 compatible,
# since the plan includes extracting them to a separate project eventually.
'tools/lib',
'tools/linter_lib',
# TODO: Update our migrations from Text->str.
'zerver/migrations/',
# thumbor is (currently) python2 only
'zthumbor/',
]),
'description': "Now that we're a Python 3 only codebase, we don't need to use typing.Text. Please use str instead.",
},
]) + whitespace_rules + comma_whitespace_rule
bash_rules = cast(RuleList, [
{'pattern': '#!.*sh [-xe]',