From d45d9c9ab5f83999e9f7f050125553ce1a001379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20H=C3=B6nig?= Date: Tue, 20 Jun 2017 22:37:35 +0200 Subject: [PATCH] bots: Add linter rule to prevent open() calls. Addresses #5395. --- tools/linter_lib/custom_check.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py index 26db16c597..08cc025838 100644 --- a/tools/linter_lib/custom_check.py +++ b/tools/linter_lib/custom_check.py @@ -301,7 +301,12 @@ def build_custom_checkers(by_lang): 'exclude': set(['tools/lib/provision.py', 'tools/setup/setup_venvs.py', 'scripts/lib/setup_venv.py']), - 'description': 'Explicit python invocations should not include a version'} + 'description': 'Explicit python invocations should not include a version'}, + {'pattern': '(^|\s)open\s*\(', + 'description': 'open() should not be used in Zulip\'s bots. Use functions' + ' provided by the bots framework to access the filesystem.', + 'include_only': set(['api/bots/']), + 'exclude': set(['api/bots/john/john.py'])}, ]) + whitespace_rules bash_rules = [ {'pattern': '#!.*sh [-xe]',