From 69fab99ba7a69e0d01f59eab3e91fe8c9d666d9d Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Fri, 8 Jun 2018 14:49:14 -0700 Subject: [PATCH] linter: Add check for incorrect use of inheritance in Bot test cases. --- tools/custom_check.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/custom_check.py b/tools/custom_check.py index c2f41ed..112b0f7 100644 --- a/tools/custom_check.py +++ b/tools/custom_check.py @@ -178,7 +178,14 @@ def build_custom_checkers(by_lang): ' provided by the bots framework to access the filesystem.', 'include_only': set(['zulip_bots/zulip_bots/bots/'])}, {'pattern': 'pprint', - 'description': 'Used pprint, which is most likely a debugging leftover. For user output, use print().'} + 'description': 'Used pprint, which is most likely a debugging leftover. For user output, use print().'}, + {'pattern': '\(BotTestCase\)', + 'bad_lines': ['class TestSomeBot(BotTestCase):'], + 'description': 'Bot test cases should directly inherit from BotTestCase *and* DefaultTests.'}, + {'pattern': '\(DefaultTests, BotTestCase\)', + 'bad_lines': ['class TestSomeBot(DefaultTests, BotTestCase):'], + 'good_lines': ['class TestSomeBot(BotTestCase, DefaultTests):'], + 'description': 'Bot test cases should inherit from BotTestCase before DefaultTests.'}, ]) + whitespace_rules bash_rules = [ {'pattern': '#!.*sh [-xe]',