lint: Ban use of datetime.(utc)now in Python backend.

This may be all we're doing for #3999, but leaving it open just in
case.
This commit is contained in:
Tim Abbott 2017-03-08 21:02:30 -08:00
parent c5ba4e11d4
commit 342a80c3de
1 changed files with 5 additions and 0 deletions

View File

@ -411,6 +411,11 @@ def build_custom_checkers(by_lang):
'include_only': set(["/migrations/"]),
'description': "Don't import models in migrations; see docs/schema-migrations.md for solution",
},
{'pattern': 'datetime[.](now|utcnow)',
'include_only': set(["zerver/", "analytics/"]),
'description': "Don't use datetime in backend code.\n"
"See https://zulip.readthedocs.io/en/latest/code-style.html#naive-datetime-objects",
},
# This rule might give false positives in virtualenv setup files which should be excluded,
# and comments which should be rewritten to avoid use of "python2", "python3", etc.
{'pattern': 'python[23]',